Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
laki_icu_app
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张宏
laki_icu_app
Commits
3dde4595
Commit
3dde4595
authored
Jun 27, 2026
by
akari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加模态确认框
parent
a74d7559
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
302 additions
and
70 deletions
+302
-70
device_control_index_view.dart
.../monitoring/device_control/device_control_index_view.dart
+12
-9
device_control_care_panel.dart
...ing/device_control/widgets/device_control_care_panel.dart
+15
-5
device_control_confirm_dialog.dart
...device_control/widgets/device_control_confirm_dialog.dart
+162
-0
device_control_metric_card.dart
...ng/device_control/widgets/device_control_metric_card.dart
+21
-7
device_control_mode_panel.dart
...ing/device_control/widgets/device_control_mode_panel.dart
+9
-3
device_control_time_panel.dart
...ing/device_control/widgets/device_control_time_panel.dart
+5
-1
device_control_wind_panel.dart
...ing/device_control/widgets/device_control_wind_panel.dart
+31
-15
factory_device_calibration_panel.dart
...ry_settings/widgets/factory_device_calibration_panel.dart
+32
-21
factory_settings_panel.dart
...ings/factory_settings/widgets/factory_settings_panel.dart
+15
-9
No files found.
lib/views/monitoring/device_control/device_control_index_view.dart
View file @
3dde4595
...
...
@@ -10,6 +10,7 @@ import 'package:laki_icu_app/models/bo/monitoring_bo.dart';
import
'cubit/device_control_index_cubit.dart'
;
import
'cubit/device_control_index_state.dart'
;
import
'widgets/device_control_care_panel.dart'
;
import
'widgets/device_control_confirm_dialog.dart'
;
import
'widgets/device_control_info_panel.dart'
;
import
'widgets/device_control_metric_card.dart'
;
import
'widgets/device_control_mode_panel.dart'
;
...
...
@@ -92,8 +93,7 @@ class _DeviceControlLayout extends StatelessWidget {
metric:
metrics
[
index
],
),
),
if
(
index
<
metrics
.
length
-
1
)
SizedBox
(
width:
24
.
w
),
if
(
index
<
metrics
.
length
-
1
)
SizedBox
(
width:
24
.
w
),
],
],
),
...
...
@@ -151,11 +151,9 @@ class _DeviceControlLayout extends StatelessWidget {
SizedBox
(
height:
24
.
h
),
Expanded
(
flex:
20
,
child:
BlocBuilder
<
DeviceControlBloc
,
DeviceControlState
>(
child:
BlocBuilder
<
DeviceControlBloc
,
DeviceControlState
>(
buildWhen:
(
previous
,
current
)
=>
previous
.
data
.
openOxygen
!=
current
.
data
.
openOxygen
,
previous
.
data
.
openOxygen
!=
current
.
data
.
openOxygen
,
builder:
(
context
,
state
)
{
final
isOn
=
state
.
data
.
openOxygen
.
isOn
;
return
DeviceControlInfoPanel
(
...
...
@@ -165,9 +163,14 @@ class _DeviceControlLayout extends StatelessWidget {
icon:
Icons
.
air
,
body:
'开启后风扇打开、制冷、加热和
\n
循环等设备暂停。'
,
warning:
'*保持设备周围空气相对禁止,严禁烟火'
,
onTap:
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
DeviceControlOpenOxygenSwitchChanged
(!
isOn
),
),
onTap:
()
{
confirmDeviceControlChange
(
context
,
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
DeviceControlOpenOxygenSwitchChanged
(!
isOn
),
),
);
},
);
},
),
...
...
lib/views/monitoring/device_control/widgets/device_control_care_panel.dart
View file @
3dde4595
...
...
@@ -7,6 +7,7 @@ import 'package:laki_icu_app/blocs/device_control/device_control_state.dart';
import
'package:laki_icu_app/models/bo/device_control_bo.dart'
;
import
'device_control_common.dart'
;
import
'device_control_confirm_dialog.dart'
;
/// 护理等级面板
class
DeviceControlCarePanel
extends
StatelessWidget
{
...
...
@@ -36,9 +37,14 @@ class DeviceControlCarePanel extends StatelessWidget {
Expanded
(
child:
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
onTap:
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
DeviceControlCareLevelChanged
(
item
.
level
),
),
onTap:
()
{
confirmDeviceControlChange
(
context
,
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
DeviceControlCareLevelChanged
(
item
.
level
),
),
);
},
child:
Text
(
item
.
label
,
textAlign:
TextAlign
.
center
,
...
...
@@ -101,12 +107,16 @@ class _CareLevelBar extends StatelessWidget {
Expanded
(
child:
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
onTap:
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
onTap:
()
{
confirmDeviceControlChange
(
context
,
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
DeviceControlCareLevelChanged
(
_careLevelItems
[
index
].
level
,
),
),
);
},
child:
Container
(
height:
20
.
h
,
decoration:
BoxDecoration
(
...
...
lib/views/monitoring/device_control/widgets/device_control_confirm_dialog.dart
0 → 100644
View file @
3dde4595
import
'dart:ui'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'device_control_common.dart'
;
class
DeviceControlConfirmConfig
{
DeviceControlConfirmConfig
.
_
();
static
bool
enabled
=
true
;
}
Future
<
void
>
confirmDeviceControlChange
(
BuildContext
context
,
VoidCallback
onConfirmed
,
)
async
{
if
(!
DeviceControlConfirmConfig
.
enabled
)
{
onConfirmed
();
return
;
}
final
confirmed
=
await
showDialog
<
bool
>(
context:
context
,
barrierColor:
Colors
.
black
.
withValues
(
alpha:
0.44
),
builder:
(
_
)
=>
const
_DeviceControlConfirmDialog
(),
);
if
(!
context
.
mounted
||
confirmed
!=
true
)
return
;
onConfirmed
();
}
class
_DeviceControlConfirmDialog
extends
StatelessWidget
{
const
_DeviceControlConfirmDialog
();
@override
Widget
build
(
BuildContext
context
)
{
return
Stack
(
children:
[
Positioned
.
fill
(
child:
BackdropFilter
(
filter:
ImageFilter
.
blur
(
sigmaX:
5
,
sigmaY:
5
),
child:
const
SizedBox
.
expand
(),
),
),
Center
(
child:
Container
(
width:
680
.
w
,
height:
450
.
h
,
padding:
EdgeInsets
.
fromLTRB
(
42
.
w
,
34
.
h
,
42
.
w
,
46
.
h
),
decoration:
BoxDecoration
(
color:
const
Color
(
0xFF061C34
).
withValues
(
alpha:
0.96
),
borderRadius:
BorderRadius
.
circular
(
8
.
r
),
border:
Border
.
all
(
color:
const
Color
(
0xFF89DFFF
),
width:
3
.
w
,
),
boxShadow:
[
BoxShadow
(
color:
const
Color
(
0xFF4FC8FF
).
withValues
(
alpha:
0.45
),
blurRadius:
28
.
r
,
spreadRadius:
3
.
r
,
),
],
),
child:
Column
(
children:
[
Text
(
'保存设定'
,
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
26
.
sp
,
fontWeight:
FontWeight
.
w800
,
decoration:
TextDecoration
.
none
,
),
),
SizedBox
(
height:
24
.
h
),
Divider
(
color:
const
Color
(
0xFF3A9BD2
).
withValues
(
alpha:
0.42
),
height:
1
.
h
,
),
const
Spacer
(),
Text
(
'确认设置当前修改参数'
,
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
36
.
sp
,
fontWeight:
FontWeight
.
w800
,
decoration:
TextDecoration
.
none
,
),
),
const
Spacer
(),
Row
(
children:
[
Expanded
(
child:
_ConfirmButton
(
text:
'取消'
,
active:
false
,
onPressed:
()
=>
Navigator
.
of
(
context
).
pop
(
false
),
),
),
SizedBox
(
width:
40
.
w
),
Expanded
(
child:
_ConfirmButton
(
text:
'确认保存'
,
active:
true
,
onPressed:
()
=>
Navigator
.
of
(
context
).
pop
(
true
),
),
),
],
),
],
),
),
),
],
);
}
}
class
_ConfirmButton
extends
StatelessWidget
{
const
_ConfirmButton
({
required
this
.
text
,
required
this
.
active
,
required
this
.
onPressed
,
});
final
String
text
;
final
bool
active
;
final
VoidCallback
onPressed
;
@override
Widget
build
(
BuildContext
context
)
{
return
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
onTap:
onPressed
,
child:
Container
(
height:
84
.
h
,
alignment:
Alignment
.
center
,
decoration:
deviceControlButtonDecoration
(
active:
active
,
backgroundAsset:
assetButton
,
),
child:
Text
(
text
,
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
color:
active
?
const
Color
(
0xFFC9F8FF
)
:
Colors
.
white
,
fontSize:
26
.
sp
,
fontWeight:
FontWeight
.
w800
,
decoration:
TextDecoration
.
none
,
),
),
),
);
}
}
lib/views/monitoring/device_control/widgets/device_control_metric_card.dart
View file @
3dde4595
...
...
@@ -8,6 +8,7 @@ import 'package:laki_icu_app/models/bo/monitoring_bo.dart';
import
'package:laki_icu_app/utils/numeric_keyboard.dart'
;
import
'device_control_common.dart'
;
import
'device_control_confirm_dialog.dart'
;
/// 环境指标控制卡片(温度/湿度/氧气/二氧化碳)
class
DeviceControlMetricCard
extends
StatelessWidget
{
...
...
@@ -149,9 +150,14 @@ class DeviceControlMetricCard extends StatelessWidget {
active:
adjustEventBuilder
!=
null
,
onTap:
adjustEventBuilder
==
null
?
null
:
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
adjustEventBuilder
(
false
),
),
:
()
{
confirmDeviceControlChange
(
context
,
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
adjustEventBuilder
(
false
),
),
);
},
),
const
Spacer
(),
GestureDetector
(
...
...
@@ -186,9 +192,14 @@ class DeviceControlMetricCard extends StatelessWidget {
active:
adjustEventBuilder
!=
null
,
onTap:
adjustEventBuilder
==
null
?
null
:
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
adjustEventBuilder
(
true
),
),
:
()
{
confirmDeviceControlChange
(
context
,
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
adjustEventBuilder
(
true
),
),
);
},
),
],
),
...
...
@@ -266,7 +277,10 @@ class DeviceControlMetricCard extends StatelessWidget {
final
value
=
result
.
trim
();
if
(
value
.
isEmpty
||
value
==
'.'
)
return
;
context
.
read
<
DeviceControlBloc
>().
add
(
eventBuilder
(
value
));
await
confirmDeviceControlChange
(
context
,
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
eventBuilder
(
value
)),
);
}
}
...
...
lib/views/monitoring/device_control/widgets/device_control_mode_panel.dart
View file @
3dde4595
...
...
@@ -7,6 +7,7 @@ import 'package:laki_icu_app/blocs/device_control/device_control_state.dart';
import
'package:laki_icu_app/models/bo/device_control_bo.dart'
;
import
'device_control_common.dart'
;
import
'device_control_confirm_dialog.dart'
;
/// 模式切换面板(外循环/检查灯/照明灯/内循环/蓝光/红光)
class
DeviceControlModePanel
extends
StatelessWidget
{
...
...
@@ -94,9 +95,14 @@ class DeviceControlModePanel extends StatelessWidget {
label:
item
.
label
,
icon:
item
.
icon
,
active:
item
.
active
,
onTap:
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
item
.
event
,
),
onTap:
()
{
confirmDeviceControlChange
(
context
,
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
item
.
event
,
),
);
},
),
),
],
...
...
lib/views/monitoring/device_control/widgets/device_control_time_panel.dart
View file @
3dde4595
...
...
@@ -7,6 +7,7 @@ import 'package:laki_icu_app/blocs/device_control/device_control_state.dart';
import
'package:laki_icu_app/utils/numeric_keyboard.dart'
;
import
'device_control_common.dart'
;
import
'device_control_confirm_dialog.dart'
;
/// 设置雾化/消毒时间面板
class
DeviceControlTimePanel
extends
StatelessWidget
{
...
...
@@ -81,7 +82,10 @@ class DeviceControlTimePanel extends StatelessWidget {
final
value
=
result
.
trim
();
if
(
value
.
isEmpty
)
return
;
context
.
read
<
DeviceControlBloc
>().
add
(
eventBuilder
(
value
));
await
confirmDeviceControlChange
(
context
,
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
eventBuilder
(
value
)),
);
}
}
...
...
lib/views/monitoring/device_control/widgets/device_control_wind_panel.dart
View file @
3dde4595
...
...
@@ -7,6 +7,7 @@ import 'package:laki_icu_app/blocs/device_control/device_control_state.dart';
import
'package:laki_icu_app/models/bo/device_control_bo.dart'
;
import
'device_control_common.dart'
;
import
'device_control_confirm_dialog.dart'
;
/// 风速调节面板
class
DeviceControlWindPanel
extends
StatelessWidget
{
...
...
@@ -33,11 +34,16 @@ class DeviceControlWindPanel extends StatelessWidget {
label:
'睡眠模式'
,
icon:
Icons
.
nightlight_round
,
active:
currentMode
==
WindSpeedMode
.
sleep
,
onTap:
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
const
DeviceControlWindSpeedModeChanged
(
WindSpeedMode
.
sleep
,
),
),
onTap:
()
{
confirmDeviceControlChange
(
context
,
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
const
DeviceControlWindSpeedModeChanged
(
WindSpeedMode
.
sleep
,
),
),
);
},
),
),
SizedBox
(
height:
18
.
h
),
...
...
@@ -46,11 +52,16 @@ class DeviceControlWindPanel extends StatelessWidget {
label:
'舒适模式'
,
icon:
Icons
.
favorite_border
,
active:
currentMode
==
WindSpeedMode
.
comfort
,
onTap:
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
const
DeviceControlWindSpeedModeChanged
(
WindSpeedMode
.
comfort
,
),
),
onTap:
()
{
confirmDeviceControlChange
(
context
,
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
const
DeviceControlWindSpeedModeChanged
(
WindSpeedMode
.
comfort
,
),
),
);
},
),
),
SizedBox
(
height:
18
.
h
),
...
...
@@ -59,11 +70,16 @@ class DeviceControlWindPanel extends StatelessWidget {
label:
'强劲模式'
,
icon:
Icons
.
air
,
active:
currentMode
==
WindSpeedMode
.
strong
,
onTap:
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
const
DeviceControlWindSpeedModeChanged
(
WindSpeedMode
.
strong
,
),
),
onTap:
()
{
confirmDeviceControlChange
(
context
,
()
=>
context
.
read
<
DeviceControlBloc
>().
add
(
const
DeviceControlWindSpeedModeChanged
(
WindSpeedMode
.
strong
,
),
),
);
},
),
),
],
...
...
lib/views/settings/factory_settings/widgets/factory_device_calibration_panel.dart
View file @
3dde4595
...
...
@@ -7,6 +7,10 @@ import 'package:laki_icu_app/utils/toast_utils.dart';
import
'../../widgets/settings_panel_frame.dart'
;
import
'../cubit/factory_settings_index_cubit.dart'
;
const
bool
_enableCalibrationEditing
=
false
;
const
bool
_showCalibrationInitButton
=
false
;
const
bool
_showCalibrationApplyButton
=
false
;
class
FactoryDeviceCalibrationPanel
extends
StatefulWidget
{
const
FactoryDeviceCalibrationPanel
({
super
.
key
});
...
...
@@ -64,12 +68,12 @@ class _FactoryDeviceCalibrationPanelState
children:
[
_CalibrationSectionView
(
section:
_sections
[
0
],
onItemTap:
_e
ditItem
,
onItemTap:
_e
nableCalibrationEditing
?
_editItem
:
null
,
),
SizedBox
(
height:
28
.
h
),
_CalibrationSectionView
(
section:
_sections
[
1
],
onItemTap:
_e
ditItem
,
onItemTap:
_e
nableCalibrationEditing
?
_editItem
:
null
,
),
],
),
...
...
@@ -86,18 +90,20 @@ class _FactoryDeviceCalibrationPanelState
children:
[
_CalibrationSectionView
(
section:
_sections
[
2
],
onItemTap:
_e
ditItem
,
onItemTap:
_e
nableCalibrationEditing
?
_editItem
:
null
,
),
const
Spacer
(),
Center
(
child:
_CalibrationButton
(
text:
'初始化设置'
,
width:
360
.
w
,
height:
72
.
h
,
onPressed:
_resetDefaults
,
if
(
_showCalibrationInitButton
)
...[
Center
(
child:
_CalibrationButton
(
text:
'初始化设置'
,
width:
360
.
w
,
height:
72
.
h
,
onPressed:
_resetDefaults
,
),
),
),
SizedBox
(
height:
46
.
h
)
,
SizedBox
(
height:
46
.
h
),
]
,
Row
(
children:
[
Expanded
(
...
...
@@ -111,14 +117,16 @@ class _FactoryDeviceCalibrationPanelState
},
),
),
SizedBox
(
width:
34
.
w
),
Expanded
(
child:
_CalibrationButton
(
text:
'应用更改'
,
height:
92
.
h
,
onPressed:
_applyChanges
,
if
(
_showCalibrationApplyButton
)
...[
SizedBox
(
width:
34
.
w
),
Expanded
(
child:
_CalibrationButton
(
text:
'应用更改'
,
height:
92
.
h
,
onPressed:
_applyChanges
,
),
),
)
,
]
,
],
),
],
...
...
@@ -136,7 +144,7 @@ class _CalibrationSectionView extends StatelessWidget {
});
final
_CalibrationSection
section
;
final
ValueChanged
<
_CalibrationItem
>
onItemTap
;
final
ValueChanged
<
_CalibrationItem
>
?
onItemTap
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -155,7 +163,10 @@ class _CalibrationSectionView extends StatelessWidget {
),
SizedBox
(
height:
24
.
h
),
for
(
final
item
in
section
.
items
)
...[
_CalibrationRow
(
item:
item
,
onTap:
()
=>
onItemTap
(
item
)),
_CalibrationRow
(
item:
item
,
onTap:
onItemTap
==
null
?
null
:
()
=>
onItemTap
!(
item
),
),
SizedBox
(
height:
18
.
h
),
],
],
...
...
@@ -170,7 +181,7 @@ class _CalibrationRow extends StatelessWidget {
});
final
_CalibrationItem
item
;
final
VoidCallback
onTap
;
final
VoidCallback
?
onTap
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
lib/views/settings/factory_settings/widgets/factory_settings_panel.dart
View file @
3dde4595
...
...
@@ -8,6 +8,9 @@ import '../cubit/factory_settings_index_cubit.dart';
import
'../cubit/factory_settings_index_state.dart'
;
import
'factory_device_calibration_panel.dart'
;
const
bool
_showFactoryCalibrationEntry
=
false
;
const
bool
_showFactoryInitEntry
=
false
;
class
FactorySettingsPanel
extends
StatelessWidget
{
const
FactorySettingsPanel
({
super
.
key
});
...
...
@@ -132,15 +135,18 @@ class _FactoryActionColumn extends StatelessWidget {
Center
(
child:
Column
(
children:
[
_WideFactoryButton
(
text:
'设备校准'
,
onPressed:
()
=>
cubit
.
showCalibrationPage
(),
),
SizedBox
(
height:
28
.
h
),
_WideFactoryButton
(
text:
'初始化设置'
,
onPressed:
()
=>
const
{},
),
if
(
_showFactoryCalibrationEntry
)
_WideFactoryButton
(
text:
'设备校准'
,
onPressed:
()
=>
cubit
.
showCalibrationPage
(),
),
if
(
_showFactoryCalibrationEntry
&&
_showFactoryInitEntry
)
SizedBox
(
height:
28
.
h
),
if
(
_showFactoryInitEntry
)
_WideFactoryButton
(
text:
'初始化设置'
,
onPressed:
()
=>
const
{},
),
],
),
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment