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'; import 'package:sk_base_mobile/widgets/core/sk_ink.dart'; class GradientButton extends StatelessWidget { final VoidCallback? onPressed; final bool isLoading; final String buttonText; final Icon? icon; final BorderRadiusGeometry? borderRadius; const GradientButton( {super.key, this.buttonText = TextEnum.createInventoryInOutBtnText, this.onPressed, this.icon, this.borderRadius, this.isLoading = false}); @override Widget build(BuildContext context) { return SkInk( onTap: onPressed ?? () {}, gradient: const LinearGradient( colors: [AppTheme.primaryColorLight, AppTheme.primaryColor]), child: SizedBox( height: ScreenAdaper.height(80), child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ if (icon != null) ...[ icon!, SizedBox( width: ScreenAdaper.width(10), ) ], isLoading ? LoadingAnimationWidget.fourRotatingDots( color: AppTheme.nearlyWhite, size: ScreenAdaper.height(40), ) : Text( buttonText, style: TextStyle( color: AppTheme.nearlyWhite, fontWeight: FontWeight.bold, fontSize: ScreenAdaper.height(25), ), ) ])), ); // ElevatedButton( // style: ButtonStyle( // backgroundColor: // MaterialStateProperty.all(AppTheme.primaryColor), // minimumSize: MaterialStateProperty.all( // Size(double.infinity, ScreenAdaper.height(80))), // shape: MaterialStateProperty.all( // RoundedRectangleBorder( // borderRadius: borderRadius ?? BorderRadius.circular(10), // ), // ), // ), // onPressed: onPressed ?? () => {}, // child: Text( // buttonText, // style: TextStyle( // color: AppTheme.nearlyWhite, // fontWeight: FontWeight.bold, // fontSize: ScreenAdaper.height(25), // ), // ), // child: Row( // crossAxisAlignment: CrossAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.center, // children: [ // if (icon != null) ...[ // icon!, // SizedBox( // width: ScreenAdaper.width(10), // ) // ], // isLoading // ? LoadingAnimationWidget.fourRotatingDots( // color: AppTheme.nearlyWhite, // size: ScreenAdaper.height(40), // ) // : Text( // buttonText, // style: TextStyle( // color: AppTheme.nearlyWhite, // fontWeight: FontWeight.bold, // fontSize: ScreenAdaper.height(25), // ), // ) // ]), // ); } }