mDialogSelectItemsCupertinoPicker<T> function
Implementation
Future<T?>? mDialogSelectItemsCupertinoPicker<T>(List<String> options) {
if (options.isEmpty) {
myToast('data error');
return null;
}
int selectedIndex = 0;
return Get.dialog<T>(
MColumn(
modifier: MColumnModifier.height(300.px)
.backgroundColor(Colors.black.withOpacity(0.7))
.paddingBottom(paddingBottom())
.gravityBottom()
.borderTop(color: Colors.white)
.radiusTop(5.px),
children: [
MRow(
modifier: MRowModifier.mainAxisEnd(),
children: [
MButtonSoMiniGradient(
onPressed: () async {
Get.back(result: options[selectedIndex]);
},
buttonText: "confirm",
margin: EdgeInsets.all(10.px),
),
],
),
Expanded(
child: CupertinoPicker(
itemExtent: 32.0,
onSelectedItemChanged: (int index) {
selectedIndex = index;
},
children: options.map((String item) {
return Center(child: Text(item));
}).toList(),
),
),
],
),
useSafeArea: false,
);
}