修改选择国家地区问题
This commit is contained in:
parent
076cb07081
commit
74d9771ae8
@ -43,6 +43,8 @@
|
||||
|
||||
# 下面是安卓发布编译命令
|
||||
# flutter build apk --split-per-abi --release --flavor sky -t lib/main_sky.dart
|
||||
# flutter build apk --release --flavor sky -t lib/main_sky.dart
|
||||
|
||||
# IOS编译发布
|
||||
# TODO 待补充
|
||||
|
||||
|
||||
@ -43,7 +43,8 @@ class Utils {
|
||||
BuildContext context, CountryRegionModel model, Function() onClick,
|
||||
{double susHeight = 40}) {
|
||||
return GestureDetector(
|
||||
child: SizedBox(
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
height: 80.h,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@ -60,13 +61,13 @@ class Utils {
|
||||
child: SizedBox(
|
||||
width: 30.w,
|
||||
)),
|
||||
Text(
|
||||
'+${model.code}',
|
||||
style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp),
|
||||
),
|
||||
SizedBox(
|
||||
width: 60.w,
|
||||
)
|
||||
// Text(
|
||||
// '+${model.code}',
|
||||
// style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 60.w,
|
||||
// )
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@ -22,14 +22,14 @@ class SelectCountryRegionPage extends StatefulWidget {
|
||||
|
||||
class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
|
||||
List<CountryRegionModel> countriesList = [];
|
||||
List<CountryRegionModel> topCountriesList = [];
|
||||
TextEditingController searchController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
SuspensionUtil.setShowSuspensionStatus(
|
||||
countriesList.cast<ISuspensionBean>());
|
||||
SuspensionUtil.setShowSuspensionStatus(countriesList.cast<ISuspensionBean>());
|
||||
Future.delayed(const Duration(milliseconds: 20), () {
|
||||
getCountriesListRequest();
|
||||
});
|
||||
@ -41,6 +41,12 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
|
||||
countriesList.clear();
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
countriesList.addAll(entity.dataList!);
|
||||
for(CountryRegionModel model in countriesList){
|
||||
if(model.name! == "中国"){
|
||||
topCountriesList.add(model);
|
||||
break;
|
||||
}
|
||||
}
|
||||
_handleList(countriesList);
|
||||
}
|
||||
}
|
||||
@ -87,19 +93,40 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
|
||||
editingController: searchController,
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
onSubmittedAction: () {
|
||||
var searchList = <CountryRegionModel>[];
|
||||
for (int i = 0, length = countriesList.length; i < length; i++) {
|
||||
CountryRegionModel countryModel = countriesList[i];
|
||||
if(countryModel.name!.contains(searchController.text) || countryModel.code!.contains(searchController.text)){
|
||||
searchList.add(countryModel);
|
||||
Get.log('countryModel.name:${countryModel.name} countryModel.code:${countryModel.code}');
|
||||
if(searchController.text.isEmpty){
|
||||
getCountriesListRequest();
|
||||
}else{
|
||||
var searchList = <CountryRegionModel>[];
|
||||
for (int i = 0, length = countriesList.length; i < length; i++) {
|
||||
CountryRegionModel countryModel = countriesList[i];
|
||||
if(countryModel.name!.contains(searchController.text) || countryModel.code!.contains(searchController.text)){
|
||||
searchList.add(countryModel);
|
||||
Get.log('countryModel.name:${countryModel.name} countryModel.code:${countryModel.code}');
|
||||
}
|
||||
}
|
||||
countriesList= searchList;
|
||||
Get.log('searchList.length:${searchList.length}');
|
||||
_handleList(searchList);
|
||||
}
|
||||
Get.log('searchList.length:${searchList.length}');
|
||||
_handleList(searchList);
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
SizedBox(height:20.h),
|
||||
Visibility(
|
||||
visible: searchController.text.isEmpty,
|
||||
child: Utils.getSusItem(context, '★')
|
||||
),
|
||||
countriesList.isNotEmpty ? Visibility(
|
||||
visible: searchController.text.isEmpty,
|
||||
child: Utils.getListItem(context, topCountriesList[0], () {
|
||||
CountryRegionModel model = topCountriesList[0];
|
||||
Map<String, dynamic> resultMap = {};
|
||||
resultMap['code'] = model.code ?? '';
|
||||
resultMap['countryId'] = model.countryId.toString() ?? '';
|
||||
resultMap['countryName'] = model.name ?? '' ;
|
||||
Navigator.pop(context, resultMap);
|
||||
})
|
||||
): Container(),
|
||||
Expanded(
|
||||
child: AzListView(
|
||||
data: countriesList,
|
||||
@ -111,6 +138,7 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
|
||||
resultMap['code'] = model.code;
|
||||
resultMap['countryId'] = model.countryId.toString();
|
||||
resultMap['countryName'] = model.name;
|
||||
print("model.name:${model.name} model.code:${model.code} model.countryId:${model.countryId} model.flag:${model.flag} model.group:${model.group} model.tagIndex:${model.tagIndex}");
|
||||
Navigator.pop(context, resultMap);
|
||||
});
|
||||
},
|
||||
|
||||
@ -48,18 +48,20 @@ class _TransferSmartLockPageState extends State<TransferSmartLockPage> {
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
for (var element in state.transferSmartLockListData.value) {
|
||||
if(state.isSelectAll == true){
|
||||
if(state.isSelectAll == true){
|
||||
for (var element in state.transferSmartLockListData.value) {
|
||||
state.isSelectAll = false;
|
||||
element.select = 0;
|
||||
}else{
|
||||
}
|
||||
}else{
|
||||
for (var element in state.transferSmartLockListData.value) {
|
||||
state.isSelectAll = true;
|
||||
element.select = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Text(state.isSelectAll == true ? TranslationLoader.lanKeys!.checkAll!.tr : TranslationLoader.lanKeys!.cancel!.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp)))
|
||||
child: Text(state.isSelectAll == true ? TranslationLoader.lanKeys!.cancel!.tr : TranslationLoader.lanKeys!.checkAll!.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp)))
|
||||
],
|
||||
),
|
||||
body: EasyRefreshTool(
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
@ -9,7 +10,6 @@ import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../network/api_repository.dart';
|
||||
import '../tools/storage.dart';
|
||||
import '../translations/trans_lib.dart';
|
||||
import 'versionUndate_entity.dart';
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user