197 lines
5.8 KiB
Dart
197 lines
5.8 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/titleAppBar.dart';
|
|
import '../../../../../translations/trans_lib.dart';
|
|
import '../../../../blue/blue_manage.dart';
|
|
import '../../../../tools/appRouteObserver.dart';
|
|
import 'addFingerprint_logic.dart';
|
|
|
|
class AddFingerprintPage extends StatefulWidget {
|
|
const AddFingerprintPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<AddFingerprintPage> createState() => _AddFingerprintPageState();
|
|
}
|
|
|
|
class _AddFingerprintPageState extends State<AddFingerprintPage> with RouteAware {
|
|
final logic = Get.put(AddFingerprintLogic());
|
|
final state = Get.find<AddFingerprintLogic>().state;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: Colors.white,
|
|
appBar: TitleAppBar(
|
|
barTitle: "${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}",
|
|
haveBack: true,
|
|
backgroundColor: AppColors.mainColor),
|
|
body: ListView(
|
|
children: [
|
|
SizedBox(
|
|
height: 50.h,
|
|
),
|
|
Obx(() => Visibility(
|
|
visible:logic.state.ifConnectScuess.value,
|
|
child: Container(
|
|
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
|
child: Column(
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
"请将您的手指按下".tr,
|
|
// TranslationLoader.lanKeys!.lightTouchScreenTip!.tr,
|
|
textAlign: TextAlign.center,
|
|
maxLines:null,
|
|
style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: 10.h),
|
|
Text(
|
|
"(${state.regIndex.value}/${state.maxRegCount.value})",
|
|
// TranslationLoader.lanKeys!.lightTouchScreenTip!.tr,
|
|
textAlign: TextAlign.center,
|
|
maxLines:null,
|
|
style: TextStyle(fontSize: 24.sp),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
)),
|
|
Obx(() => Visibility(
|
|
visible:!logic.state.ifConnectScuess.value,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
"尝试连接设备...".tr,
|
|
// TranslationLoader.lanKeys!.lightTouchScreenTip!.tr,
|
|
textAlign: TextAlign.center,
|
|
maxLines:null,
|
|
style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
)),
|
|
SizedBox(
|
|
height: 100.h,
|
|
),
|
|
Obx(() => Image.asset(
|
|
getIconNumber(state.regIndex.value),
|
|
width: 185.w,
|
|
height: 295.h,
|
|
),),
|
|
SizedBox(
|
|
height: 120.h,
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.all(10.w),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
"根据提示,抬起手指后再进行下一次指纹采集".tr,
|
|
// TranslationLoader.lanKeys!.lightTouchScreenTip!.tr,
|
|
textAlign: TextAlign.center,
|
|
maxLines:null,
|
|
style: TextStyle(fontSize: 24.sp),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
String getIconNumber(int number){
|
|
String iconPath = "";
|
|
switch(number){
|
|
case 0:
|
|
iconPath = 'images/main/icon_addFingerprint_fingerprint_one.png';
|
|
break;
|
|
case 1:
|
|
iconPath = 'images/main/icon_addFingerprint_fingerprint_two.png';
|
|
break;
|
|
case 2:
|
|
iconPath = 'images/main/icon_addFingerprint_fingerprint_three.png';
|
|
break;
|
|
case 3:
|
|
iconPath = 'images/main/icon_addFingerprint_fingerprint_four.png';
|
|
break;
|
|
case 4:
|
|
iconPath = 'images/main/icon_addFingerprint_fingerprint_five.png';
|
|
break;
|
|
default:
|
|
iconPath = 'images/main/icon_addFingerprint_fingerprint_four.png';
|
|
break;
|
|
}
|
|
return iconPath;
|
|
}
|
|
|
|
@override
|
|
void didChangeDependencies() {
|
|
// TODO: implement didChangeDependencies
|
|
super.didChangeDependencies();
|
|
|
|
/// 路由订阅
|
|
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
// TODO: implement dispose
|
|
/// 取消路由订阅
|
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
|
super.dispose();
|
|
}
|
|
|
|
/// 从上级界面进入 当前界面即将出现
|
|
@override
|
|
void didPush() {
|
|
super.didPush();
|
|
state.ifCurrentScreen.value = true;
|
|
}
|
|
|
|
/// 返回上一个界面 当前界面即将消失
|
|
@override
|
|
void didPop() {
|
|
super.didPop();
|
|
logic.cancelBlueConnetctToastTimer();
|
|
state.ifCurrentScreen.value = false;
|
|
|
|
if(state.ifAddState.value){
|
|
logic.senderCancelAddFingerprintCommand();
|
|
}
|
|
}
|
|
|
|
/// 从下级返回 当前界面即将出现
|
|
@override
|
|
void didPopNext() {
|
|
super.didPopNext();
|
|
state.ifCurrentScreen.value = true;
|
|
}
|
|
|
|
/// 进入下级界面 当前界面即将消失
|
|
@override
|
|
void didPushNext() {
|
|
super.didPushNext();
|
|
logic.cancelBlueConnetctToastTimer();
|
|
|
|
state.ifCurrentScreen.value = false;
|
|
}
|
|
|
|
}
|