68 lines
1.9 KiB
Dart
68 lines
1.9 KiB
Dart
|
|
part of 'button.dart';
|
||
|
|
|
||
|
|
class AppElevatedButton extends StatelessWidget {
|
||
|
|
const AppElevatedButton({
|
||
|
|
super.key,
|
||
|
|
required this.text,
|
||
|
|
required this.isLoading,
|
||
|
|
required this.onPressed,
|
||
|
|
this.height = 50,
|
||
|
|
});
|
||
|
|
|
||
|
|
final String text;
|
||
|
|
final bool isLoading;
|
||
|
|
final Function()? onPressed;
|
||
|
|
final double height;
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
return Container(
|
||
|
|
height: height,
|
||
|
|
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,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|