167 lines
6.7 KiB
Dart
167 lines
6.7 KiB
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/submitBtn.dart';
|
||
import '../../../../tools/titleAppBar.dart';
|
||
import '../../../../translations/trans_lib.dart';
|
||
import 'lockEscalation_logic.dart';
|
||
|
||
class LockEscalationPage extends StatefulWidget {
|
||
const LockEscalationPage({Key? key}) : super(key: key);
|
||
|
||
@override
|
||
State<LockEscalationPage> createState() => _LockEscalationPageState();
|
||
}
|
||
|
||
class _LockEscalationPageState extends State<LockEscalationPage> {
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return GetBuilder<LockEscalationLogic>(
|
||
init: LockEscalationLogic(),
|
||
builder: (LockEscalationLogic logic) {
|
||
return Scaffold(
|
||
backgroundColor: Colors.white,
|
||
appBar: TitleAppBar(
|
||
barTitle: TranslationLoader.lanKeys!.lockEscalation!.tr,
|
||
haveBack: true,
|
||
backgroundColor: AppColors.mainColor,
|
||
backAction: logic.getBack,
|
||
),
|
||
body: Container(
|
||
padding: EdgeInsets.all(30.w),
|
||
child: Column(
|
||
children: [
|
||
Obx(() {
|
||
return logic.state.otaUpdateIng.value
|
||
? PopScope(
|
||
canPop: false,
|
||
onPopInvoked: (didPop) async {
|
||
if (logic.state.otaUpdateIng.value) {
|
||
logic.closeOTADAta();
|
||
}
|
||
},
|
||
child: const SizedBox(),
|
||
)
|
||
: const SizedBox();
|
||
}),
|
||
SizedBox(
|
||
height: 60.h,
|
||
),
|
||
Row(
|
||
mainAxisAlignment: MainAxisAlignment.center,
|
||
children: [
|
||
Image.asset(
|
||
'images/main/icon_main_lockSet_lockEscalation.png',
|
||
width: 36.w,
|
||
height: 36.w,
|
||
),
|
||
SizedBox(
|
||
width: 10.w,
|
||
),
|
||
Text(
|
||
// TranslationLoader.lanKeys!.haveNewVersion!.tr,
|
||
"未发现新版本",
|
||
style: TextStyle(
|
||
fontSize: 24.sp, fontWeight: FontWeight.w600),
|
||
)
|
||
],
|
||
),
|
||
SizedBox(
|
||
height: 30.h,
|
||
),
|
||
Text(
|
||
"${TranslationLoader.lanKeys!.currentVersion!.tr}:1.0.0",
|
||
style: TextStyle(
|
||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||
),
|
||
SizedBox(
|
||
height: 40.h,
|
||
),
|
||
Obx(() {
|
||
return !logic.state.otaUpdateIng.value
|
||
? SubmitBtn(
|
||
btnName: TranslationLoader.lanKeys!.upgrade!.tr,
|
||
onClick: () {})
|
||
: SizedBox();
|
||
}),
|
||
SizedBox(
|
||
height: 10.h,
|
||
),
|
||
Obx(() {
|
||
return !logic.state.otaUpdateIng.value
|
||
? Row(
|
||
mainAxisAlignment: MainAxisAlignment.end,
|
||
children: [
|
||
// Container(
|
||
// margin: EdgeInsets.only(top: 8, bottom: 8),
|
||
// width: Get.width,
|
||
// child: Center(
|
||
// child: Text(
|
||
// // "${TranslationLoader.lanKeys!.newVersion!.tr}:1.0.1",
|
||
// "未发现新版本",
|
||
// style: TextStyle(
|
||
// color: AppColors.mainColor,
|
||
// fontSize: 18.sp),
|
||
// ),
|
||
// ),
|
||
// ),
|
||
GestureDetector(
|
||
onTap: () {
|
||
logic.otaUpdate();
|
||
},
|
||
child: Padding(
|
||
padding: const EdgeInsets.all(8.0),
|
||
child: Text(
|
||
'手动升级',
|
||
style: TextStyle(
|
||
color: AppColors.mainColor,
|
||
fontSize: 18.sp,
|
||
fontWeight: FontWeight.w400),
|
||
),
|
||
),
|
||
)
|
||
],
|
||
)
|
||
: Padding(
|
||
padding: EdgeInsets.symmetric(
|
||
horizontal: 50.w, vertical: 15.h),
|
||
child: Row(
|
||
mainAxisSize: MainAxisSize.min,
|
||
children: [
|
||
Text(
|
||
'固件传输中',
|
||
style: TextStyle(
|
||
color: AppColors.mainColor,
|
||
fontSize: 18.sp,
|
||
fontWeight: FontWeight.w400),
|
||
),
|
||
SizedBox(
|
||
width: 10.w,
|
||
),
|
||
Expanded(
|
||
child: ClipRRect(
|
||
borderRadius: BorderRadius.all(
|
||
Radius.circular(10.r)),
|
||
child: LinearProgressIndicator(
|
||
value: logic
|
||
.state.otaProgress.value, // 50% 进度
|
||
backgroundColor: Colors.grey[200],
|
||
valueColor:
|
||
AlwaysStoppedAnimation<Color>(
|
||
AppColors.mainColor),
|
||
),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
);
|
||
}),
|
||
],
|
||
),
|
||
));
|
||
});
|
||
}
|
||
}
|