Created
January 8, 2025 09:45
-
-
Save Lxxyx/84c188704652921be77ed151d6ecfd53 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FancyButton extends StatelessWidget { | |
final String text; | |
final VoidCallback onPressed; | |
final Color color; | |
const FancyButton({ | |
Key? key, | |
required this.text, | |
required this.onPressed, | |
this.color = Colors.blue, | |
}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
decoration: BoxDecoration( | |
boxShadow: [ | |
BoxShadow( | |
color: Colors.grey.withOpacity(0.5), | |
spreadRadius: 2, | |
blurRadius: 7, | |
offset: Offset(0, 3), // changes position of shadow | |
), | |
], | |
), | |
child: ElevatedButton( | |
style: ElevatedButton.styleFrom( | |
primary: color, | |
onPrimary: Colors.white, | |
elevation: 5, | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(30.0), | |
), | |
), | |
onPressed: onPressed, | |
child: Text( | |
text, | |
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment