From 5b9f9aae150c56a45c2624c5f8c3061c14121555 Mon Sep 17 00:00:00 2001 From: WinUser01 Date: Mon, 11 Apr 2022 10:08:02 +0800 Subject: [PATCH] =?UTF-8?q?hyzp=5Fybqx-Commit122=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E8=AF=AD=E9=9F=B3=E6=8F=90=E9=86=92=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E3=80=82=E7=89=88=E6=9C=AC=E5=8F=B7=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E4=B8=BAversion:=201.4.26+20220412?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + lib/components/commonFun.dart | 18 ++++++----- lib/pages/tabs/page7_setRemind.dart | 47 +++++++++++++++++------------ pubspec.yaml | 2 +- 4 files changed, 39 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index 3fe1f73..1c2136a 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ .pub/ /build/ android/app/release/app-release.apk +android/app/release/output.json # Web related lib/generated_plugin_registrant.dart diff --git a/lib/components/commonFun.dart b/lib/components/commonFun.dart index 780322b..97263c2 100644 --- a/lib/components/commonFun.dart +++ b/lib/components/commonFun.dart @@ -83,14 +83,14 @@ int g_remindGap = 60; // 提醒间隔默认为60S,0表示取消定时提醒 Timer g_remindTimer; //定时提醒变量 // 设置定时提醒 -setRemindTimer() { +setRemindTimer({bool enable = true}) { // 先取消旧的定时任务 if (null != g_remindTimer) { g_remindTimer.cancel(); //取消计时器 } // 设置新的定时任务 - if (g_remindGap > 0) { + if (enable && g_remindGap > 0) { ///循环执行定时任务,间隔 g_remindGap 秒 g_remindTimer = Timer.periodic(Duration(seconds: g_remindGap), (timer) { ///定时任务 @@ -102,16 +102,18 @@ setRemindTimer() { // 执行语音提醒 Future doRemind() async { // 获取待审核黑烟车记录 - listReviewed.clear(); - print("listReviewed = $listReviewed"); - await getReviewedList(); //注意:访问区县后台接口,需要统一添加区县代码参数 - print("listReviewed = $listReviewed"); - if (g_bVoiceRemind && listReviewed.length > 0) { + if (g_bVoiceRemind) { + listReviewed.clear(); + print("listReviewed = $listReviewed"); + await getReviewedList(); //注意:访问区县后台接口,需要统一添加区县代码参数 + print("listReviewed = $listReviewed"); // if (g_bVoiceRemind) { // import 'dart:io'; // import 'package:audioplayers/audio_cache.dart'; // print("播放:语音提醒.mp3"); - AudioCache().play(File('audio/语音提醒.mp3').path); //语音提醒 + if (listReviewed.length > 0) { + AudioCache().play(File('audio/语音提醒.mp3').path); //语音提醒 + } } } diff --git a/lib/pages/tabs/page7_setRemind.dart b/lib/pages/tabs/page7_setRemind.dart index 3552d9b..8833f16 100644 --- a/lib/pages/tabs/page7_setRemind.dart +++ b/lib/pages/tabs/page7_setRemind.dart @@ -26,16 +26,17 @@ class _LoginPageState extends State { @override void initState() { super.initState(); + bVoiceRemind = g_bVoiceRemind; getListView(); - //监听 g_bVoiceRemind 更新事件 - eventBus.on().listen((event) async { - print(event.str + ", g_bVoiceRemind = $g_bVoiceRemind"); - setState(() { - getListView(); - }); - }); + // //监听 g_bVoiceRemind 更新事件 + // eventBus.on().listen((event) async { + // print(event.str + ", g_bVoiceRemind = $g_bVoiceRemind"); + // setState(() { + // getListView(); + // }); + // }); } //////// @@ -103,10 +104,10 @@ class _LoginPageState extends State { OnTap_Remind() { setState(() { - g_bVoiceRemind = !g_bVoiceRemind; - print("bVoiceRemind = $g_bVoiceRemind"); - Storage.setBool('bVoiceRemind', g_bVoiceRemind); - if (g_bVoiceRemind) { + bVoiceRemind = !bVoiceRemind; + print("bVoiceRemind = $bVoiceRemind"); + // Storage.setBool('bVoiceRemind', bVoiceRemind); + if (bVoiceRemind) { print("播放语音提醒"); AudioCache().play(File('audio/语音提醒.mp3').path); //语音提醒 } @@ -114,6 +115,8 @@ class _LoginPageState extends State { }); } + bool bVoiceRemind; + getListView() { _listViewUser.clear(); _listViewUser = [ @@ -130,9 +133,9 @@ class _LoginPageState extends State { _getListTile('待审提醒', leadPath: 'assets/images/语音提醒.png', leadColor: _deepGreyColor, - textColor: g_bVoiceRemind ? Colors.blue : null, + textColor: bVoiceRemind ? Colors.blue : null, onTapFun: OnTap_Remind, - trailWidget: g_bVoiceRemind + trailWidget: bVoiceRemind ? Icon(Icons.check_box, color: Colors.blue) : Icon(Icons.check_box_outline_blank, color: Colors.blueAccent)), _getListTile('提醒间隔(秒)', @@ -150,12 +153,16 @@ class _LoginPageState extends State { text: "确认", color: Colors.blueAccent, onTop: () { - if (g_bVoiceRemind) { - g_remindGap = _gap; - print("g_remindGap = $g_remindGap"); - Storage.setInt('nRemindGap', g_remindGap); - setRemindTimer(); - } + g_bVoiceRemind = bVoiceRemind; + print("g_bVoiceRemind = $g_bVoiceRemind"); + Storage.setBool('bVoiceRemind', g_bVoiceRemind); + + g_remindGap = _gap; + print("g_remindGap = $g_remindGap"); + Storage.setInt('nRemindGap', g_remindGap); + setRemindTimer(enable: g_bVoiceRemind); + + AudioCache().play(File('audio/yinxiao1064.mp3').path); //音效提醒 Navigator.pop(context); }, ), @@ -180,7 +187,7 @@ class _LoginPageState extends State { return Container( width: ScreenUtil().setWidth(150), child: TextField( - readOnly: !g_bVoiceRemind, + readOnly: !bVoiceRemind, focusNode: FocusNode(), textAlignVertical: TextAlignVertical(y: 1.0), controller: TextEditingController.fromValue(TextEditingValue( diff --git a/pubspec.yaml b/pubspec.yaml index c6fc336..664dc21 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -64,7 +64,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev #version: 1.4.21+20220319 #version: 1.4.22+20220320 #version: 1.4.23+20220408 -version: 1.4.24+20220409 +version: 1.4.26+20220412 environment: sdk: ">=2.7.0 <3.0.0"