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" "languageVersion": "3.4"
} }
], ],
"generated": "2025-03-01T13:17:00.413477Z", "generated": "2025-03-03T13:34:10.761161Z",
"generator": "pub", "generator": "pub",
"generatorVersion": "3.4.4", "generatorVersion": "3.4.4",
"flutterRoot": "file:///Users/rajeevsingh/Documents/allSoftwares/flutter", "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) { void _showBottomSheet(BuildContext context) {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
isScrollControlled: true,
builder: (BuildContext context) { builder: (BuildContext context) {
return Consumer<AddtocartProvider>( return Padding(
builder: (context, pinProvider, child) { padding: EdgeInsets.only(
return Container( bottom: MediaQuery.of(context)
padding: EdgeInsets.all(20.w), .viewInsets
child: Column( .bottom, // Adjusts for keyboard
mainAxisSize: MainAxisSize.min, ),
children: [ child: SingleChildScrollView(child: Consumer<AddtocartProvider>(
Form( builder: (context, pinProvider, child) {
child: Container( return Container(
width: 200.h, padding: EdgeInsets.all(20.w),
decoration: BoxDecoration( child: Column(
borderRadius: BorderRadius.circular(8), mainAxisSize: MainAxisSize.min,
border: Border.all(color: Colors.grey, width: 1), children: [
), Form(
child: Padding( child: Container(
padding: const EdgeInsets.all(8.0), width: 200.h,
child: Row( decoration: BoxDecoration(
children: [ borderRadius: BorderRadius.circular(8),
Expanded( border: Border.all(color: Colors.grey, width: 1),
flex: 2, ),
child: Container( child: Padding(
height: 20.h, padding: const EdgeInsets.all(8.0),
child: TextFormField( child: Row(
controller: pinProvider.checkPinCode, children: [
maxLength: 6, Expanded(
keyboardType: TextInputType.phone, flex: 2,
decoration: InputDecoration( child: Container(
hintText: 'Enter PIN', height: 20.h,
counterText: "", child: TextFormField(
border: InputBorder.none, controller: pinProvider.checkPinCode,
), maxLength: 6,
validator: (value) { keyboardType: TextInputType.phone,
if (value == null || value.isEmpty) { decoration: InputDecoration(
return 'Cannot be empty'; hintText: 'Enter PIN',
} else if (!RegExp(r'^[0-9]{4,6}$') counterText: "",
.hasMatch(value)) { border: InputBorder.none,
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,
), ),
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
const SizedBox( if (!pinProvider.isDeliverable)
height: 10), // Add spacing before the next text Text(
if (!pinProvider.isDeliverable) 'Delivery is not available for this pincode. Please try another pincode.',
Text( style: TextStyle(color: Colors.red, fontSize: 12),
'Delivery is not available for this pincode. Please try another pincode.', )
style: TextStyle(color: Colors.red, fontSize: 12), else
) Text(
else 'Delivery available for this pincode. Submit now.',
Text( style:
'Delivery available for this pincode. Submit now.', TextStyle(color: Colors.lightGreen, fontSize: 12),
style: TextStyle(color: Colors.lightGreen, fontSize: 12), ),
), const SizedBox(
const SizedBox(height: 10), // Add spacing before the button height: 10), // Add spacing before the button
Center( Center(
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
child: ButtonElevated( child: ButtonElevated(
text: 'Submit', text: 'Submit',
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
}, },
backgroundColor: APPCOLOR.appGreen, backgroundColor: APPCOLOR.appGreen,
),
),
), ),
), ],
), ),
], );
), },
); )));
},
);
}, },
); );
} }