132 lines
3.8 KiB
Dart
Executable File
132 lines
3.8 KiB
Dart
Executable File
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:star_lock/main/lockDetail/lockSet/lockTime/lockTime_state.dart';
|
|
|
|
import '../../../../app_settings/app_colors.dart';
|
|
import '../../../../tools/appRouteObserver.dart';
|
|
import '../../../../tools/submitBtn.dart';
|
|
import '../../../../tools/titleAppBar.dart';
|
|
import 'lockTime_logic.dart';
|
|
|
|
class LockTimePage extends StatefulWidget {
|
|
const LockTimePage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<LockTimePage> createState() => _LockTimePageState();
|
|
}
|
|
|
|
class _LockTimePageState extends State<LockTimePage> with RouteAware{
|
|
final LockTimeLogic logic = Get.put(LockTimeLogic());
|
|
final LockTimeState state = Get.find<LockTimeLogic>().state;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: Colors.white,
|
|
appBar: TitleAppBar(
|
|
barTitle: '锁时间'.tr,
|
|
haveBack: true,
|
|
backgroundColor: AppColors.mainColor),
|
|
body: Container(
|
|
padding: EdgeInsets.all(30.w),
|
|
child: Column(
|
|
children: <Widget>[
|
|
SizedBox(
|
|
height: 50.h,
|
|
),
|
|
Obx(() => Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: <Widget>[
|
|
Text(state.dateTime.value,
|
|
style: TextStyle(
|
|
fontSize: 26.sp, color: AppColors.blackColor)),
|
|
],
|
|
),),
|
|
SizedBox(
|
|
height: 60.h,
|
|
),
|
|
SubmitBtn(
|
|
btnName: '校准时间'.tr,
|
|
borderRadius: 20.w,
|
|
fontSize: 32.sp,
|
|
// margin: EdgeInsets.only(left: 03.w, right: 30.w, top: 20.w),
|
|
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
|
onClick: () {
|
|
// logic.sendTiming();
|
|
logic.getServerDatetime(true);
|
|
// logic.sendTiming();
|
|
}),
|
|
SizedBox(
|
|
height: 40.h,
|
|
),
|
|
// GestureDetector(
|
|
// onTap: () {},
|
|
// child: Container(
|
|
// child: Text(TranslationLoader.lanKeys!.setTheDSTMode!.tr,
|
|
// style: TextStyle(
|
|
// fontSize: 24.sp, color: AppColors.mainColor))),
|
|
// ),
|
|
],
|
|
),
|
|
)
|
|
);
|
|
}
|
|
|
|
@override
|
|
void didChangeDependencies() {
|
|
super.didChangeDependencies();
|
|
|
|
/// 路由订阅
|
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
/// 取消路由订阅
|
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
|
super.dispose();
|
|
}
|
|
|
|
/// 从上级界面进入 当前界面即将出现
|
|
@override
|
|
void didPush() {
|
|
super.didPush();
|
|
state.ifCurrentScreen.value = true;
|
|
}
|
|
|
|
/// 返回上一个界面 当前界面即将消失
|
|
@override
|
|
void didPop() {
|
|
super.didPop();
|
|
logic.cancelBlueConnetctToastTimer();
|
|
if (EasyLoading.isShow) {
|
|
EasyLoading.dismiss(animation: true);
|
|
}
|
|
state.ifCurrentScreen.value = false;
|
|
state.sureBtnState.value = 0;
|
|
}
|
|
|
|
/// 从下级返回 当前界面即将出现
|
|
@override
|
|
void didPopNext() {
|
|
super.didPopNext();
|
|
state.ifCurrentScreen.value = true;
|
|
}
|
|
|
|
/// 进入下级界面 当前界面即将消失
|
|
@override
|
|
void didPushNext() {
|
|
super.didPushNext();
|
|
logic.cancelBlueConnetctToastTimer();
|
|
if (EasyLoading.isShow) {
|
|
EasyLoading.dismiss(animation: true);
|
|
}
|
|
state.ifCurrentScreen.value = false;
|
|
state.sureBtnState.value = 0;
|
|
}
|
|
|
|
}
|