Skip to content

Instantly share code, notes, and snippets.

@Lxxyx
Created March 7, 2025 19:51
Show Gist options
  • Save Lxxyx/215ce120bd8b5f08ea77a15f078ecd24 to your computer and use it in GitHub Desktop.
Save Lxxyx/215ce120bd8b5f08ea77a15f078ecd24 to your computer and use it in GitHub Desktop.
class FancyButton extends StatelessWidget {
final String text;
final Function onPressed;
const FancyButton({required this.text, required this.onPressed, super.key});
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(30)),
gradient: LinearGradient(
colors: [Colors.purple, Colors.blue],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
child: ElevatedButton(
onPressed: () {
onPressed();
},
style: ElevatedButton.styleFrom(
primary: Colors.transparent,
onPrimary: Colors.white,
shadowColor: Colors.transparent,
elevation: 0,
textStyle: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
padding: const EdgeInsets.symmetric(vertical: 15),
),
child: Text(text),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment