|
|
|
@ -11,6 +11,8 @@ import 'package:hyzp_ybqx/services/Storage.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import '../../components/commonFun.dart';
|
|
|
|
import '../../components/commonFun.dart';
|
|
|
|
import '../../widget/JdButton.dart';
|
|
|
|
import '../../widget/JdButton.dart';
|
|
|
|
|
|
|
|
import 'package:flutter_background_service/flutter_background_service.dart';
|
|
|
|
|
|
|
|
import 'package:hyzp_ybqx/pages/tabs/flutter_background_service_my.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class page7_setRemind extends StatefulWidget {
|
|
|
|
class page7_setRemind extends StatefulWidget {
|
|
|
|
page7_setRemind({Key key}) : super(key: key);
|
|
|
|
page7_setRemind({Key key}) : super(key: key);
|
|
|
|
@ -19,6 +21,9 @@ class page7_setRemind extends StatefulWidget {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _LoginPageState extends State<page7_setRemind> {
|
|
|
|
class _LoginPageState extends State<page7_setRemind> {
|
|
|
|
|
|
|
|
bool bVoiceRemind;
|
|
|
|
|
|
|
|
int remindGap;
|
|
|
|
|
|
|
|
|
|
|
|
dispose() {
|
|
|
|
dispose() {
|
|
|
|
super.dispose();
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -27,16 +32,7 @@ class _LoginPageState extends State<page7_setRemind> {
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
bVoiceRemind = g_bVoiceRemind;
|
|
|
|
bVoiceRemind = g_bVoiceRemind;
|
|
|
|
|
|
|
|
remindGap = g_remindGap;
|
|
|
|
getListView();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //监听 g_bVoiceRemind 更新事件
|
|
|
|
|
|
|
|
// eventBus.on<VoiceRemindUpdate>().listen((event) async {
|
|
|
|
|
|
|
|
// print(event.str + ", g_bVoiceRemind = $g_bVoiceRemind");
|
|
|
|
|
|
|
|
// setState(() {
|
|
|
|
|
|
|
|
// getListView();
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
////////
|
|
|
|
////////
|
|
|
|
@ -106,85 +102,15 @@ class _LoginPageState extends State<page7_setRemind> {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
bVoiceRemind = !bVoiceRemind;
|
|
|
|
bVoiceRemind = !bVoiceRemind;
|
|
|
|
print("bVoiceRemind = $bVoiceRemind");
|
|
|
|
print("bVoiceRemind = $bVoiceRemind");
|
|
|
|
// Storage.setBool('bVoiceRemind', bVoiceRemind);
|
|
|
|
print("播放语音提醒");
|
|
|
|
if (bVoiceRemind) {
|
|
|
|
if (bVoiceRemind) {
|
|
|
|
print("播放语音提醒");
|
|
|
|
|
|
|
|
// AudioCache().play(File('audio/语音提醒.mp3').path); //语音提醒
|
|
|
|
|
|
|
|
myPlayVoiceRemind();
|
|
|
|
myPlayVoiceRemind();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
myPlayClick();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
getListView();
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool bVoiceRemind;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getListView() {
|
|
|
|
|
|
|
|
_listViewUser.clear();
|
|
|
|
|
|
|
|
_listViewUser = [
|
|
|
|
|
|
|
|
Center(
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
margin: EdgeInsets.only(top: 30),
|
|
|
|
|
|
|
|
height: ScreenUtil().setWidth(160),
|
|
|
|
|
|
|
|
width: ScreenUtil().setWidth(160),
|
|
|
|
|
|
|
|
//child: Image.asset('assets/images/user.png', fit: BoxFit.cover),
|
|
|
|
|
|
|
|
child: Image.asset('assets/images/ybsthbj.png', fit: BoxFit.fitHeight),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(height: 50),
|
|
|
|
|
|
|
|
_getListTile('待审提醒',
|
|
|
|
|
|
|
|
leadPath: 'assets/images/语音提醒.png',
|
|
|
|
|
|
|
|
leadColor: _deepGreyColor,
|
|
|
|
|
|
|
|
textColor: bVoiceRemind ? Colors.blue : null,
|
|
|
|
|
|
|
|
onTapFun: OnTap_Remind,
|
|
|
|
|
|
|
|
trailWidget: bVoiceRemind
|
|
|
|
|
|
|
|
? Icon(Icons.check_box, color: Colors.blue)
|
|
|
|
|
|
|
|
: Icon(Icons.check_box_outline_blank, color: Colors.blueAccent)),
|
|
|
|
|
|
|
|
_getListTile('提醒间隔(秒)',
|
|
|
|
|
|
|
|
leadPath: 'assets/images/时间间隔.png',
|
|
|
|
|
|
|
|
leadColor: _deepBlueColor,
|
|
|
|
|
|
|
|
trailWidget: getTextField()),
|
|
|
|
|
|
|
|
SizedBox(height: 60),
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
JdButton(
|
|
|
|
|
|
|
|
height: 128,
|
|
|
|
|
|
|
|
width: 282,
|
|
|
|
|
|
|
|
//height: 126,
|
|
|
|
|
|
|
|
text: "确认",
|
|
|
|
|
|
|
|
color: Colors.blueAccent,
|
|
|
|
|
|
|
|
onTop: () {
|
|
|
|
|
|
|
|
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); //音效提醒
|
|
|
|
|
|
|
|
myPlayClacks(); //音效提醒
|
|
|
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
JdButton(
|
|
|
|
|
|
|
|
height: 128,
|
|
|
|
|
|
|
|
width: 282,
|
|
|
|
|
|
|
|
//height: 126,
|
|
|
|
|
|
|
|
text: "取消",
|
|
|
|
|
|
|
|
color: Colors.blueAccent,
|
|
|
|
|
|
|
|
onTop: () {
|
|
|
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int _gap = g_remindGap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget getTextField() {
|
|
|
|
Widget getTextField() {
|
|
|
|
return Container(
|
|
|
|
return Container(
|
|
|
|
width: ScreenUtil().setWidth(150),
|
|
|
|
width: ScreenUtil().setWidth(150),
|
|
|
|
@ -193,10 +119,10 @@ class _LoginPageState extends State<page7_setRemind> {
|
|
|
|
focusNode: FocusNode(),
|
|
|
|
focusNode: FocusNode(),
|
|
|
|
textAlignVertical: TextAlignVertical(y: 1.0),
|
|
|
|
textAlignVertical: TextAlignVertical(y: 1.0),
|
|
|
|
controller: TextEditingController.fromValue(TextEditingValue(
|
|
|
|
controller: TextEditingController.fromValue(TextEditingValue(
|
|
|
|
text: _gap.toString(),
|
|
|
|
text: remindGap.toString(),
|
|
|
|
// 保持光标在最后
|
|
|
|
// 保持光标在最后
|
|
|
|
selection: TextSelection.fromPosition(
|
|
|
|
selection: TextSelection.fromPosition(TextPosition(
|
|
|
|
TextPosition(affinity: TextAffinity.downstream, offset: _gap.toString().length)))),
|
|
|
|
affinity: TextAffinity.downstream, offset: remindGap.toString().length)))),
|
|
|
|
maxLines: 1,
|
|
|
|
maxLines: 1,
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
decoration: InputDecoration(
|
|
|
|
@ -209,7 +135,7 @@ class _LoginPageState extends State<page7_setRemind> {
|
|
|
|
enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.lightBlue)),
|
|
|
|
enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.lightBlue)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onChanged: (v) {
|
|
|
|
onChanged: (v) {
|
|
|
|
_gap = int.parse(v);
|
|
|
|
remindGap = int.parse(v);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@ -279,7 +205,83 @@ class _LoginPageState extends State<page7_setRemind> {
|
|
|
|
body: Container(
|
|
|
|
body: Container(
|
|
|
|
padding: EdgeInsets.only(top: 30, bottom: 20, left: 20, right: 20),
|
|
|
|
padding: EdgeInsets.only(top: 30, bottom: 20, left: 20, right: 20),
|
|
|
|
child: ListView(
|
|
|
|
child: ListView(
|
|
|
|
children: _listViewUser,
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Center(
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
margin: EdgeInsets.only(top: 30),
|
|
|
|
|
|
|
|
height: ScreenUtil().setWidth(160),
|
|
|
|
|
|
|
|
width: ScreenUtil().setWidth(160),
|
|
|
|
|
|
|
|
//child: Image.asset('assets/images/user.png', fit: BoxFit.cover),
|
|
|
|
|
|
|
|
child: Image.asset('assets/images/ybsthbj.png', fit: BoxFit.fitHeight),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(height: 50),
|
|
|
|
|
|
|
|
_getListTile('待审提醒',
|
|
|
|
|
|
|
|
leadPath: 'assets/images/语音提醒.png',
|
|
|
|
|
|
|
|
leadColor: _deepGreyColor,
|
|
|
|
|
|
|
|
textColor: bVoiceRemind ? Colors.blue : null,
|
|
|
|
|
|
|
|
onTapFun: OnTap_Remind,
|
|
|
|
|
|
|
|
trailWidget: bVoiceRemind
|
|
|
|
|
|
|
|
? Icon(Icons.check_box, color: Colors.blue)
|
|
|
|
|
|
|
|
: Icon(Icons.check_box_outline_blank, color: Colors.blueAccent)),
|
|
|
|
|
|
|
|
_getListTile('提醒间隔(秒)',
|
|
|
|
|
|
|
|
leadPath: 'assets/images/时间间隔.png',
|
|
|
|
|
|
|
|
leadColor: _deepBlueColor,
|
|
|
|
|
|
|
|
trailWidget: getTextField()),
|
|
|
|
|
|
|
|
SizedBox(height: 60),
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
JdButton(
|
|
|
|
|
|
|
|
height: 128,
|
|
|
|
|
|
|
|
width: 282,
|
|
|
|
|
|
|
|
//height: 126,
|
|
|
|
|
|
|
|
text: "确认",
|
|
|
|
|
|
|
|
color: Colors.blueAccent,
|
|
|
|
|
|
|
|
onTop: () async {
|
|
|
|
|
|
|
|
if (g_bVoiceRemind != bVoiceRemind && g_remindGap != remindGap) {
|
|
|
|
|
|
|
|
if (await FlutterBackgroundService().isServiceRunning()) {
|
|
|
|
|
|
|
|
FlutterBackgroundService().sendData({"action": "stopService"});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_bVoiceRemind = bVoiceRemind;
|
|
|
|
|
|
|
|
print("g_bVoiceRemind = $g_bVoiceRemind");
|
|
|
|
|
|
|
|
await Storage.setBool('bVoiceRemind', g_bVoiceRemind);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_remindGap = remindGap;
|
|
|
|
|
|
|
|
print("g_remindGap = $g_remindGap");
|
|
|
|
|
|
|
|
await Storage.setInt('nRemindGap', g_remindGap);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bVoiceRemind) {
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
|
|
|
|
var isRunning = await FlutterBackgroundService().isServiceRunning();
|
|
|
|
|
|
|
|
if (!isRunning) {
|
|
|
|
|
|
|
|
await FlutterBackgroundService.initialize(onStart);
|
|
|
|
|
|
|
|
myPlayVoiceRemind();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
myPlayClick();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
JdButton(
|
|
|
|
|
|
|
|
height: 128,
|
|
|
|
|
|
|
|
width: 282,
|
|
|
|
|
|
|
|
//height: 126,
|
|
|
|
|
|
|
|
text: "取消",
|
|
|
|
|
|
|
|
color: Colors.blueAccent,
|
|
|
|
|
|
|
|
onTop: () {
|
|
|
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|