update bottomsheet

This commit is contained in:
2025-03-03 19:04:46 +05:30
parent 5ed75e2aef
commit 401d82ac70
4 changed files with 103 additions and 94 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -998,7 +998,7 @@
"languageVersion": "3.4"
}
],
"generated": "2025-03-01T13:17:00.413477Z",
"generated": "2025-03-03T13:34:10.761161Z",
"generator": "pub",
"generatorVersion": "3.4.4",
"flutterRoot": "file:///Users/rajeevsingh/Documents/allSoftwares/flutter",

File diff suppressed because one or more lines are too long

View File

@@ -895,106 +895,115 @@ class _MycartState extends State<Mycart> {
void _showBottomSheet(BuildContext context) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (BuildContext context) {
return Consumer<AddtocartProvider>(
builder: (context, pinProvider, child) {
return Container(
padding: EdgeInsets.all(20.w),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Form(
child: Container(
width: 200.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.grey, width: 1),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Expanded(
flex: 2,
child: Container(
height: 20.h,
child: TextFormField(
controller: pinProvider.checkPinCode,
maxLength: 6,
keyboardType: TextInputType.phone,
decoration: InputDecoration(
hintText: 'Enter PIN',
counterText: "",
border: InputBorder.none,
),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Cannot be empty';
} else if (!RegExp(r'^[0-9]{4,6}$')
.hasMatch(value)) {
return 'Enter a valid PIN (4-6 digits)';
}
return null;
},
),
),
),
const SizedBox(width: 8), // Add some spacing
InkWell(
onTap: () {
pinProvider.checkPin(
context, pinProvider.checkPinCode.text);
},
child: pinProvider.ischeckpin
? Center(
child: CircularProgressIndicator(
color: APPCOLOR.lightGreen,
),
)
: Text(
"Check PIN",
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
color: Colors.black,
return Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context)
.viewInsets
.bottom, // Adjusts for keyboard
),
child: SingleChildScrollView(child: Consumer<AddtocartProvider>(
builder: (context, pinProvider, child) {
return Container(
padding: EdgeInsets.all(20.w),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Form(
child: Container(
width: 200.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.grey, width: 1),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Expanded(
flex: 2,
child: Container(
height: 20.h,
child: TextFormField(
controller: pinProvider.checkPinCode,
maxLength: 6,
keyboardType: TextInputType.phone,
decoration: InputDecoration(
hintText: 'Enter PIN',
counterText: "",
border: InputBorder.none,
),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Cannot be empty';
} else if (!RegExp(r'^[0-9]{4,6}$')
.hasMatch(value)) {
return 'Enter a valid PIN (4-6 digits)';
}
return null;
},
),
),
),
const SizedBox(width: 8), // Add some spacing
InkWell(
onTap: () {
pinProvider.checkPin(
context, pinProvider.checkPinCode.text);
},
child: pinProvider.ischeckpin
? Center(
child: CircularProgressIndicator(
color: APPCOLOR.lightGreen,
),
)
: Text(
"Check PIN",
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
],
),
],
),
),
),
),
),
const SizedBox(
height: 10), // Add spacing before the next text
if (!pinProvider.isDeliverable)
Text(
'Delivery is not available for this pincode. Please try another pincode.',
style: TextStyle(color: Colors.red, fontSize: 12),
)
else
Text(
'Delivery available for this pincode. Submit now.',
style: TextStyle(color: Colors.lightGreen, fontSize: 12),
),
const SizedBox(height: 10), // Add spacing before the button
Center(
child: SizedBox(
width: double.infinity,
child: ButtonElevated(
text: 'Submit',
onPressed: () {
Navigator.pop(context);
},
backgroundColor: APPCOLOR.appGreen,
const SizedBox(
height: 10), // Add spacing before the next text
if (!pinProvider.isDeliverable)
Text(
'Delivery is not available for this pincode. Please try another pincode.',
style: TextStyle(color: Colors.red, fontSize: 12),
)
else
Text(
'Delivery available for this pincode. Submit now.',
style:
TextStyle(color: Colors.lightGreen, fontSize: 12),
),
const SizedBox(
height: 10), // Add spacing before the button
Center(
child: SizedBox(
width: double.infinity,
child: ButtonElevated(
text: 'Submit',
onPressed: () {
Navigator.pop(context);
},
backgroundColor: APPCOLOR.appGreen,
),
),
),
),
],
),
],
),
);
},
);
);
},
)));
},
);
}