50 lines
1.3 KiB
Dart
50 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:easy_loading_button/easy_loading_button.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
class CommonButton extends StatelessWidget {
|
|
final String text;
|
|
final Future<void> Function() onPressed;
|
|
final double width;
|
|
final double height;
|
|
final Color backgroundColor;
|
|
final Color textColor;
|
|
|
|
const CommonButton({
|
|
super.key,
|
|
required this.text,
|
|
required this.onPressed,
|
|
this.width = 200,
|
|
this.height = 50,
|
|
this.backgroundColor = Colors.blue,
|
|
this.textColor = Colors.white,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return EasyButton(
|
|
type: EasyButtonType.elevated,
|
|
idleStateWidget: Text(
|
|
text,
|
|
style: GoogleFonts.poppins(
|
|
color: textColor,
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
loadingStateWidget: const CircularProgressIndicator(
|
|
strokeWidth: 3.0,
|
|
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
|
|
),
|
|
useWidthAnimation: true,
|
|
useEqualLoadingStateWidgetDimension: true,
|
|
width: width,
|
|
height: height,
|
|
borderRadius: 8,
|
|
contentGap: 6.0,
|
|
buttonColor: backgroundColor,
|
|
onPressed: onPressed,
|
|
);
|
|
}
|
|
}
|