You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aku_new_community/lib/widget/picker/bee_identify_picker.dart

54 lines
1.6 KiB

3 years ago
import 'package:aku_new_community/utils/bee_map.dart';
import 'package:aku_new_community/utils/enum/identify.dart';
import 'package:aku_new_community/widget/picker/bee_picker_box.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
class BeeIdentifyPicker extends StatefulWidget {
static Future<Identify> pick(BuildContext context) async {
var result = await showModalBottomSheet(
context: context,
builder: (context) {
return BeeIdentifyPicker();
});
return result;
}
const BeeIdentifyPicker({
Key? key,
}) : super(key: key);
@override
_BeeIdentifyPickerState createState() => _BeeIdentifyPickerState();
}
class _BeeIdentifyPickerState extends State<BeeIdentifyPicker> {
Identify _identify = Identify.OWNER;
@override
Widget build(BuildContext context) {
return BeePickerBox(
onPressed: () {
Get.back(result: _identify);
},
title: '选择身份',
child: CupertinoPicker(
onSelectedItemChanged: (int value) {
_identify = Identify.values[value];
},
itemExtent: 80.w,
children: Identify.values
.map((e) => Center(
child: Padding(
padding: EdgeInsets.only(left: 8.w, right: 40.w),
child: Text(BeeMap.getIdentify(e),
textAlign: TextAlign.center),
),
))
.toList(),
));
}
}