onufitness_mobile/lib/widgets/others/button_action_bottom_sheet.dart
2026-01-13 11:36:24 +05:30

109 lines
3.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:onufitness/utils/helper_function.dart';
import 'package:onufitness/widgets/Buttons/custom_social_login_button.dart';
import 'package:onufitness/widgets/Buttons/custom_submit_button.dart';
Future<void> actionButtonBottomSheet({
required BuildContext context,
required String title,
required String subtitle,
required String submitButtonText,
required VoidCallback onPressed,
required String cancelButtonText,
required VoidCallback onCancelPressed,
required String assetPath,
required Color primaryColor,
required Color cancelBorderColor,
required RxBool isLoading,
}) async {
await showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
isScrollControlled: true,
builder: (context) {
return Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(top: Radius.circular(20.r)),
),
padding: EdgeInsets.all(20.w),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// Icon
Container(
padding: EdgeInsets.all(20.w),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.pink.shade50,
),
child: SizedBox(
height: 30.h,
width: 30.w,
child: Image.asset(assetPath),
),
),
SizedBox(height: 16.h),
// Title
Text(
title,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: isTablet ? 24.sp : 18.sp,
fontWeight: FontWeight.w600,
),
),
SizedBox(height: 10.h),
// Subtitle
Text(
subtitle,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 14.sp, color: Colors.black87),
),
SizedBox(height: 20.h),
// Submit Button
Obx(
() => CustomSubmitButton(
backgroundColor: primaryColor,
textColor: Colors.black,
fontWeight: FontWeight.w600,
fontSize: isTablet ? 20.sp : 18.sp,
text: submitButtonText,
onPressed: onPressed,
isLoading: isLoading.value,
),
),
SizedBox(height: 10.h),
// Cancel Button
CustomSocialLoginButton(
textColor: Colors.black,
text: cancelButtonText,
borderSide: BorderSide(color: cancelBorderColor),
onPressed: onCancelPressed,
),
SizedBox(height: 10.h),
Container(
color: Colors.white,
padding: EdgeInsetsDirectional.only(
bottom: MediaQuery.of(context).viewPadding.bottom,
),
),
],
),
),
);
},
);
}