218 lines
8.7 KiB
Dart
218 lines
8.7 KiB
Dart
import 'package:citycards_customer/checkout/bloc/purchase_details_bloc.dart';
|
|
import 'package:citycards_customer/common_packages/custom_filled_button.dart';
|
|
import 'package:citycards_customer/common_packages/custom_text.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
class PurchaseDetailsBottomsheet extends StatelessWidget {
|
|
const PurchaseDetailsBottomsheet({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocProvider(
|
|
create: (_) => PurchaseDetailsBloc(),
|
|
child: AnimatedPadding(
|
|
duration: const Duration(milliseconds: 250),
|
|
curve: Curves.easeOut,
|
|
padding: EdgeInsets.only(
|
|
top: 24.h,
|
|
left: 20.w,
|
|
right: 20.w,
|
|
bottom: MediaQuery.of(context).viewInsets.bottom,
|
|
),
|
|
child: BlocBuilder<PurchaseDetailsBloc, PurchaseDetailsState>(
|
|
builder: (context, state) {
|
|
final selected = state.buyPassState;
|
|
|
|
return Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
// --- Handle Bar ---
|
|
Container(
|
|
height: 4.h,
|
|
width: 40.w,
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFF2D3134),
|
|
borderRadius: BorderRadius.circular(4.r),
|
|
),
|
|
),
|
|
SizedBox(height: 12.h),
|
|
|
|
CustomText(
|
|
text: "Purchase Details",
|
|
size: 18.sp,
|
|
weight: FontWeight.w600,
|
|
),
|
|
SizedBox(height: 22.h),
|
|
|
|
// --- Option 1: Buy for Myself ---
|
|
GestureDetector(
|
|
onTap: () {
|
|
context.read<PurchaseDetailsBloc>().add(
|
|
SetPurchaseDetailsEvent("myself"),
|
|
);
|
|
},
|
|
child: Container(
|
|
padding: EdgeInsets.all(6),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(
|
|
color: selected == "myself"
|
|
? const Color(0xFFF95F62)
|
|
: Colors.transparent,
|
|
),
|
|
borderRadius: BorderRadius.circular(10.r),
|
|
),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Icon(
|
|
selected == "myself"
|
|
? Icons.radio_button_checked
|
|
: Icons.radio_button_off,
|
|
color: selected == "myself"
|
|
? const Color(0xFFF95F62)
|
|
: Color(0xFF2B2929).withOpacity(.6),
|
|
size: 24.sp,
|
|
),
|
|
SizedBox(width: 8.w),
|
|
CustomText(
|
|
text: "Buy Pass for Myself",
|
|
color: selected == "myself"
|
|
? const Color(0xFFF95F62)
|
|
: Color(0xFF2B2929).withOpacity(.6),
|
|
size: 16.sp,
|
|
weight: FontWeight.w500,
|
|
),
|
|
],
|
|
),
|
|
if (selected == "myself") ...[
|
|
SizedBox(height: 6.h),
|
|
CustomText(
|
|
text: "Frank Adam",
|
|
size: 14.sp,
|
|
weight: FontWeight.w400,
|
|
color: Colors.black.withOpacity(0.6),
|
|
),
|
|
SizedBox(height: 4.h),
|
|
CustomText(
|
|
text: "132 My Street, Kingston, NY 12401",
|
|
size: 12.sp,
|
|
color: const Color(
|
|
0xFF000000,
|
|
).withOpacity(0.4),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
if (selected == "myself")
|
|
Container(
|
|
padding: EdgeInsets.symmetric(
|
|
horizontal: 6.w,
|
|
vertical: 6.h,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFFF95F62).withOpacity(0.12),
|
|
border: Border.all(
|
|
color: const Color(0xFFF95F62),
|
|
width: 1,
|
|
),
|
|
borderRadius: BorderRadius.circular(12.r),
|
|
),
|
|
child: CustomText(
|
|
text: "Edit Details",
|
|
size: 16.sp,
|
|
weight: FontWeight.w500,
|
|
color: const Color(0xFFF95F62),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
SizedBox(height: 16.h),
|
|
|
|
// --- Option 2: Gift the Pass ---
|
|
GestureDetector(
|
|
onTap: () {
|
|
context.read<PurchaseDetailsBloc>().add(
|
|
SetPurchaseDetailsEvent("gift"),
|
|
);
|
|
},
|
|
child: Container(
|
|
padding: EdgeInsets.all(12.w),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(
|
|
color: selected == "gift"
|
|
? const Color(0xFFF95F62)
|
|
: Colors.transparent,
|
|
),
|
|
borderRadius: BorderRadius.circular(12.r),
|
|
),
|
|
child: Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Icon(
|
|
selected == "gift"
|
|
? Icons.radio_button_checked
|
|
: Icons.radio_button_off,
|
|
color: selected == "gift"
|
|
? const Color(0xFFF95F62)
|
|
: Color(0xFF2F2A2A).withOpacity(0.4),
|
|
size: 24.sp,
|
|
),
|
|
SizedBox(width: 8.w),
|
|
CustomText(
|
|
text: "Gift the pass",
|
|
color: selected == "gift"
|
|
? const Color(0xFFF95F62)
|
|
: Color(0xFF2F2A2A).withOpacity(0.4),
|
|
size: 16.sp,
|
|
weight: FontWeight.w500,
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: 6.h),
|
|
if (selected == "gift")
|
|
CustomText(
|
|
text: "Gift the pass for someone else",
|
|
size: 12.sp,
|
|
color: const Color(0xFF000000).withOpacity(0.6),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
|
|
SizedBox(height: 24.h),
|
|
|
|
// --- Proceed Button ---
|
|
CustomFilledButton(
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
},
|
|
label: "Proceed",
|
|
width: double.infinity,
|
|
),
|
|
SizedBox(height: 20.h),
|
|
],
|
|
);
|
|
},
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|