Refactor ModernGlassButton to accept customizable padding
This commit is contained in:
@@ -336,6 +336,7 @@ class _PublicFileViewerState extends State<PublicFileViewer> {
|
|||||||
padding: const EdgeInsets.only(left: 16, top: 4),
|
padding: const EdgeInsets.only(left: 16, top: 4),
|
||||||
child: ModernGlassButton(
|
child: ModernGlassButton(
|
||||||
onPressed: _downloadFile,
|
onPressed: _downloadFile,
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 80,
|
width: 80,
|
||||||
child: const Center(child: Icon(Icons.download, size: 24)),
|
child: const Center(child: Icon(Icons.download, size: 24)),
|
||||||
|
|||||||
@@ -6,11 +6,13 @@ class ModernGlassButton extends StatefulWidget {
|
|||||||
final VoidCallback onPressed;
|
final VoidCallback onPressed;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
final bool isLoading;
|
final bool isLoading;
|
||||||
|
final EdgeInsets padding;
|
||||||
|
|
||||||
const ModernGlassButton({
|
const ModernGlassButton({
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
required this.child,
|
required this.child,
|
||||||
this.isLoading = false,
|
this.isLoading = false,
|
||||||
|
this.padding = const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -85,10 +87,7 @@ class _ModernGlassButtonState extends State<ModernGlassButton>
|
|||||||
child: BackdropFilter(
|
child: BackdropFilter(
|
||||||
filter: ImageFilter.blur(sigmaX: 15, sigmaY: 15),
|
filter: ImageFilter.blur(sigmaX: 15, sigmaY: 15),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: widget.padding,
|
||||||
horizontal: 24,
|
|
||||||
vertical: 8,
|
|
||||||
),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
|
|||||||
Reference in New Issue
Block a user