2024-03-20 09:37:20 +08:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:loading_animation_widget/loading_animation_widget.dart';
|
|
|
|
import 'package:sk_base_mobile/app_theme.dart';
|
|
|
|
import 'package:sk_base_mobile/constants/constants.dart';
|
|
|
|
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
|
|
|
|
|
|
|
class GradientButton extends StatelessWidget {
|
2024-03-20 10:37:52 +08:00
|
|
|
final VoidCallback? onPressed;
|
|
|
|
final bool isLoading;
|
|
|
|
final String buttonText;
|
|
|
|
const GradientButton(
|
2024-03-20 09:37:20 +08:00
|
|
|
{super.key,
|
|
|
|
this.buttonText = TextEnum.createInventoryInOutBtnText,
|
|
|
|
this.onPressed,
|
|
|
|
this.isLoading = false});
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return SizedBox(
|
|
|
|
width: double.infinity,
|
|
|
|
child: ElevatedButton(
|
|
|
|
style: ButtonStyle(
|
|
|
|
backgroundColor:
|
|
|
|
MaterialStateProperty.all<Color>(AppTheme.primaryColor),
|
|
|
|
padding: MaterialStateProperty.all<EdgeInsetsGeometry>(
|
|
|
|
EdgeInsets.symmetric(vertical: ScreenAdaper.height(10)),
|
|
|
|
),
|
|
|
|
minimumSize: MaterialStateProperty.all<Size>(
|
|
|
|
Size(double.infinity, ScreenAdaper.height(80))),
|
|
|
|
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
|
|
|
RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(0),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onPressed: onPressed ?? () => {},
|
|
|
|
child: isLoading
|
|
|
|
? LoadingAnimationWidget.fourRotatingDots(
|
|
|
|
color: AppTheme.nearlyWhite,
|
|
|
|
size: ScreenAdaper.sp(40),
|
|
|
|
)
|
|
|
|
: Text(
|
|
|
|
buttonText,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.white,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: ScreenAdaper.sp(25),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|