71 lines
1.9 KiB
Dart
Raw Normal View History

2025-08-12 17:13:02 +07:00
part of 'button.dart';
class AppElevatedButton extends StatelessWidget {
const AppElevatedButton({
super.key,
required this.text,
required this.isLoading,
required this.onPressed,
this.height = 50,
2025-08-19 15:05:08 +07:00
this.width = double.infinity,
2025-08-12 17:13:02 +07:00
});
final String text;
final bool isLoading;
final Function()? onPressed;
final double height;
2025-08-19 15:05:08 +07:00
final double width;
2025-08-12 17:13:02 +07:00
@override
Widget build(BuildContext context) {
return Container(
height: height,
2025-08-19 15:05:08 +07:00
width: width,
2025-08-12 17:13:02 +07:00
decoration: BoxDecoration(
gradient: const LinearGradient(colors: AppColor.primaryGradient),
borderRadius: BorderRadius.circular(AppValue.radius),
boxShadow: [
BoxShadow(
color: AppColor.primaryWithOpacity(0.3),
blurRadius: 15,
offset: const Offset(0, 8),
),
],
),
child: ElevatedButton(
onPressed: onPressed,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.transparent,
shadowColor: Colors.transparent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
child: isLoading
? Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'Loading',
style: AppStyle.lg.copyWith(
fontWeight: FontWeight.w600,
color: AppColor.white,
),
),
SpaceWidth(8),
SpinKitCircle(color: AppColor.white, size: 24.0),
],
)
: Text(
text,
style: AppStyle.lg.copyWith(
fontWeight: FontWeight.w600,
color: AppColor.white,
),
),
),
);
}
}