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