Daisy 76ceab6f34 1,星锁主界面UI更新
2,锁列表UI更新
3,侧边栏 个人信息模块UI更新
4,添加锁模块UI更新
5,我的-设置模块UI更新
6,新增“添加授权管理员”页面UI布局
2023-07-27 15:26:30 +08:00

144 lines
5.1 KiB
Dart

import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/commonItem.dart';
import '../../../../tools/showBottomSheetTool.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
class AutomaticBlockingPage extends StatefulWidget {
const AutomaticBlockingPage({Key? key}) : super(key: key);
@override
State<AutomaticBlockingPage> createState() => _AutomaticBlockingPageState();
}
class _AutomaticBlockingPageState extends State<AutomaticBlockingPage> {
final TextEditingController _timeController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.automaticBlocking!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: ListView(
children: [
CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: "",
isHaveLine: false,
isHaveRightWidget: true,
rightWidget:
Container(width: 80.w, height: 50.h, child: _switch())),
Container(
height: 10.h,
),
Builder(builder: (context) {
return CommonItem(
leftTitel: TranslationLoader.lanKeys!.delayTime!.tr,
rightTitle: "5s",
isHaveLine: false,
isHaveDirection: true,
action: () {
var list = [
"5S",
"10S",
"15S",
"30S",
"60S",
TranslationLoader.lanKeys!.custom!.tr
];
ShowBottomSheetTool().showSingleRowPicker(
//上下文
context,
//默认的索引
normalIndex: 2,
title: TranslationLoader.lanKeys!.time!.tr,
cancelTitle: TranslationLoader.lanKeys!.cancel!.tr,
sureTitle: TranslationLoader.lanKeys!.sure!.tr,
//要显示的列表
//可自定义数据适配器
//adapter: PickerAdapter(),
data: list,
//选择事件的回调
clickCallBack: (int index, var str) {});
});
}),
Container(
height: 10.h,
),
Visibility(
visible: true,
child: Container(
color: Colors.white,
padding: EdgeInsets.all(30.w),
child: Column(
children: [
Row(
children: [
Text(
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.time!.tr}(S)"),
],
),
TextField(
//输入框一行
maxLines: 1,
controller: _timeController,
autofocus: false,
decoration: InputDecoration(
//输入里面输入文字内边距设置
contentPadding:
const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText:
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.time!.tr}(S)",
hintStyle: TextStyle(fontSize: 30.sp),
//不需要输入框下划线
border: InputBorder.none,
),
),
Container(
height: 0.5.h,
color: Colors.grey,
),
],
),
)),
Container(
padding: EdgeInsets.all(30.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: Text(
TranslationLoader.lanKeys!.automaticBlockingTip!.tr)),
],
),
)
],
));
}
CupertinoSwitch _switch() {
bool _isOn = false;
return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: _isOn,
onChanged: (value) {
setState(() {
_isOn = value;
});
},
);
}
}