button.dart
1 import 'package:flutter/material.dart'; 2 3 class MyButton extends StatelessWidget { 4 const MyButton( 5 {super.key, 6 this.color, 7 this.textColor, 8 required this.buttonText, 9 this.buttonTapped}); 10 11 final color; 12 final textColor; 13 final String buttonText; 14 final buttonTapped; 15 16 @override 17 Widget build(BuildContext context) { 18 return GestureDetector( 19 onTap: buttonTapped, 20 child: Padding( 21 padding: const EdgeInsets.all(8.0), 22 child: ClipRRect( 23 borderRadius: BorderRadius.circular(20), 24 child: Container( 25 color: color, 26 child: Center( 27 child: Text( 28 buttonText, 29 style: TextStyle(color: textColor, fontSize: 20), 30 ), 31 ), 32 ), 33 ), 34 ), 35 ); 36 } 37 }