w-R
3 years ago
30 changed files with 1933 additions and 579 deletions
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 227 KiB |
After Width: | Height: | Size: 32 KiB |
@ -0,0 +1,794 @@
|
||||
{ |
||||
"热门":[ |
||||
{ |
||||
"area": "中国", |
||||
"area_code": "+86" |
||||
}, |
||||
{ |
||||
"area": "中国(香港)", |
||||
"area_code": "+852" |
||||
}, |
||||
{ |
||||
"area": "中国(澳门)", |
||||
"area_code": "+853" |
||||
}, |
||||
{ |
||||
"area": "中国(台湾)", |
||||
"area_code": "+886" |
||||
} |
||||
], |
||||
"A": [ |
||||
{ |
||||
"area": "阿尔巴尼亚", |
||||
"area_code": "+355" |
||||
}, |
||||
{ |
||||
"area": "阿尔及利亚", |
||||
"area_code": "+213" |
||||
}, |
||||
{ |
||||
"area": "阿富汗", |
||||
"area_code": "+93" |
||||
}, |
||||
{ |
||||
"area": "阿根廷", |
||||
"area_code": "+54" |
||||
}, |
||||
{ |
||||
"area": "阿拉斯加", |
||||
"area_code": "+1907" |
||||
}, |
||||
{ |
||||
"area": "阿鲁巴岛", |
||||
"area_code": "+297" |
||||
}, |
||||
{ |
||||
"area": "阿曼", |
||||
"area_code": "+968" |
||||
}, |
||||
{ |
||||
"area": "阿森松", |
||||
"area_code": "+247" |
||||
}, |
||||
{ |
||||
"area": "埃及", |
||||
"area_code": "+20" |
||||
}, |
||||
{ |
||||
"area": "埃塞俄比亚", |
||||
"area_code": "+251" |
||||
}, |
||||
{ |
||||
"area": "爱尔兰", |
||||
"area_code": "+353" |
||||
}, |
||||
{ |
||||
"area": "安哥拉", |
||||
"area_code": "+244" |
||||
}, |
||||
{ |
||||
"area": "安圭拉岛", |
||||
"area_code": "+1809" |
||||
}, |
||||
{ |
||||
"area": "奥地利", |
||||
"area_code": "+43" |
||||
}, |
||||
{ |
||||
"area": "澳大利亚", |
||||
"area_code": "+61" |
||||
}, |
||||
{ |
||||
"area": "澳门", |
||||
"area_code": "+853" |
||||
} |
||||
], |
||||
"B": [ |
||||
{ |
||||
"area": "巴巴多斯", |
||||
"area_code": "+1809" |
||||
}, |
||||
{ |
||||
"area": "巴哈马", |
||||
"area_code": "+1809" |
||||
}, |
||||
{ |
||||
"area": "巴基斯坦", |
||||
"area_code": "+92" |
||||
}, |
||||
{ |
||||
"area": "巴拉圭", |
||||
"area_code": "+595" |
||||
}, |
||||
{ |
||||
"area": "巴林", |
||||
"area_code": "+973" |
||||
}, |
||||
{ |
||||
"area": "巴拿马", |
||||
"area_code": "+507" |
||||
}, |
||||
{ |
||||
"area": "巴西", |
||||
"area_code": "+55" |
||||
}, |
||||
{ |
||||
"area": "保加利亚", |
||||
"area_code": "+359" |
||||
}, |
||||
{ |
||||
"area": "贝宁", |
||||
"area_code": "+229" |
||||
}, |
||||
{ |
||||
"area": "比利时", |
||||
"area_code": "+32" |
||||
}, |
||||
{ |
||||
"area": "冰岛", |
||||
"area_code": "+354" |
||||
}, |
||||
{ |
||||
"area": "波多黎各", |
||||
"area_code": "+1809" |
||||
}, |
||||
{ |
||||
"area": "波兰", |
||||
"area_code": "+48" |
||||
}, |
||||
{ |
||||
"area": "玻利维亚", |
||||
"area_code": "+591" |
||||
}, |
||||
{ |
||||
"area": "伯利兹", |
||||
"area_code": "+501" |
||||
}, |
||||
{ |
||||
"area": "博茨瓦纳", |
||||
"area_code": "+267" |
||||
}, |
||||
{ |
||||
"area": "不丹", |
||||
"area_code": "+975" |
||||
}, |
||||
{ |
||||
"area": "布基拉法索", |
||||
"area_code": "+226" |
||||
}, |
||||
{ |
||||
"area": "布隆迪", |
||||
"area_code": "+257" |
||||
} |
||||
], |
||||
"C": [ |
||||
{ |
||||
"area": "朝鲜", |
||||
"area_code": "+850" |
||||
}, |
||||
{ |
||||
"area": "赤道几内亚", |
||||
"area_code": "+240" |
||||
} |
||||
], |
||||
"D": [ |
||||
{ |
||||
"area": "丹麦", |
||||
"area_code": "+45" |
||||
}, |
||||
{ |
||||
"area": "德国", |
||||
"area_code": "+349" |
||||
}, |
||||
{ |
||||
"area": "东萨摩亚", |
||||
"area_code": "+684" |
||||
}, |
||||
{ |
||||
"area": "多哥", |
||||
"area_code": "+228" |
||||
} |
||||
], |
||||
"E": [ |
||||
{ |
||||
"area": "俄罗斯", |
||||
"area_code": "+7" |
||||
}, |
||||
{ |
||||
"area": "厄瓜多尔", |
||||
"area_code": "+593" |
||||
} |
||||
], |
||||
"F": [ |
||||
{ |
||||
"area": "法国", |
||||
"area_code": "+33" |
||||
}, |
||||
{ |
||||
"area": "法罗群岛", |
||||
"area_code": "+298" |
||||
}, |
||||
{ |
||||
"area": "法属圭亚那", |
||||
"area_code": "+594" |
||||
}, |
||||
{ |
||||
"area": "梵蒂冈", |
||||
"area_code": "+396" |
||||
}, |
||||
{ |
||||
"area": "菲律宾", |
||||
"area_code": "+63" |
||||
}, |
||||
{ |
||||
"area": "斐济", |
||||
"area_code": "+679" |
||||
}, |
||||
{ |
||||
"area": "芬兰", |
||||
"area_code": "+358" |
||||
}, |
||||
{ |
||||
"area": "佛得角", |
||||
"area_code": "+238" |
||||
}, |
||||
{ |
||||
"area": "福克兰群岛", |
||||
"area_code": "+500" |
||||
} |
||||
], |
||||
"G": [ |
||||
{ |
||||
"area": "冈比亚", |
||||
"area_code": "+220" |
||||
}, |
||||
{ |
||||
"area": "刚果", |
||||
"area_code": "+242" |
||||
}, |
||||
{ |
||||
"area": "哥伦比亚", |
||||
"area_code": "+57" |
||||
}, |
||||
{ |
||||
"area": "哥斯达黎加", |
||||
"area_code": "+506" |
||||
}, |
||||
{ |
||||
"area": "格陵兰岛", |
||||
"area_code": "+299" |
||||
}, |
||||
{ |
||||
"area": "古巴", |
||||
"area_code": "+53" |
||||
}, |
||||
{ |
||||
"area": "关岛", |
||||
"area_code": "+671" |
||||
}, |
||||
{ |
||||
"area": "圭亚那", |
||||
"area_code": "+592" |
||||
} |
||||
], |
||||
"H": [ |
||||
{ |
||||
"area": "海地", |
||||
"area_code": "+509" |
||||
}, |
||||
{ |
||||
"area": "韩国", |
||||
"area_code": "+82" |
||||
}, |
||||
{ |
||||
"area": "荷兰", |
||||
"area_code": "+31" |
||||
}, |
||||
{ |
||||
"area": "洪都拉斯", |
||||
"area_code": "+504" |
||||
} |
||||
], |
||||
"J": [ |
||||
{ |
||||
"area": "基里巴斯", |
||||
"area_code": "+686" |
||||
}, |
||||
{ |
||||
"area": "吉布提", |
||||
"area_code": "+253" |
||||
}, |
||||
{ |
||||
"area": "几内亚", |
||||
"area_code": "+224" |
||||
}, |
||||
{ |
||||
"area": "几内亚比绍", |
||||
"area_code": "+245" |
||||
}, |
||||
{ |
||||
"area": "加拿大", |
||||
"area_code": "+1" |
||||
}, |
||||
{ |
||||
"area": "加纳", |
||||
"area_code": "+233" |
||||
}, |
||||
{ |
||||
"area": "加蓬", |
||||
"area_code": "+241" |
||||
}, |
||||
{ |
||||
"area": "柬埔寨", |
||||
"area_code": "+855" |
||||
}, |
||||
{ |
||||
"area": "津巴布韦", |
||||
"area_code": "+263" |
||||
} |
||||
], |
||||
"K": [ |
||||
{ |
||||
"area": "喀麦隆", |
||||
"area_code": "+237" |
||||
}, |
||||
{ |
||||
"area": "卡塔尔", |
||||
"area_code": "+974" |
||||
}, |
||||
{ |
||||
"area": "科科斯岛", |
||||
"area_code": "+6722" |
||||
}, |
||||
{ |
||||
"area": "科克群岛", |
||||
"area_code": "+682" |
||||
}, |
||||
{ |
||||
"area": "科摩罗", |
||||
"area_code": "+269" |
||||
}, |
||||
{ |
||||
"area": "科特迪瓦", |
||||
"area_code": "+225" |
||||
}, |
||||
{ |
||||
"area": "科威特", |
||||
"area_code": "+965" |
||||
}, |
||||
{ |
||||
"area": "肯尼亚", |
||||
"area_code": "+254" |
||||
} |
||||
], |
||||
"L": [ |
||||
{ |
||||
"area": "莱索托", |
||||
"area_code": "+266" |
||||
}, |
||||
{ |
||||
"area": "老挝", |
||||
"area_code": "+856" |
||||
}, |
||||
{ |
||||
"area": "黎巴嫩", |
||||
"area_code": "+961" |
||||
}, |
||||
{ |
||||
"area": "利比里亚", |
||||
"area_code": "+231" |
||||
}, |
||||
{ |
||||
"area": "利比亚", |
||||
"area_code": "+218" |
||||
}, |
||||
{ |
||||
"area": "列支敦士登", |
||||
"area_code": "+4175" |
||||
}, |
||||
{ |
||||
"area": "留尼旺岛", |
||||
"area_code": "+262" |
||||
}, |
||||
{ |
||||
"area": "卢森堡", |
||||
"area_code": "+352" |
||||
}, |
||||
{ |
||||
"area": "卢旺达", |
||||
"area_code": "+250" |
||||
}, |
||||
{ |
||||
"area": "罗马尼亚", |
||||
"area_code": "+40" |
||||
} |
||||
], |
||||
"M": [ |
||||
{ |
||||
"area": "马达加斯加", |
||||
"area_code": "+261" |
||||
}, |
||||
{ |
||||
"area": "马尔代夫", |
||||
"area_code": "+960" |
||||
}, |
||||
{ |
||||
"area": "马耳他", |
||||
"area_code": "+356" |
||||
}, |
||||
{ |
||||
"area": "马拉维", |
||||
"area_code": "+265" |
||||
}, |
||||
{ |
||||
"area": "马来西亚", |
||||
"area_code": "+60" |
||||
}, |
||||
{ |
||||
"area": "马里", |
||||
"area_code": "+223" |
||||
}, |
||||
{ |
||||
"area": "马提尼克", |
||||
"area_code": "+596" |
||||
}, |
||||
{ |
||||
"area": "毛里求斯", |
||||
"area_code": "+230" |
||||
}, |
||||
{ |
||||
"area": "毛里塔尼亚", |
||||
"area_code": "+222" |
||||
}, |
||||
{ |
||||
"area": "美国", |
||||
"area_code": "+1" |
||||
}, |
||||
{ |
||||
"area": "蒙古", |
||||
"area_code": "+976" |
||||
}, |
||||
{ |
||||
"area": "孟加拉国", |
||||
"area_code": "+880" |
||||
}, |
||||
{ |
||||
"area": "秘鲁", |
||||
"area_code": "+51" |
||||
}, |
||||
{ |
||||
"area": "缅甸", |
||||
"area_code": "+95" |
||||
}, |
||||
{ |
||||
"area": "摩洛哥", |
||||
"area_code": "+210" |
||||
}, |
||||
{ |
||||
"area": "莫桑比克", |
||||
"area_code": "+258" |
||||
}, |
||||
{ |
||||
"area": "墨西哥", |
||||
"area_code": "+52" |
||||
} |
||||
], |
||||
"N": [ |
||||
{ |
||||
"area": "纳米比亚", |
||||
"area_code": "+264" |
||||
}, |
||||
{ |
||||
"area": "南非", |
||||
"area_code": "+27" |
||||
}, |
||||
{ |
||||
"area": "南斯拉夫", |
||||
"area_code": "+338" |
||||
}, |
||||
{ |
||||
"area": "瑙鲁", |
||||
"area_code": "+674" |
||||
}, |
||||
{ |
||||
"area": "尼加拉瓜", |
||||
"area_code": "+505" |
||||
}, |
||||
{ |
||||
"area": "尼泊尔", |
||||
"area_code": "+977" |
||||
}, |
||||
{ |
||||
"area": "尼日尔", |
||||
"area_code": "+227" |
||||
}, |
||||
{ |
||||
"area": "尼日利亚", |
||||
"area_code": "+234" |
||||
}, |
||||
{ |
||||
"area": "纽埃岛", |
||||
"area_code": "+683" |
||||
}, |
||||
{ |
||||
"area": "挪威", |
||||
"area_code": "+47" |
||||
}, |
||||
{ |
||||
"area": "诺福克岛", |
||||
"area_code": "+6723" |
||||
} |
||||
], |
||||
"P": [ |
||||
{ |
||||
"area": "葡萄牙", |
||||
"area_code": "+351" |
||||
}, |
||||
{ |
||||
"area": "普林西比", |
||||
"area_code": "+239" |
||||
} |
||||
], |
||||
"R": [ |
||||
{ |
||||
"area": "日本", |
||||
"area_code": "+81" |
||||
}, |
||||
{ |
||||
"area": "瑞典", |
||||
"area_code": "+46" |
||||
}, |
||||
{ |
||||
"area": "瑞士", |
||||
"area_code": "+41" |
||||
} |
||||
], |
||||
"S": [ |
||||
{ |
||||
"area": "萨尔瓦多", |
||||
"area_code": "+503" |
||||
}, |
||||
{ |
||||
"area": "塞拉利昂", |
||||
"area_code": "+232" |
||||
}, |
||||
{ |
||||
"area": "塞内加尔", |
||||
"area_code": "+221" |
||||
}, |
||||
{ |
||||
"area": "塞浦路斯", |
||||
"area_code": "+357" |
||||
}, |
||||
{ |
||||
"area": "塞舌尔", |
||||
"area_code": "+248" |
||||
}, |
||||
{ |
||||
"area": "沙特阿拉伯", |
||||
"area_code": "+966" |
||||
}, |
||||
{ |
||||
"area": "圣诞岛", |
||||
"area_code": "+6724" |
||||
}, |
||||
{ |
||||
"area": "圣多美", |
||||
"area_code": "+239" |
||||
}, |
||||
{ |
||||
"area": "圣赫勒拿", |
||||
"area_code": "+290" |
||||
}, |
||||
{ |
||||
"area": "圣卢西亚", |
||||
"area_code": "+1809" |
||||
}, |
||||
{ |
||||
"area": "圣马力诺", |
||||
"area_code": "+223" |
||||
}, |
||||
{ |
||||
"area": "斯里兰卡", |
||||
"area_code": "+94" |
||||
}, |
||||
{ |
||||
"area": "斯威士兰", |
||||
"area_code": "+268" |
||||
}, |
||||
{ |
||||
"area": "苏丹", |
||||
"area_code": "+249" |
||||
}, |
||||
{ |
||||
"area": "苏里南", |
||||
"area_code": "+597" |
||||
}, |
||||
{ |
||||
"area": "所罗门群岛", |
||||
"area_code": "+677" |
||||
}, |
||||
{ |
||||
"area": "索马里", |
||||
"area_code": "+252" |
||||
} |
||||
], |
||||
"T": [ |
||||
{ |
||||
"area": "台湾", |
||||
"area_code": "+886" |
||||
}, |
||||
{ |
||||
"area": "泰国", |
||||
"area_code": "+66" |
||||
}, |
||||
{ |
||||
"area": "坦桑尼亚", |
||||
"area_code": "+255" |
||||
}, |
||||
{ |
||||
"area": "汤加", |
||||
"area_code": "+676" |
||||
}, |
||||
{ |
||||
"area": "突尼斯", |
||||
"area_code": "+216" |
||||
}, |
||||
{ |
||||
"area": "图瓦卢", |
||||
"area_code": "+688" |
||||
}, |
||||
{ |
||||
"area": "土耳其", |
||||
"area_code": "+90" |
||||
} |
||||
], |
||||
"W": [ |
||||
{ |
||||
"area": "瓦努阿图", |
||||
"area_code": "+678" |
||||
}, |
||||
{ |
||||
"area": "危地马拉", |
||||
"area_code": "+502" |
||||
}, |
||||
{ |
||||
"area": "威克岛", |
||||
"area_code": "+1808" |
||||
}, |
||||
{ |
||||
"area": "维尔京群岛", |
||||
"area_code": "+1809" |
||||
}, |
||||
{ |
||||
"area": "委内瑞拉", |
||||
"area_code": "+58" |
||||
}, |
||||
{ |
||||
"area": "文莱", |
||||
"area_code": "+673" |
||||
}, |
||||
{ |
||||
"area": "乌干达", |
||||
"area_code": "+256" |
||||
}, |
||||
{ |
||||
"area": "乌拉圭", |
||||
"area_code": "+598" |
||||
} |
||||
], |
||||
"X": [ |
||||
{ |
||||
"area": "希腊", |
||||
"area_code": "+30" |
||||
}, |
||||
{ |
||||
"area": "西班牙", |
||||
"area_code": "+34" |
||||
}, |
||||
{ |
||||
"area": "西萨摩亚", |
||||
"area_code": "+685" |
||||
}, |
||||
{ |
||||
"area": "夏威夷", |
||||
"area_code": "+1808" |
||||
}, |
||||
{ |
||||
"area": "香港", |
||||
"area_code": "+852" |
||||
}, |
||||
{ |
||||
"area": "新加坡", |
||||
"area_code": "+65" |
||||
}, |
||||
{ |
||||
"area": "新西兰", |
||||
"area_code": "+64" |
||||
}, |
||||
{ |
||||
"area": "匈牙利", |
||||
"area_code": "+336" |
||||
}, |
||||
{ |
||||
"area": "叙利亚", |
||||
"area_code": "+963" |
||||
} |
||||
], |
||||
"Y": [ |
||||
{ |
||||
"area": "牙买加", |
||||
"area_code": "+1809" |
||||
}, |
||||
{ |
||||
"area": "伊拉克", |
||||
"area_code": "+964" |
||||
}, |
||||
{ |
||||
"area": "伊朗", |
||||
"area_code": "+98" |
||||
}, |
||||
{ |
||||
"area": "以色列", |
||||
"area_code": "+972" |
||||
}, |
||||
{ |
||||
"area": "意大利", |
||||
"area_code": "+39" |
||||
}, |
||||
{ |
||||
"area": "印度", |
||||
"area_code": "+91" |
||||
}, |
||||
{ |
||||
"area": "印度尼西亚", |
||||
"area_code": "+62" |
||||
}, |
||||
{ |
||||
"area": "英国", |
||||
"area_code": "+44" |
||||
}, |
||||
{ |
||||
"area": "约旦", |
||||
"area_code": "+962" |
||||
}, |
||||
{ |
||||
"area": "越南", |
||||
"area_code": "+84" |
||||
} |
||||
], |
||||
"Z": [ |
||||
{ |
||||
"area": "赞比亚", |
||||
"area_code": "+260" |
||||
}, |
||||
{ |
||||
"area": "扎伊尔", |
||||
"area_code": "+243" |
||||
}, |
||||
{ |
||||
"area": "乍得", |
||||
"area_code": "+235" |
||||
}, |
||||
{ |
||||
"area": "直布罗陀", |
||||
"area_code": "+350" |
||||
}, |
||||
{ |
||||
"area": "智利", |
||||
"area_code": "+56" |
||||
}, |
||||
{ |
||||
"area": "中非", |
||||
"area_code": "+236" |
||||
}, |
||||
{ |
||||
"area": "中国", |
||||
"area_code": "+86" |
||||
}, |
||||
{ |
||||
"area": "中途岛", |
||||
"area_code": "+1808" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,158 @@
|
||||
import 'dart:convert'; |
||||
|
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter/services.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:huixiang/view_widget/classic_header.dart'; |
||||
import 'package:huixiang/view_widget/my_footer.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
|
||||
class PhoneAddressPage extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _PhoneAddressPage(); |
||||
} |
||||
} |
||||
|
||||
class _PhoneAddressPage extends State<PhoneAddressPage> { |
||||
RefreshController refreshController = RefreshController(); |
||||
Map<String, dynamic> areaMap; |
||||
List<String> areaList = []; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
areaCode(); |
||||
} |
||||
|
||||
void areaCode() async { |
||||
var value = |
||||
await rootBundle.loadString('assets/map_style/area_code_full.json'); |
||||
areaMap = jsonDecode(value); |
||||
areaMap.forEach((key, value) { |
||||
areaList.add(key); |
||||
}); |
||||
setState(() {}); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Scaffold( |
||||
appBar: AppBar( |
||||
backgroundColor: Color(0xFFF0F0F0), |
||||
leading: GestureDetector( |
||||
child: Icon( |
||||
Icons.arrow_back_ios, |
||||
color: Colors.black, |
||||
), |
||||
onTap: () { |
||||
Navigator.of(context).pop(); |
||||
}), |
||||
title: Text( |
||||
"选择手机号归属地", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 17.sp, |
||||
color: Color(0xFF0D0D0D), |
||||
), |
||||
), |
||||
centerTitle: true, |
||||
elevation: 0.0, |
||||
), |
||||
body: Container( |
||||
color: Color(0xFFF0F0F0), |
||||
child: sortList(), |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget sortList() { |
||||
return ListView.builder( |
||||
padding: EdgeInsets.zero, |
||||
itemCount: areaList.length, |
||||
scrollDirection: Axis.vertical, |
||||
shrinkWrap: true, |
||||
physics: BouncingScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
onTap: () {}, |
||||
child: sortItem(position), |
||||
); |
||||
}, |
||||
); |
||||
} |
||||
|
||||
Widget sortItem(int position) { |
||||
return Column( |
||||
children: [ |
||||
Container( |
||||
width: double.infinity, |
||||
color: Colors.white, |
||||
padding: EdgeInsets.only(top: 2.h, bottom: 2.h, left: 16.w), |
||||
margin: EdgeInsets.only(bottom: 12.h), |
||||
child: Text( |
||||
areaList[position], |
||||
style: TextStyle( |
||||
color: Color(0xFF000000), |
||||
fontWeight: MyFontWeight.medium, |
||||
fontSize: 16.sp, |
||||
), |
||||
), |
||||
), |
||||
Column( |
||||
children: (areaMap[areaList[position]] as List).map((e) { |
||||
return globalRoamingItem(e); |
||||
}).toList(), |
||||
) |
||||
], |
||||
); |
||||
} |
||||
|
||||
Widget globalRoamingItem(data) { |
||||
return GestureDetector( |
||||
child: Container( |
||||
margin: EdgeInsets.only(left: 16.w, right: 22.w), |
||||
child: Column( |
||||
children: [ |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Expanded( |
||||
child: Text( |
||||
data["area"], |
||||
style: TextStyle( |
||||
color: Color(0xFF000000), |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 14.sp, |
||||
), |
||||
), |
||||
), |
||||
Text( |
||||
data["area_code"], |
||||
style: TextStyle( |
||||
color: Color(0xFFA29E9E), |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 12.sp, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Container( |
||||
margin: EdgeInsets.symmetric(vertical: 12.h), |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFDCDCDC), |
||||
) |
||||
], |
||||
), |
||||
), |
||||
onTap: () { |
||||
Navigator.of(context).pop(data["area_code"]); |
||||
}, |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,156 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/data/user_info.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/utils/flutter_utils.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:huixiang/view_widget/pay_selected_dialog.dart'; |
||||
import 'package:pin_input_text_field/pin_input_text_field.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
|
||||
class PlatformPayCode extends StatefulWidget { |
||||
final Map<String, dynamic> arguments; |
||||
PlatformPayCode({this.arguments}); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _PlatformPayCode(); |
||||
} |
||||
} |
||||
|
||||
class _PlatformPayCode extends State<PlatformPayCode> { |
||||
String inputCode = ""; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return GestureDetector( |
||||
behavior: HitTestBehavior.translucent, |
||||
onTap: () { |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
}, |
||||
child: Scaffold( |
||||
appBar: AppBar( |
||||
backgroundColor: Colors.white, |
||||
leading: GestureDetector( |
||||
child: Icon( |
||||
Icons.arrow_back_ios, |
||||
color: Colors.black, |
||||
), |
||||
onTap: () { |
||||
Navigator.of(context).pop(); |
||||
}), |
||||
title: Text( |
||||
S.of(context).pingtaizhifumima, |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 17.sp, |
||||
color: Color(0xFF0D0D0D), |
||||
), |
||||
), |
||||
centerTitle: true, |
||||
elevation: 0.0, |
||||
), |
||||
body: Column( |
||||
children: [ |
||||
settingCode(), |
||||
], |
||||
), |
||||
)); |
||||
} |
||||
|
||||
///设置密码 |
||||
Widget settingCode(){ |
||||
return Container( |
||||
alignment: Alignment.center, |
||||
margin: EdgeInsets.only(top: 28.h), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
"请输入6位数字密码", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
fontSize: 18.sp, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 12.h, |
||||
), |
||||
Text( |
||||
"将用于一心回乡APP下单时平台余额消费", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.medium, |
||||
fontSize: 14.sp, |
||||
color: Color(0xFFA29E9E), |
||||
), |
||||
), |
||||
Container( |
||||
margin: EdgeInsets.only(top: 24.h, bottom: 31.h), |
||||
padding: EdgeInsets.only(left: 48.w, right: 48.w), |
||||
height: 45.h, |
||||
child: PinInputTextField( |
||||
onChanged: (txtCode){ |
||||
print(txtCode); |
||||
setState(() { |
||||
inputCode = txtCode; |
||||
}); |
||||
}, |
||||
decoration: BoxLooseDecoration( |
||||
strokeColorBuilder: FixedColorBuilder(Color(0xFFEBEAEA)), |
||||
textStyle: TextStyle( |
||||
fontWeight: MyFontWeight.medium, |
||||
fontSize: 18.sp, |
||||
color: Color(0xFF353535), |
||||
), |
||||
radius: Radius.circular(4.r)), |
||||
), |
||||
), |
||||
GestureDetector( |
||||
onTap: (){ |
||||
setState(() { |
||||
if(inputCode.length == 6){ |
||||
Navigator.of(context).popAndPushNamed('/router/platform_pay_code_success',arguments:{ |
||||
"inputCode":inputCode, |
||||
"inputText":widget.arguments["inputText"] |
||||
}); |
||||
}else{ |
||||
SmartDialog.showToast("请输入6位数字密码", alignment: Alignment.center); |
||||
} |
||||
}); |
||||
}, |
||||
child: Container( |
||||
width: 163.w, |
||||
height: 46.h, |
||||
alignment: Alignment.center, |
||||
decoration: BoxDecoration( |
||||
color: inputCode.length == 6 ? Color(0xFF32A060):Color(0xFFBBE7CC), |
||||
borderRadius: BorderRadius.circular(23.r), |
||||
), |
||||
child: Text( |
||||
"下一步", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
fontSize: 18.sp, |
||||
color: Color(0xFFFFFFFF), |
||||
), |
||||
), |
||||
), |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,255 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/data/user_info.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/utils/flutter_utils.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:huixiang/view_widget/pay_selected_dialog.dart'; |
||||
import 'package:pin_input_text_field/pin_input_text_field.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
|
||||
class PlatformPayCodeSuccess extends StatefulWidget { |
||||
final Map<String, dynamic> arguments; |
||||
PlatformPayCodeSuccess({this.arguments}); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _PlatformPayCodeSuccess(); |
||||
} |
||||
} |
||||
|
||||
class _PlatformPayCodeSuccess extends State<PlatformPayCodeSuccess> { |
||||
ApiService apiService; |
||||
int codeType = 0; |
||||
UserInfo userInfo; |
||||
String againInputCode = ""; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
} |
||||
|
||||
///修改支付密码 |
||||
modifyPayCode(String payCode,String code) async { |
||||
if (apiService == null) { |
||||
SharedPreferences value = await SharedPreferences.getInstance(); |
||||
apiService = ApiService(Dio(), |
||||
context: context, token: value.getString("token"), showLoading: false); |
||||
} |
||||
BaseData baseData = await apiService.updatePayPwd({ |
||||
"newPayPwd": payCode, |
||||
"smsCode": code, |
||||
}).catchError((error) {}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
setState(() { |
||||
codeType=4; |
||||
}); |
||||
SmartDialog.showToast(baseData.data ?? false, alignment: Alignment.center); |
||||
} else { |
||||
setState(() { |
||||
codeType = 5; |
||||
}); |
||||
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return GestureDetector( |
||||
behavior: HitTestBehavior.translucent, |
||||
onTap: () { |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
}, |
||||
child: Scaffold( |
||||
appBar: AppBar( |
||||
backgroundColor: Colors.white, |
||||
leading: GestureDetector( |
||||
child: Icon( |
||||
Icons.arrow_back_ios, |
||||
color: Colors.black, |
||||
), |
||||
onTap: () { |
||||
Navigator.of(context).pop(); |
||||
}), |
||||
title: Text( |
||||
S.of(context).pingtaizhifumima, |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 17.sp, |
||||
color: Color(0xFF0D0D0D), |
||||
), |
||||
), |
||||
centerTitle: true, |
||||
elevation: 0.0, |
||||
), |
||||
body: Column( |
||||
children: [ |
||||
if(codeType!=4 && codeType != 5) |
||||
againSettingCode(), |
||||
if(codeType == 4 || codeType == 5) |
||||
codeSuccess(), |
||||
], |
||||
), |
||||
)); |
||||
} |
||||
|
||||
///再次输入密码 |
||||
Widget againSettingCode() { |
||||
return Container( |
||||
alignment: Alignment.center, |
||||
margin: EdgeInsets.only(top: 28.h), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
"请再次输入6位数字密码", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
fontSize: 18.sp, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 12.h, |
||||
), |
||||
Text( |
||||
"将用于一心回乡APP下单时平台余额消费", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.medium, |
||||
fontSize: 14.sp, |
||||
color: Color(0xFFA29E9E), |
||||
), |
||||
), |
||||
Container( |
||||
margin: EdgeInsets.only(top: 24.h, bottom: 31.h), |
||||
padding: EdgeInsets.only(left: 48.w, right: 48.w), |
||||
height: 45.h, |
||||
child: PinInputTextField( |
||||
onChanged: (txtCode){ |
||||
print(txtCode); |
||||
setState(() { |
||||
againInputCode = txtCode; |
||||
}); |
||||
}, |
||||
decoration: BoxLooseDecoration( |
||||
strokeColorBuilder: FixedColorBuilder(Color(0xFFEBEAEA)), |
||||
textStyle: TextStyle( |
||||
fontWeight: MyFontWeight.medium, |
||||
fontSize: 18.sp, |
||||
color: Color(0xFF353535), |
||||
), |
||||
radius: Radius.circular(4.r)), |
||||
), |
||||
), |
||||
GestureDetector( |
||||
onTap: (){ |
||||
setState(() { |
||||
if(againInputCode.length == 6 && (widget.arguments["inputCode"] == againInputCode)){ |
||||
modifyPayCode(againInputCode,widget.arguments["inputText"]); |
||||
}else{ |
||||
if(widget.arguments["inputCode"] != againInputCode){ |
||||
SmartDialog.showToast("请输入与上次一致的6位数字密码", alignment: Alignment.center); |
||||
}else{ |
||||
SmartDialog.showToast("请再次输入6位数字密码", alignment: Alignment.center); |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
child: Container( |
||||
width: 163.w, |
||||
height: 46.h, |
||||
alignment: Alignment.center, |
||||
decoration: BoxDecoration( |
||||
color: againInputCode.length == 6 ? Color(0xFF32A060):Color(0xFFBBE7CC), |
||||
borderRadius: BorderRadius.circular(23.r), |
||||
), |
||||
child: Text( |
||||
"确认", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
fontSize: 18.sp, |
||||
color: Color(0xFFFFFFFF), |
||||
), |
||||
), |
||||
), |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
///设置密码成功状态 |
||||
Widget codeSuccess() { |
||||
return Container( |
||||
alignment: Alignment.center, |
||||
margin: EdgeInsets.only(top: 31.h), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
codeType == 5 ? "assets/image/lose.webp":"assets/image/icon_order_success.webp", |
||||
fit: BoxFit.cover, |
||||
width: 76, |
||||
height: 76, |
||||
), |
||||
SizedBox( |
||||
height: 16.h, |
||||
), |
||||
Text( |
||||
codeType == 5 ? "设置密码失败":"设置密码成功", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
fontSize: 21.sp, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 69.h, |
||||
), |
||||
GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pop(); |
||||
}, |
||||
child: Container( |
||||
width: double.infinity, |
||||
height: 46.h, |
||||
alignment: Alignment.center, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF32A060), |
||||
borderRadius: BorderRadius.circular(4.r), |
||||
), |
||||
margin: EdgeInsets.symmetric(horizontal: 16.w), |
||||
child: Text( |
||||
S.of(context).queren, |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
fontSize: 18.sp, |
||||
color: Color(0xFFFFFFFF), |
||||
), |
||||
), |
||||
), |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
///平台支付密码弹窗 |
||||
assessShowBottomSheet() { |
||||
showModalBottomSheet( |
||||
context: context, |
||||
backgroundColor: Colors.transparent, |
||||
isScrollControlled: true, |
||||
builder: (context) { |
||||
return PaySelectedDialog(); |
||||
}, |
||||
); |
||||
} |
||||
} |
Loading…
Reference in new issue