87 lines
3.1 KiB
Dart
Executable File
87 lines
3.1 KiB
Dart
Executable File
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
|
|
|
|
import '../../../../../app_settings/app_colors.dart';
|
|
import '../../../../../tools/commonItem.dart';
|
|
import '../../../../../tools/noData.dart';
|
|
import '../../../../../tools/showTipView.dart';
|
|
import '../../../../../tools/submitBtn.dart';
|
|
import '../../../../../tools/titleAppBar.dart';
|
|
import '../../../../../translations/trans_lib.dart';
|
|
import 'lockSelectGrouping_logic.dart';
|
|
|
|
class LockSelectGroupingPage extends StatefulWidget {
|
|
const LockSelectGroupingPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<LockSelectGroupingPage> createState() => _LockSelectGroupingPageState();
|
|
}
|
|
|
|
class _LockSelectGroupingPageState extends State<LockSelectGroupingPage> {
|
|
final logic = Get.put(LockSelectGroupingLogic());
|
|
final state = Get.find<LockSelectGroupingLogic>().state;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
|
appBar: TitleAppBar(
|
|
barTitle: TranslationLoader.lanKeys!.selectGroup!.tr,
|
|
haveBack: true,
|
|
backgroundColor: AppColors.mainColor),
|
|
body: Column(
|
|
children: [
|
|
Expanded(child: _buildMainUI()),
|
|
SubmitBtn(
|
|
btnName: TranslationLoader.lanKeys!.createNewGroup!.tr,
|
|
borderRadius: 20.w,
|
|
margin: EdgeInsets.only(
|
|
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
|
onClick: () {
|
|
// showCupertinoAlertDialog(context);
|
|
ShowTipView().showTFViewAlertDialog(state.changeNameController, TranslationLoader.lanKeys!.createNewGroup!.tr, "请输入分组名称".tr, (){
|
|
logic.addLockGroupRequest();
|
|
Get.back();
|
|
});
|
|
}),
|
|
SizedBox(
|
|
height: 40.h,
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildMainUI() {
|
|
return Obx(() => state.groupList.value.isNotEmpty ? ListView.builder(
|
|
itemCount: state.groupList.value.length,
|
|
itemBuilder: (c, index) {
|
|
GroupListItem itemData = state.groupList.value[index];
|
|
return CommonItem(
|
|
leftTitel: itemData.keyGroupName,
|
|
rightTitle: "",
|
|
allHeight: 70.h,
|
|
isHaveLine: true,
|
|
isHaveDirection: false,
|
|
isHaveRightWidget: true,
|
|
rightWidget: state.lockBasicInfo.value.groupId == itemData.keyGroupId
|
|
? Image(
|
|
image: const AssetImage("images/icon_item_checked.png"),
|
|
width: 30.w,
|
|
height: 30.w,
|
|
fit: BoxFit.contain,
|
|
)
|
|
: Container(),
|
|
action: () {
|
|
logic.setLockGroupRequest(itemData);
|
|
});
|
|
}) : NoData());
|
|
}
|
|
|
|
}
|