171 lines
5.1 KiB
Dart
171 lines
5.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:star_lock/main/lockDetail/lockSet/lockUser/lockUser_logic.dart';
|
|
import '../../../../app_settings/app_colors.dart';
|
|
import '../../../../tools/submitBtn.dart';
|
|
import '../../../../tools/titleAppBar.dart';
|
|
import '../../../../translations/trans_lib.dart';
|
|
|
|
class LockUserPage extends StatefulWidget {
|
|
const LockUserPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<LockUserPage> createState() => _LockUserPageState();
|
|
}
|
|
|
|
class _LockUserPageState extends State<LockUserPage> {
|
|
final logic = Get.put(LockUserLogic());
|
|
final state = Get.find<LockUserLogic>().state;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
|
appBar: TitleAppBar(
|
|
barTitle: '锁用户',
|
|
haveBack: true,
|
|
backgroundColor: AppColors.mainColor,
|
|
),
|
|
body: Column(
|
|
children: [
|
|
_searchWidget(),
|
|
SizedBox(
|
|
height: 20.h,
|
|
),
|
|
Expanded(child: _buildMainUI()),
|
|
SubmitBtn(
|
|
btnName: '确定',
|
|
onClick: () {},
|
|
),
|
|
SizedBox(
|
|
height: 64.h,
|
|
)
|
|
],
|
|
));
|
|
}
|
|
|
|
Widget _searchWidget() {
|
|
return Container(
|
|
height: 60.h,
|
|
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white, borderRadius: BorderRadius.circular(5)),
|
|
child: TextField(
|
|
//输入框一行
|
|
maxLines: 1,
|
|
// controller: _controller,
|
|
autofocus: false,
|
|
controller: state.searchController,
|
|
onSubmitted: (value) {},
|
|
decoration: InputDecoration(
|
|
//输入里面输入文字内边距设置
|
|
contentPadding: const EdgeInsets.only(
|
|
top: 12.0, left: -19.0, right: -15.0, bottom: 8.0),
|
|
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
|
hintStyle: TextStyle(fontSize: 22.sp, height: 3.0),
|
|
//不需要输入框下划线
|
|
border: InputBorder.none,
|
|
//左边图标设置
|
|
icon: Padding(
|
|
padding: EdgeInsets.only(
|
|
top: 20.h, bottom: 20.h, right: 20.w, left: 10.w),
|
|
child: Image.asset(
|
|
'images/main/icon_main_search.png',
|
|
width: 40.w,
|
|
height: 40.w,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildMainUI() {
|
|
return ListView.separated(
|
|
shrinkWrap: true,
|
|
itemCount: 3,
|
|
itemBuilder: (c, index) {
|
|
return _electronicKeyItem('images/controls_user.png', '我', '永久', () {
|
|
state.isCheck.value = !state.isCheck.value;
|
|
});
|
|
},
|
|
separatorBuilder: (BuildContext context, int index) {
|
|
return const Divider(
|
|
height: 1,
|
|
color: AppColors.greyLineColor,
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
Widget _electronicKeyItem(
|
|
String avatarURL, String receiveUser, String useDate, Function() action) {
|
|
return GestureDetector(
|
|
onTap: action,
|
|
child: Container(
|
|
color: Colors.white,
|
|
height: 90.h,
|
|
child: Row(
|
|
children: [
|
|
SizedBox(
|
|
width: 30.w,
|
|
),
|
|
Image.asset(
|
|
avatarURL,
|
|
width: 60.w,
|
|
height: 60.w,
|
|
),
|
|
SizedBox(
|
|
width: 20.w,
|
|
),
|
|
Expanded(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Row(
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
receiveUser,
|
|
style: TextStyle(
|
|
fontSize: 24.sp, color: AppColors.blackColor),
|
|
),
|
|
SizedBox(width: 10.w),
|
|
Expanded(
|
|
child: SizedBox(
|
|
width: 20.w,
|
|
)),
|
|
],
|
|
),
|
|
SizedBox(height: 10.h),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
useDate,
|
|
style: TextStyle(
|
|
fontSize: 18.sp,
|
|
color: AppColors.placeholderTextColor),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(width: 20.h),
|
|
],
|
|
),
|
|
),
|
|
Obx(() => Image.asset(
|
|
state.isCheck.value == true
|
|
? 'images/icon_round_select.png'
|
|
: 'images/icon_round_unSelect.png',
|
|
width: 30.w,
|
|
height: 30.w,
|
|
)),
|
|
SizedBox(width: 20.h),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|