Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
smart_hotel_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
张宏
smart_hotel_app
Commits
2fd41bd6
Commit
2fd41bd6
authored
Jun 11, 2026
by
张宏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
daa14c60
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
132 additions
and
2 deletions
+132
-2
alert_detail_repository.dart
lib/repositories/alert_detail_repository.dart
+2
-1
voltage_operate_block.dart
lib/views/home/index/widget/voltage_operate_block.dart
+130
-1
No files found.
lib/repositories/alert_detail_repository.dart
View file @
2fd41bd6
...
@@ -17,7 +17,7 @@ class AlertDetailRepository {
...
@@ -17,7 +17,7 @@ class AlertDetailRepository {
Future
<
ResponseModel
<
Map
<
String
,
dynamic
>>>
handleAlert
({
required
int
alertId
})
{
Future
<
ResponseModel
<
Map
<
String
,
dynamic
>>>
handleAlert
({
required
int
alertId
})
{
return
DioRequest
.
instance
.
post
<
Map
<
String
,
dynamic
>>(
return
DioRequest
.
instance
.
post
<
Map
<
String
,
dynamic
>>(
'/app/alert/handle'
,
'/app/alert/handle'
,
data:
{
'alertId'
:
alertId
},
data:
{
'alertId'
:
alertId
,
'handleResult'
:
'1.检查输入电压是否正常;2.确认设备是否正常运行;3.若异常,请联系电工。'
},
);
);
}
}
}
}
\ No newline at end of file
lib/views/home/index/widget/voltage_operate_block.dart
View file @
2fd41bd6
import
'package:auto_route/auto_route.dart'
;
import
'package:auto_route/auto_route.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:smart_hotel_app/repositories/alert_detail_repository.dart'
;
import
'package:smart_hotel_app/routes/app_router.gr.dart'
;
import
'package:smart_hotel_app/routes/app_router.gr.dart'
;
import
'package:smart_hotel_app/services/alert_detail_service.dart'
;
class
VoltageOperateBlock
extends
StatelessWidget
{
class
VoltageOperateBlock
extends
StatelessWidget
{
final
int
alertId
;
final
int
alertId
;
...
@@ -11,6 +13,7 @@ class VoltageOperateBlock extends StatelessWidget {
...
@@ -11,6 +13,7 @@ class VoltageOperateBlock extends StatelessWidget {
final
String
normalVoltage
;
final
String
normalVoltage
;
final
String
voltageWaitTime
;
final
String
voltageWaitTime
;
final
String
voltageAlarmLevel
;
final
String
voltageAlarmLevel
;
final
AlertDetailService
?
alertDetailService
;
const
VoltageOperateBlock
({
const
VoltageOperateBlock
({
super
.
key
,
super
.
key
,
...
@@ -21,6 +24,7 @@ class VoltageOperateBlock extends StatelessWidget {
...
@@ -21,6 +24,7 @@ class VoltageOperateBlock extends StatelessWidget {
required
this
.
normalVoltage
,
required
this
.
normalVoltage
,
required
this
.
voltageWaitTime
,
required
this
.
voltageWaitTime
,
required
this
.
voltageAlarmLevel
,
required
this
.
voltageAlarmLevel
,
this
.
alertDetailService
,
});
});
@override
@override
...
@@ -111,7 +115,7 @@ class VoltageOperateBlock extends StatelessWidget {
...
@@ -111,7 +115,7 @@ class VoltageOperateBlock extends StatelessWidget {
children:
[
children:
[
Expanded
(
Expanded
(
child:
GestureDetector
(
child:
GestureDetector
(
onTap:
()
{}
,
onTap:
()
=>
_showHandleDialog
(
context
)
,
child:
Container
(
child:
Container
(
height:
88
.
h
,
height:
88
.
h
,
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
...
@@ -161,4 +165,128 @@ class VoltageOperateBlock extends StatelessWidget {
...
@@ -161,4 +165,128 @@ class VoltageOperateBlock extends StatelessWidget {
),
),
);
);
}
}
void
_showHandleDialog
(
BuildContext
context
)
{
showDialog
(
context:
context
,
barrierDismissible:
true
,
builder:
(
dialogContext
)
{
return
Dialog
(
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
16
.
r
),
),
child:
Container
(
padding:
EdgeInsets
.
all
(
24
.
w
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
.
r
),
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Text
(
'电压波动告警'
,
style:
TextStyle
(
fontSize:
30
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
Colors
.
black
,
),
),
GestureDetector
(
onTap:
()
=>
Navigator
.
of
(
dialogContext
).
pop
(),
child:
Icon
(
Icons
.
close
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
size:
32
.
sp
,
),
),
],
),
SizedBox
(
height:
16
.
h
),
Container
(
width:
double
.
infinity
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
20
.
w
,
vertical:
20
.
h
,
),
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
242
,
243
,
245
,
1
),
borderRadius:
BorderRadius
.
circular
(
12
.
r
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
'解决办法:'
,
style:
TextStyle
(
fontSize:
26
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
Colors
.
black
,
),
),
SizedBox
(
height:
12
.
h
),
Text
(
'1.检查输入电压是否正常;
\n
2.确认设备是否正常运行;
\n
3.若异常,请联系电工。'
,
style:
TextStyle
(
fontSize:
26
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
height:
1.5
,
),
),
],
),
),
SizedBox
(
height:
20
.
h
),
GestureDetector
(
onTap:
()
{
Navigator
.
of
(
dialogContext
).
pop
();
_handleAlert
(
context
);
},
child:
Container
(
width:
double
.
infinity
,
height:
72
.
h
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
12
.
r
),
),
child:
Center
(
child:
Text
(
'确认'
,
style:
TextStyle
(
fontSize:
28
.
sp
,
color:
Colors
.
white
,
),
),
),
),
),
],
),
),
);
},
);
}
Future
<
void
>
_handleAlert
(
BuildContext
context
)
async
{
try
{
final
service
=
alertDetailService
??
AlertDetailService
(
repository:
AlertDetailRepository
());
await
service
.
handleAlert
(
alertId:
alertId
);
if
(
context
.
mounted
)
{
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
const
SnackBar
(
content:
Text
(
'操作成功'
)),
);
}
}
catch
(
e
)
{
if
(
context
.
mounted
)
{
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
(
'操作失败:
$e
'
)),
);
}
}
}
}
}
\ No newline at end of file
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