Files
food_delivery_mobile/lib/feature/common/presentation/widgets/app_button.dart
jahongireshonqulov cdec9980af feat:login page done
2025-10-28 19:41:05 +05:00

74 lines
2.0 KiB
Dart

import '../../../../food_delivery_client.dart';
class AppButton extends StatelessWidget {
const AppButton({
super.key,
required this.name,
this.onPressed,
this.margin,
this.backgroundColor,
this.borderRadius,
this.height,
this.textColor,
this.width,
this.action,
this.trailing,
this.mainAxisAlignment,
this.isLoading = false,
});
final String name;
final VoidCallback? onPressed;
final EdgeInsets? margin;
final Color? backgroundColor;
final Color? textColor;
final double? borderRadius;
final double? width;
final double? height;
final Widget? action;
final Widget? trailing;
final bool isLoading;
final MainAxisAlignment? mainAxisAlignment;
@override
Widget build(BuildContext context) {
return Bounceable(
onTap: onPressed,
duration: TimeDelayConst.durationMill150,
child: Container(
width: width ?? double.infinity,
height: height ?? 55,
margin: margin,
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
color: backgroundColor ?? AppColors.c000000,
borderRadius: BorderRadius.circular(borderRadius ?? 0),
),
child: isLoading
? Center(
child: CircularProgressIndicator.adaptive(
padding: EdgeInsets.all(2),
valueColor: AlwaysStoppedAnimation(AppColors.cFFFFFF),
backgroundColor: AppColors.cFFFFFF,
),
)
: Row(
mainAxisAlignment:
mainAxisAlignment ?? MainAxisAlignment.center,
children: [
action ?? AppUtils.kSizedBox,
Text(
name,
style: AppTextStyles.size16Bold.copyWith(
color: AppColors.cFFFFFF,
),
),
trailing ?? AppUtils.kSizedBox,
],
),
),
);
}
}