更新验证码选择区号
This commit is contained in:
@@ -11,6 +11,7 @@ import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/language/AppLanguage.dart';
|
||||
import 'package:vbvs_app/pages/common/selectDialog.dart';
|
||||
|
||||
@@ -1154,3 +1155,154 @@ Future<void> showIntervalPickerDialog(
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Future<void> showCountryCodePickerDialog(
|
||||
BuildContext context, {
|
||||
required String initialCode, // 初始区号,如 "+86"
|
||||
required Function(String selectedCode) onConfirm,
|
||||
String title = "选择区号",
|
||||
}) async {
|
||||
UserInfoController controller = Get.find();
|
||||
ThemeController themeController = Get.find();
|
||||
|
||||
final List<Map<String, String>> list = controller.country_code;
|
||||
|
||||
int selectedIndex =
|
||||
list.indexWhere((e) => e["id"] == initialCode);
|
||||
if (selectedIndex < 0) selectedIndex = 0;
|
||||
|
||||
final RxInt tempIndex = RxInt(selectedIndex);
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
builder: (BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: Dialog(
|
||||
backgroundColor: themeController.currentColor.sc17,
|
||||
insetPadding: EdgeInsets.zero,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.zero,
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(0, 0, 0, 90.rpx),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
/// 顶部栏
|
||||
Container(
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 30.rpx),
|
||||
color: themeController.currentColor.sc5,
|
||||
height: 80.rpx,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
onTap: Get.back,
|
||||
padding: EdgeInsets.all(0),
|
||||
child: SizedBox(
|
||||
width: 110.rpx,
|
||||
height: 60.rpx,
|
||||
child: Center(
|
||||
child: Text(
|
||||
"取消".tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
title.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color:
|
||||
themeController.currentColor.sc3,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
ClickableContainer(
|
||||
padding: EdgeInsets.all(0),
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
onTap: () {
|
||||
onConfirm(
|
||||
list[tempIndex.value]["id"]!);
|
||||
Get.back();
|
||||
},
|
||||
child: SizedBox(
|
||||
width: 110.rpx,
|
||||
height: 60.rpx,
|
||||
child: Center(
|
||||
child: Text(
|
||||
"确定".tr,
|
||||
style: TextStyle(
|
||||
color: themeController
|
||||
.currentColor.sc2,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 20.rpx),
|
||||
|
||||
/// Picker
|
||||
Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: IgnorePointer(
|
||||
child: Center(
|
||||
child: Container(
|
||||
height: 90.rpx,
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 95.rpx),
|
||||
decoration: BoxDecoration(
|
||||
color: themeController
|
||||
.currentColor.sc2,
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
16.rpx),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 240.rpx,
|
||||
child: getOnePickers(
|
||||
context,
|
||||
list
|
||||
.map((e) =>
|
||||
"${e['name']}".tr+"(${e['id']})")
|
||||
.toList(),
|
||||
tempIndex,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user