Skip to content

Instantly share code, notes, and snippets.

@Lxxyx
Created January 8, 2025 09:45
Show Gist options
  • Save Lxxyx/84c188704652921be77ed151d6ecfd53 to your computer and use it in GitHub Desktop.
Save Lxxyx/84c188704652921be77ed151d6ecfd53 to your computer and use it in GitHub Desktop.
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