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
59e6cf59
Commit
59e6cf59
authored
Jun 17, 2026
by
huqu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs
parent
1244f87e
Hide whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
1111 additions
and
1015 deletions
+1111
-1015
room_bo.dart
lib/models/bo/room_bo.dart
+4
-4
inspection_device_service.dart
lib/services/inspection_device_service.dart
+21
-0
abnormal_detail_view.dart
lib/views/home/abnormal/abnormal_detail_view.dart
+2
-2
index_view.dart
lib/views/home/abnormal_list/index_view.dart
+13
-0
device_detail_view.dart
lib/views/home/device/device_detail_view.dart
+3
-3
home_index_cubit.dart
lib/views/home/index/cubit/home_index_cubit.dart
+25
-2
home_index_state.dart
lib/views/home/index/cubit/home_index_state.dart
+9
-2
equipment_list_block.dart
lib/views/home/index/widget/equipment_list_block.dart
+24
-18
task_head_block.dart
lib/views/home/index/widget/task_head_block.dart
+31
-10
temperature_block.dart
lib/views/home/index/widget/temperature_block.dart
+71
-79
voltage_operate_block.dart
lib/views/home/index/widget/voltage_operate_block.dart
+26
-36
inspection_detail_view.dart
lib/views/home/inspection/inspection_detail_view.dart
+1
-1
device_list.dart
lib/views/home/inspection/widget/device_list.dart
+13
-0
inspection_device_view.dart
lib/views/home/inspection_device/inspection_device_view.dart
+8
-14
inspection_history_card.dart
...ome/inspection_device/widget/inspection_history_card.dart
+28
-19
inspection_items_card.dart
.../home/inspection_device/widget/inspection_items_card.dart
+5
-6
start_inspection_button.dart
...ome/inspection_device/widget/start_inspection_button.dart
+7
-8
inspection_history_view.dart
...iews/home/inspection_history/inspection_history_view.dart
+14
-3
inspection_record_item.dart
...ome/inspection_history/widget/inspection_record_item.dart
+113
-101
statistics_card.dart
...views/home/inspection_history/widget/statistics_card.dart
+5
-5
inspection_topology_view.dart
...ws/home/inspection_topology/inspection_topology_view.dart
+1
-1
btn_login.dart
lib/views/login/widget/btn_login.dart
+1
-1
profile_header_block.dart
lib/views/profile/index/widget/profile_header_block.dart
+2
-2
device_list_view.dart
lib/views/report/device/device_list_view.dart
+13
-0
energy_detail_view.dart
lib/views/report/energy/energy_detail_view.dart
+1
-1
index_view.dart
lib/views/report/index/index_view.dart
+11
-24
report_header_block.dart
lib/views/report/index/widget/report_header_block.dart
+30
-13
room_detail_view.dart
lib/views/report/room/room_detail_view.dart
+2
-2
device_detail_view.dart
lib/views/service/device/device_detail_view.dart
+33
-28
mode_selection_block.dart
lib/views/service/device/widget/mode_selection_block.dart
+1
-1
temperature_control_block.dart
...iews/service/device/widget/temperature_control_block.dart
+47
-95
wind_speed_block.dart
lib/views/service/device/widget/wind_speed_block.dart
+1
-1
service_index_cubit.dart
lib/views/service/index/cubit/service_index_cubit.dart
+110
-15
service_index_state.dart
lib/views/service/index/cubit/service_index_state.dart
+16
-10
index_view.dart
lib/views/service/index/index_view.dart
+1
-1
area_device_list.dart
lib/views/service/index/widget/area_device_list.dart
+1
-1
room_management_block.dart
lib/views/service/index/widget/room_management_block.dart
+275
-314
service_head_block.dart
lib/views/service/index/widget/service_head_block.dart
+15
-10
service_stats_block.dart
lib/views/service/index/widget/service_stats_block.dart
+22
-47
room_detail_view.dart
lib/views/service/room/room_detail_view.dart
+2
-2
device_control_card.dart
lib/views/service/room/widget/device_control_card.dart
+41
-62
room_bottom_buttons.dart
lib/views/service/room/widget/room_bottom_buttons.dart
+37
-38
room_device_status_card.dart
lib/views/service/room/widget/room_device_status_card.dart
+6
-5
room_overview_card.dart
lib/views/service/room/widget/room_overview_card.dart
+19
-28
No files found.
lib/models/bo/room_bo.dart
View file @
59e6cf59
...
...
@@ -341,10 +341,10 @@ class AreaDeviceBO extends Equatable {
class
RoomStatusBO
extends
Equatable
{
final
int
roomId
;
final
String
roomNumber
;
final
String
occupancyStatus
;
final
String
roomStatus
;
final
String
cleanStatus
;
final
String
devicePowerStatus
;
final
String
occupancyStatus
;
//房间有无人状态,0=无人 1=有人
final
String
roomStatus
;
//房间状态,0=无人 1=有人
final
String
cleanStatus
;
//清洁灯状态,0=待清洁 2=已完成
final
String
devicePowerStatus
;
//设备开关状态 0=关 1=开
const
RoomStatusBO
({
required
this
.
roomId
,
...
...
lib/services/inspection_device_service.dart
View file @
59e6cf59
import
'dart:convert'
;
import
'../repositories/inspection_device_repository.dart'
;
import
'../models/bo/inspection_device_bo.dart'
;
...
...
@@ -37,9 +39,28 @@ class InspectionDeviceService {
required
int
deviceId
,
required
int
inspectorId
,
})
async
{
List
<
Map
<
String
,
dynamic
>>
list
=
[
{
'name'
:
'检查输入电压是否正常'
,
'value'
:
'正常'
,
'status'
:
2
,
},
{
'name'
:
'确认设备是否正常运行'
,
'value'
:
'正常'
,
'status'
:
2
,
},
{
'name'
:
'若异常,请联系电工'
,
'value'
:
'正常'
,
'status'
:
2
,
},
];
final
result
=
await
_repository
.
startInspection
({
'deviceId'
:
deviceId
,
'inspectorId'
:
inspectorId
,
'remark'
:
'巡检完成'
,
//后端要先写死
'items_detail'
:
jsonEncode
(
list
),
//后端要先写死
});
if
(
result
.
success
&&
result
.
data
!=
null
)
{
return
result
.
data
!;
...
...
lib/views/home/abnormal/abnormal_detail_view.dart
View file @
59e6cf59
...
...
@@ -52,7 +52,7 @@ class AbnormalDetailView extends StatelessWidget {
body:
BlocBuilder
<
AbnormalCubit
,
AbnormalState
>(
builder:
(
context
,
state
)
{
if
(
state
.
isLoading
)
{
return
const
Center
(
child:
CircularProgressIndicator
());
return
const
Center
(
child:
CircularProgressIndicator
(
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
)
));
}
if
(
state
.
error
!=
null
)
{
return
Center
(
...
...
@@ -121,7 +121,7 @@ class AbnormalDetailView extends StatelessWidget {
height:
32
.
sp
,
child:
const
CircularProgressIndicator
(
strokeWidth:
3
,
color:
Color
.
fromRGBO
(
237
,
245
,
255
,
1
),
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
),
)
:
Text
(
...
...
lib/views/home/abnormal_list/index_view.dart
View file @
59e6cf59
...
...
@@ -111,6 +111,19 @@ class _AbnormalListBodyState extends State<_AbnormalListBody> {
state:
pagingState
,
fetchNextPage:
fetchNextPage
,
builderDelegate:
PagedChildBuilderDelegate
<
AlarmItem
>(
firstPageProgressIndicatorBuilder:
(
_
)
=>
const
Center
(
child:
CircularProgressIndicator
(
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
),
),
newPageProgressIndicatorBuilder:
(
_
)
=>
const
Center
(
child:
Padding
(
padding:
EdgeInsets
.
all
(
16
),
child:
CircularProgressIndicator
(
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
),
),
),
firstPageErrorIndicatorBuilder:
(
_
)
=>
Center
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
...
...
lib/views/home/device/device_detail_view.dart
View file @
59e6cf59
...
...
@@ -52,7 +52,7 @@ class DeviceDetailView extends StatelessWidget {
body:
BlocBuilder
<
DeviceCubit
,
DeviceState
>(
builder:
(
context
,
state
)
{
if
(
state
.
isLoading
)
{
return
const
Center
(
child:
CircularProgressIndicator
());
return
const
Center
(
child:
CircularProgressIndicator
(
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
)
));
}
if
(
state
.
error
!=
null
)
{
return
Center
(
...
...
@@ -120,7 +120,7 @@ class DeviceDetailView extends StatelessWidget {
height:
32
.
sp
,
child:
const
CircularProgressIndicator
(
strokeWidth:
3
,
color:
Color
.
fromRGBO
(
237
,
245
,
255
,
1
),
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
),
)
:
Text
(
...
...
@@ -157,7 +157,7 @@ class DeviceDetailView extends StatelessWidget {
height:
32
.
sp
,
child:
const
CircularProgressIndicator
(
strokeWidth:
3
,
color:
Color
.
fromRGBO
(
100
,
116
,
139
,
1
),
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
),
)
:
Text
(
...
...
lib/views/home/index/cubit/home_index_cubit.dart
View file @
59e6cf59
...
...
@@ -2,17 +2,26 @@ import 'package:flutter/material.dart';
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:smart_hotel_app/models/bo/alert_dashboard_bo.dart'
;
import
'package:smart_hotel_app/repositories/alert_dashboard_repository.dart'
;
import
'package:smart_hotel_app/repositories/alert_detail_repository.dart'
;
import
'package:smart_hotel_app/services/alert_dashboard_service.dart'
;
import
'package:smart_hotel_app/services/alert_detail_service.dart'
;
import
'package:smart_hotel_app/views/home/index/cubit/home_index_state.dart'
;
class
HomeIndexCubit
extends
Cubit
<
HomeIndexState
>
{
final
AlertDashboardService
_service
;
final
AlertDetailService
_alertDetailService
;
HomeIndexCubit
({
AlertDashboardService
?
service
})
:
_service
=
service
??
HomeIndexCubit
({
AlertDashboardService
?
service
,
AlertDetailService
?
alertDetailService
,
})
:
_service
=
service
??
AlertDashboardService
(
repository:
AlertDashboardRepository
(),
),
_alertDetailService
=
alertDetailService
??
AlertDetailService
(
repository:
AlertDetailRepository
(),
),
super
(
const
HomeIndexState
())
{
loadDashboard
();
}
...
...
@@ -31,6 +40,20 @@ class HomeIndexCubit extends Cubit<HomeIndexState> {
loadDashboard
();
}
/// 处理告警
Future
<
void
>
handleAlert
(
int
alertId
)
async
{
if
(
state
.
isHandlingAlert
)
return
;
emit
(
state
.
copyWith
(
isHandlingAlert:
true
));
try
{
await
_alertDetailService
.
handleAlert
(
alertId:
alertId
);
emit
(
state
.
copyWith
(
isHandlingAlert:
false
));
await
reloadDashboard
();
}
catch
(
e
)
{
emit
(
state
.
copyWith
(
isHandlingAlert:
false
,
error:
e
.
toString
()));
rethrow
;
}
}
void
_emitFromDashboard
(
AlertDashboardBO
dashboard
)
{
emit
(
state
.
copyWith
(
isLoading:
false
,
...
...
lib/views/home/index/cubit/home_index_state.dart
View file @
59e6cf59
...
...
@@ -19,7 +19,10 @@ class EquipmentItem {
}
class
HomeIndexState
extends
Equatable
{
static
const
_nothing
=
Object
();
final
bool
isLoading
;
final
bool
isHandlingAlert
;
final
String
?
error
;
final
int
highAlarmCount
;
final
int
mediumAlarmCount
;
...
...
@@ -29,6 +32,7 @@ class HomeIndexState extends Equatable {
const
HomeIndexState
({
this
.
isLoading
=
false
,
this
.
isHandlingAlert
=
false
,
this
.
error
,
this
.
highAlarmCount
=
0
,
this
.
mediumAlarmCount
=
0
,
...
...
@@ -39,7 +43,8 @@ class HomeIndexState extends Equatable {
HomeIndexState
copyWith
({
bool
?
isLoading
,
String
?
error
,
bool
?
isHandlingAlert
,
Object
?
error
=
_nothing
,
int
?
highAlarmCount
,
int
?
mediumAlarmCount
,
int
?
onlineDeviceCount
,
...
...
@@ -48,7 +53,8 @@ class HomeIndexState extends Equatable {
})
{
return
HomeIndexState
(
isLoading:
isLoading
??
this
.
isLoading
,
error:
error
,
isHandlingAlert:
isHandlingAlert
??
this
.
isHandlingAlert
,
error:
identical
(
error
,
_nothing
)
?
this
.
error
:
error
as
String
?,
highAlarmCount:
highAlarmCount
??
this
.
highAlarmCount
,
mediumAlarmCount:
mediumAlarmCount
??
this
.
mediumAlarmCount
,
onlineDeviceCount:
onlineDeviceCount
??
this
.
onlineDeviceCount
,
...
...
@@ -60,6 +66,7 @@ class HomeIndexState extends Equatable {
@override
List
<
Object
?>
get
props
=>
[
isLoading
,
isHandlingAlert
,
error
,
highAlarmCount
,
mediumAlarmCount
,
...
...
lib/views/home/index/widget/equipment_list_block.dart
View file @
59e6cf59
...
...
@@ -12,30 +12,30 @@ class EquipmentListBlock extends StatelessWidget {
required
this
.
equipmentList
,
});
Widget
_buildEquipmentItem
(
EquipmentItem
item
)
{
Widget
_buildEquipmentItem
(
EquipmentItem
item
,
bool
isLast
)
{
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
16
.
h
),
decoration:
BoxDecoration
(
border:
Border
(
border:
!
isLast
?
Border
(
bottom:
BorderSide
(
color:
const
Color
.
fromRGBO
(
235
,
235
,
235
,
1.0
),
width:
1
.
w
,
width:
1
.
h
,
),
),
)
:
null
,
),
child:
Row
(
children:
[
Container
(
width:
64
.
w
,
height:
66
.
h
,
height:
53
.
h
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
2
35
,
244
,
255
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
12
.
r
),
border:
Border
.
all
(
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
width:
2
.
w
,
style:
BorderStyle
.
solid
,
),
color:
const
Color
.
fromRGBO
(
2
29
,
241
,
255
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
8
.
r
),
//
border: Border.all(
//
color: const Color.fromRGBO(66, 165, 245, 1.0),
//
width: 2.w,
//
style: BorderStyle.solid,
//
),
),
child:
Icon
(
item
.
icon
,
...
...
@@ -47,6 +47,7 @@ class EquipmentListBlock extends StatelessWidget {
Expanded
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
spacing:
5
.
h
,
children:
[
Transform
.
translate
(
offset:
Offset
(
0
,
2
.
h
),
...
...
@@ -59,7 +60,6 @@ class EquipmentListBlock extends StatelessWidget {
),
),
),
SizedBox
(
height:
4
.
h
),
Text
(
item
.
subtitle
,
style:
TextStyle
(
...
...
@@ -85,11 +85,12 @@ class EquipmentListBlock extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
return
SizedBox
(
width:
double
.
infinity
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
min
,
spacing:
12
.
h
,
children:
[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
...
...
@@ -111,21 +112,20 @@ class EquipmentListBlock extends StatelessWidget {
Text
(
'查看全部'
,
style:
TextStyle
(
fontSize:
2
4
.
sp
,
fontSize:
2
8
.
sp
,
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
),
),
Icon
(
Icons
.
chevron_right
,
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
size:
24
.
sp
,
size:
30
.
sp
,
),
],
),
),
],
),
SizedBox
(
height:
12
.
h
),
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
...
...
@@ -133,7 +133,13 @@ class EquipmentListBlock extends StatelessWidget {
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
20
.
w
),
child:
Column
(
children:
equipmentList
.
take
(
5
).
map
((
item
)
=>
_buildEquipmentItem
(
item
)).
toList
(),
// children: equipmentList.take(5).map((item) => _buildEquipmentItem(item)).toList(),
children:
equipmentList
.
take
(
5
).
toList
().
asMap
().
entries
.
map
((
entry
)
{
int
index
=
entry
.
key
;
var
item
=
entry
.
value
;
bool
isLast
=
index
==
equipmentList
.
take
(
5
).
length
-
1
;
return
_buildEquipmentItem
(
item
,
isLast
);
}).
toList
(),
),
),
],
...
...
lib/views/home/index/widget/task_head_block.dart
View file @
59e6cf59
...
...
@@ -6,17 +6,37 @@ class TaskHeadBlock extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
width:
double
.
infinity
,
padding:
EdgeInsets
.
only
(
top:
ScreenUtil
().
statusBarHeight
),
child:
Text
(
'设备告警看板'
,
style:
TextStyle
(
fontSize:
28
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
const
Color
.
fromRGBO
(
51
,
51
,
51
,
1.0
),
return
Stack
(
clipBehavior:
Clip
.
none
,
children:
[
Positioned
(
left:
-
28
.
w
,
right:
-
28
.
w
,
top:
0
,
child:
Container
(
height:
150
.
h
,
color:
Colors
.
white
,
),
),
),
Container
(
height:
150
.
h
,
padding:
EdgeInsets
.
only
(
top:
ScreenUtil
().
statusBarHeight
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Text
(
'设备告警看板'
,
style:
TextStyle
(
fontSize:
32
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
const
Color
.
fromRGBO
(
0
,
0
,
0
,
1
),
),
),
],
),
),
],
);
}
}
\ No newline at end of file
lib/views/home/index/widget/temperature_block.dart
View file @
59e6cf59
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:smart_hotel_app/repositories/alert_detail_repository.dart'
;
import
'package:smart_hotel_app/services/alert_detail_service.dart'
;
import
'package:smart_hotel_app/views/home/index/cubit/home_index_cubit.dart'
;
import
'package:smart_hotel_app/utils/toast_utils.dart'
;
...
...
@@ -15,7 +13,6 @@ class TemperatureBlock extends StatelessWidget {
final
String
currentCurrent
;
final
String
waitTime
;
final
String
alarmLevel
;
final
AlertDetailService
?
alertDetailService
;
const
TemperatureBlock
({
super
.
key
,
...
...
@@ -27,7 +24,6 @@ class TemperatureBlock extends StatelessWidget {
required
this
.
currentCurrent
,
required
this
.
waitTime
,
required
this
.
alarmLevel
,
this
.
alertDetailService
,
});
@override
...
...
@@ -49,7 +45,7 @@ class TemperatureBlock extends StatelessWidget {
children:
[
Container
(
width:
66
.
w
,
height:
68
.
h
,
height:
54
.
h
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
235
,
244
,
255
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
12
.
r
),
...
...
@@ -57,13 +53,14 @@ class TemperatureBlock extends StatelessWidget {
child:
Icon
(
Icons
.
thermostat_outlined
,
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
size:
32
.
sp
,
size:
40
.
sp
,
),
),
SizedBox
(
width:
16
.
w
),
Expanded
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
spacing:
5
.
h
,
children:
[
Text
(
temperatureAlarmTitle
,
...
...
@@ -73,7 +70,6 @@ class TemperatureBlock extends StatelessWidget {
color:
const
Color
.
fromRGBO
(
0
,
0
,
0
,
1.0
),
),
),
SizedBox
(
height:
4
.
h
),
Text
(
temperatureAlarmLocation
,
style:
TextStyle
(
...
...
@@ -88,7 +84,9 @@ class TemperatureBlock extends StatelessWidget {
alarmLevel
,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
alarmLevel
==
"置顶"
?
const
Color
.
fromRGBO
(
255
,
100
,
101
,
1.0
)
:
const
Color
.
fromRGBO
(
255
,
204
,
21
,
1.0
),
color:
alarmLevel
==
"置顶"
?
const
Color
.
fromRGBO
(
255
,
100
,
101
,
1.0
)
:
const
Color
.
fromRGBO
(
255
,
204
,
21
,
1.0
),
),
),
],
...
...
@@ -99,7 +97,7 @@ class TemperatureBlock extends StatelessWidget {
padding:
EdgeInsets
.
symmetric
(
vertical:
20
.
h
),
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
235
,
244
,
255
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
16
.
r
),
borderRadius:
BorderRadius
.
circular
(
20
.
r
),
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceAround
,
...
...
@@ -109,7 +107,7 @@ class TemperatureBlock extends StatelessWidget {
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Text
(
'
$currentTemperature
'
,
currentTemperature
,
style:
TextStyle
(
fontSize:
40
.
sp
,
fontWeight:
FontWeight
.
bold
,
...
...
@@ -120,7 +118,7 @@ class TemperatureBlock extends StatelessWidget {
Text
(
'当前温度'
,
style:
TextStyle
(
fontSize:
2
0
.
sp
,
fontSize:
2
4
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
),
),
...
...
@@ -132,7 +130,7 @@ class TemperatureBlock extends StatelessWidget {
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Text
(
'
${currentVoltage}
'
,
currentVoltage
,
style:
TextStyle
(
fontSize:
40
.
sp
,
fontWeight:
FontWeight
.
bold
,
...
...
@@ -143,7 +141,7 @@ class TemperatureBlock extends StatelessWidget {
Text
(
'电压'
,
style:
TextStyle
(
fontSize:
2
0
.
sp
,
fontSize:
2
4
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
),
),
...
...
@@ -155,7 +153,7 @@ class TemperatureBlock extends StatelessWidget {
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Text
(
'
${currentCurrent}
'
,
currentCurrent
,
style:
TextStyle
(
fontSize:
40
.
sp
,
fontWeight:
FontWeight
.
bold
,
...
...
@@ -166,7 +164,7 @@ class TemperatureBlock extends StatelessWidget {
Text
(
'电流'
,
style:
TextStyle
(
fontSize:
2
0
.
sp
,
fontSize:
2
4
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
),
),
...
...
@@ -189,20 +187,20 @@ class TemperatureBlock extends StatelessWidget {
),
SizedBox
(
width:
8
.
w
),
Text
(
'已等待
$waitTime
·'
,
waitTime
,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
),
),
Text
(
alarmLevel
,
style:
TextStyle
(
fontSize:
24
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
const
Color
.
fromRGBO
(
255
,
77
,
79
,
1.0
),
),
),
//
Text(
//
alarmLevel,
//
style: TextStyle(
//
fontSize: 24.sp,
//
fontWeight: FontWeight.bold,
//
color: const Color.fromRGBO(255, 77, 79, 1.0),
//
),
//
),
],
),
GestureDetector
(
...
...
@@ -216,7 +214,7 @@ class TemperatureBlock extends StatelessWidget {
child:
Text
(
'立即处理'
,
style:
TextStyle
(
fontSize:
2
4
.
sp
,
fontSize:
2
8
.
sp
,
color:
Colors
.
white
,
),
),
...
...
@@ -239,7 +237,6 @@ class TemperatureBlock extends StatelessWidget {
borderRadius:
BorderRadius
.
circular
(
16
.
r
),
),
child:
Container
(
padding:
EdgeInsets
.
all
(
24
.
w
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
16
.
r
),
...
...
@@ -248,33 +245,42 @@ class TemperatureBlock extends StatelessWidget {
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
mainAxisAlignment:
MainAxisAlignment
.
end
,
children:
[
Text
(
temperatureAlarmTitle
,
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
,
),
onTap:
()
=>
Navigator
.
of
(
dialogContext
).
pop
(),
child:
Container
(
margin:
EdgeInsets
.
only
(
top:
20
.
h
,
right:
20
.
h
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
2
.
w
,
vertical:
2
.
h
),
decoration:
BoxDecoration
(
shape:
BoxShape
.
circle
,
border:
Border
.
all
(
width:
2
.
w
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
),
),
child:
Icon
(
Icons
.
close
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
size:
32
.
sp
,
),
)
),
],
),
SizedBox
(
height:
16
.
h
),
Text
(
temperatureAlarmTitle
,
style:
TextStyle
(
fontSize:
30
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
Colors
.
black
,
),
),
SizedBox
(
height:
20
.
h
),
Container
(
width:
double
.
infinity
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
20
.
w
,
vertical:
20
.
h
,
),
margin:
EdgeInsets
.
symmetric
(
horizontal:
40
.
w
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
30
.
w
,
vertical:
30
.
h
),
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
242
,
243
,
245
,
1
),
borderRadius:
BorderRadius
.
circular
(
12
.
r
),
...
...
@@ -302,26 +308,29 @@ class TemperatureBlock extends StatelessWidget {
],
),
),
SizedBox
(
height:
20
.
h
),
GestureDetector
(
onTap:
()
{
behavior:
HitTestBehavior
.
opaque
,
onTap:
()
async
{
Navigator
.
of
(
dialogContext
).
pop
();
_handleAlert
(
context
);
try
{
await
context
.
read
<
HomeIndexCubit
>().
handleAlert
(
alertId
);
if
(
context
.
mounted
)
{
showToast
(
'操作成功'
);
}
}
catch
(
e
)
{
if
(
context
.
mounted
)
{
showToast
(
'操作失败:
$e
'
);
}
}
},
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
,
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
30
.
w
,
vertical:
30
.
h
),
child:
Text
(
'确认'
,
style:
TextStyle
(
fontSize:
28
.
sp
,
color:
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1.0
),
fontWeight:
FontWeight
.
bold
,
),
),
),
...
...
@@ -333,20 +342,4 @@ class TemperatureBlock extends StatelessWidget {
},
);
}
Future
<
void
>
_handleAlert
(
BuildContext
context
)
async
{
try
{
final
service
=
alertDetailService
??
AlertDetailService
(
repository:
AlertDetailRepository
());
await
service
.
handleAlert
(
alertId:
alertId
);
if
(
context
.
mounted
)
{
showToast
(
'操作成功'
);
context
.
read
<
HomeIndexCubit
>().
reloadDashboard
();
}
}
catch
(
e
)
{
if
(
context
.
mounted
)
{
showToast
(
'操作失败:
$e
'
);
}
}
}
}
\ No newline at end of file
lib/views/home/index/widget/voltage_operate_block.dart
View file @
59e6cf59
...
...
@@ -2,9 +2,7 @@ import 'package:auto_route/auto_route.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.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/services/alert_detail_service.dart'
;
import
'package:smart_hotel_app/views/home/abnormal_list/cubit/abnormal_list_state.dart'
;
import
'package:smart_hotel_app/views/home/index/cubit/home_index_cubit.dart'
;
import
'package:smart_hotel_app/utils/toast_utils.dart'
;
...
...
@@ -17,7 +15,6 @@ class VoltageOperateBlock extends StatelessWidget {
final
String
normalVoltage
;
final
String
voltageWaitTime
;
final
String
voltageAlarmLevel
;
final
AlertDetailService
?
alertDetailService
;
const
VoltageOperateBlock
({
super
.
key
,
...
...
@@ -28,7 +25,6 @@ class VoltageOperateBlock extends StatelessWidget {
required
this
.
normalVoltage
,
required
this
.
voltageWaitTime
,
required
this
.
voltageAlarmLevel
,
this
.
alertDetailService
,
});
@override
...
...
@@ -51,20 +47,20 @@ class VoltageOperateBlock extends StatelessWidget {
children:
[
Container
(
width:
64
.
w
,
height:
66
.
h
,
height:
54
.
h
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
235
,
244
,
255
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
12
.
r
),
border:
Border
.
all
(
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
width:
2
.
w
,
style:
BorderStyle
.
solid
,
),
//
border: Border.all(
//
color: const Color.fromRGBO(66, 165, 245, 1.0),
//
width: 2.w,
//
style: BorderStyle.solid,
//
),
),
child:
Icon
(
Icons
.
thermostat_outlined
,
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
size:
32
.
sp
,
size:
40
.
sp
,
),
),
SizedBox
(
width:
16
.
w
),
...
...
@@ -95,7 +91,9 @@ class VoltageOperateBlock extends StatelessWidget {
voltageAlarmLevel
,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
voltageAlarmLevel
==
"置顶"
?
const
Color
.
fromRGBO
(
255
,
100
,
101
,
1.0
)
:
const
Color
.
fromRGBO
(
255
,
204
,
21
,
1.0
),
color:
voltageAlarmLevel
==
"置顶"
?
const
Color
.
fromRGBO
(
255
,
100
,
101
,
1.0
)
:
const
Color
.
fromRGBO
(
255
,
204
,
21
,
1.0
),
),
),
],
...
...
@@ -105,22 +103,23 @@ class VoltageOperateBlock extends StatelessWidget {
width:
double
.
infinity
,
margin:
EdgeInsets
.
only
(
left:
80
.
w
,
bottom:
20
.
h
),
child:
Text
(
'电压
${voltageValue}
V (正常≤
${normalVoltage}
V)·
已等待
$voltageWaitTime
'
,
'电压
${voltageValue}
V (正常≤
${normalVoltage}
V)·
$voltageWaitTime
'
,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
),
),
),
Container
(
SizedBox
(
width:
double
.
infinity
,
child:
Row
(
spacing:
20
.
w
,
children:
[
Expanded
(
child:
GestureDetector
(
onTap:
()
=>
_showHandleDialog
(
context
),
child:
Container
(
height:
88
.
h
,
padding:
EdgeInsets
.
symmetric
(
vertical:
20
.
h
)
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
16
.
r
),
...
...
@@ -137,14 +136,13 @@ class VoltageOperateBlock extends StatelessWidget {
),
),
),
SizedBox
(
width:
20
.
w
),
Expanded
(
child:
GestureDetector
(
onTap:
()
{
context
.
pushRoute
(
AbnormalDetailRoute
(
alertId:
alertId
,
alarmStatus:
AlarmStatus
.
pending
));
},
child:
Container
(
height:
88
.
h
,
padding:
EdgeInsets
.
symmetric
(
vertical:
20
.
h
)
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
235
,
244
,
255
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
16
.
r
),
...
...
@@ -244,9 +242,18 @@ class VoltageOperateBlock extends StatelessWidget {
),
SizedBox
(
height:
20
.
h
),
GestureDetector
(
onTap:
()
{
onTap:
()
async
{
Navigator
.
of
(
dialogContext
).
pop
();
_handleAlert
(
context
);
try
{
await
context
.
read
<
HomeIndexCubit
>().
handleAlert
(
alertId
);
if
(
context
.
mounted
)
{
showToast
(
'操作成功'
);
}
}
catch
(
e
)
{
if
(
context
.
mounted
)
{
showToast
(
'操作失败:
$e
'
);
}
}
},
child:
Container
(
width:
double
.
infinity
,
...
...
@@ -273,20 +280,4 @@ class VoltageOperateBlock extends StatelessWidget {
},
);
}
Future
<
void
>
_handleAlert
(
BuildContext
context
)
async
{
try
{
final
service
=
alertDetailService
??
AlertDetailService
(
repository:
AlertDetailRepository
());
await
service
.
handleAlert
(
alertId:
alertId
);
if
(
context
.
mounted
)
{
showToast
(
'操作成功'
);
context
.
read
<
HomeIndexCubit
>().
reloadDashboard
();
}
}
catch
(
e
)
{
if
(
context
.
mounted
)
{
showToast
(
'操作失败:
$e
'
);
}
}
}
}
\ No newline at end of file
lib/views/home/inspection/inspection_detail_view.dart
View file @
59e6cf59
...
...
@@ -86,7 +86,7 @@ class _InspectionDetailBodyState extends State<_InspectionDetailBody> {
return
Scaffold
(
backgroundColor:
const
Color
.
fromRGBO
(
242
,
243
,
245
,
1
),
appBar:
_buildAppBar
(
context
),
body:
const
Center
(
child:
CircularProgressIndicator
()),
body:
const
Center
(
child:
CircularProgressIndicator
(
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
)
)),
);
}
...
...
lib/views/home/inspection/widget/device_list.dart
View file @
59e6cf59
...
...
@@ -24,6 +24,19 @@ class DeviceList extends StatelessWidget {
state:
pagingState
,
fetchNextPage:
fetchNextPage
,
builderDelegate:
PagedChildBuilderDelegate
<
InspectionDevice
>(
firstPageProgressIndicatorBuilder:
(
_
)
=>
const
Center
(
child:
CircularProgressIndicator
(
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
),
),
newPageProgressIndicatorBuilder:
(
_
)
=>
const
Center
(
child:
Padding
(
padding:
EdgeInsets
.
all
(
16
),
child:
CircularProgressIndicator
(
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
),
),
),
firstPageErrorIndicatorBuilder:
(
_
)
=>
Center
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
...
...
lib/views/home/inspection_device/inspection_device_view.dart
View file @
59e6cf59
...
...
@@ -87,7 +87,6 @@ class InspectionDeviceView extends StatelessWidget {
),
],
if
(
state
.
inspectionItems
.
isNotEmpty
)
...[
SizedBox
(
height:
20
.
h
),
InspectionItemsCard
(
items:
state
.
inspectionItems
,
),
...
...
@@ -104,22 +103,17 @@ class InspectionDeviceView extends StatelessWidget {
child:
Container
(
width:
double
.
infinity
,
height:
88
.
h
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
Colors
.
white
,
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
)
,
borderRadius:
BorderRadius
.
circular
(
24
.
r
),
border:
Border
.
all
(
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
width:
2
.
w
,
),
),
child:
Center
(
child:
Text
(
'巡检记录'
,
style:
TextStyle
(
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
fontSize:
32
.
sp
,
fontWeight:
FontWeight
.
bold
,
),
child:
Text
(
'巡检记录'
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
32
.
sp
,
fontWeight:
FontWeight
.
bold
,
),
),
),
...
...
lib/views/home/inspection_device/widget/inspection_history_card.dart
View file @
59e6cf59
...
...
@@ -45,25 +45,36 @@ class InspectionHistoryCard extends StatelessWidget {
children:
[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Row
(
spacing:
12
.
w
,
children:
[
Container
(
width:
60
.
w
,
height:
60
.
h
,
width:
80
.
w
,
height:
64
.
h
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
2
42
,
243
,
24
5
,
1.0
),
color:
const
Color
.
fromRGBO
(
2
29
,
241
,
25
5
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
8
.
r
),
),
child:
Icon
(
Icons
.
person
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
size:
32
.
sp
,
child:
Container
(
width:
44
.
w
,
height:
44
.
h
,
decoration:
const
BoxDecoration
(
color:
Color
.
fromRGBO
(
73
,
149
,
234
,
1
),
shape:
BoxShape
.
circle
,
),
child:
Icon
(
Icons
.
person
,
color:
Colors
.
white
,
size:
40
.
sp
,
),
),
),
SizedBox
(
width:
12
.
w
),
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
spacing:
4
.
h
,
children:
[
Text
(
item
.
inspectorName
,
...
...
@@ -73,19 +84,18 @@ class InspectionHistoryCard extends StatelessWidget {
color:
const
Color
.
fromRGBO
(
10
,
13
,
20
,
1.0
),
),
),
SizedBox
(
height:
4
.
h
),
Row
(
children:
[
Icon
(
Icons
.
access_time
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
size:
2
0
.
sp
,
size:
2
4
.
sp
,
),
SizedBox
(
width:
4
.
w
),
Text
(
item
.
inspectionTime
,
style:
TextStyle
(
fontSize:
2
2
.
sp
,
fontSize:
2
4
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
),
),
...
...
@@ -96,23 +106,23 @@ class InspectionHistoryCard extends StatelessWidget {
],
),
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
16
.
w
,
vertical:
6
.
h
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
16
.
w
,
vertical:
4
.
h
),
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
225
,
245
,
238
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
1
0
.
r
),
borderRadius:
BorderRadius
.
circular
(
4
0
.
r
),
),
child:
Row
(
children:
[
Icon
(
Icons
.
check
,
color:
const
Color
.
fromRGBO
(
26
,
188
,
156
,
1.0
),
size:
2
0
.
sp
,
size:
2
4
.
sp
,
),
SizedBox
(
width:
4
.
w
),
Text
(
item
.
result
,
style:
TextStyle
(
fontSize:
2
2
.
sp
,
fontSize:
2
4
.
sp
,
color:
const
Color
.
fromRGBO
(
26
,
188
,
156
,
1.0
),
fontWeight:
FontWeight
.
bold
,
),
...
...
@@ -122,10 +132,10 @@ class InspectionHistoryCard extends StatelessWidget {
),
],
),
SizedBox
(
height:
16
.
h
),
SizedBox
(
height:
20
.
h
),
Container
(
width:
double
.
infinity
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
16
.
w
,
vertical:
1
2
.
h
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
16
.
w
,
vertical:
1
6
.
h
),
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
242
,
243
,
245
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
12
.
r
),
...
...
@@ -133,12 +143,11 @@ class InspectionHistoryCard extends StatelessWidget {
child:
Text
(
item
.
remark
,
style:
TextStyle
(
fontSize:
2
2
.
sp
,
fontSize:
2
4
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
),
),
),
SizedBox
(
height:
20
.
h
),
],
);
}
...
...
lib/views/home/inspection_device/widget/inspection_items_card.dart
View file @
59e6cf59
...
...
@@ -28,8 +28,7 @@ class InspectionItemsCard extends StatelessWidget {
'巡检项目'
,
style:
TextStyle
(
fontSize:
26
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
const
Color
.
fromRGBO
(
10
,
13
,
20
,
1.0
),
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
),
),
SizedBox
(
height:
20
.
h
),
...
...
@@ -66,23 +65,23 @@ class InspectionItemsCard extends StatelessWidget {
),
SizedBox
(
width:
12
.
w
),
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
16
.
w
,
vertical:
6
.
h
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
16
.
w
,
vertical:
4
.
h
),
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
225
,
245
,
238
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
1
0
.
r
),
borderRadius:
BorderRadius
.
circular
(
4
0
.
r
),
),
child:
Row
(
children:
[
Icon
(
Icons
.
check
,
color:
const
Color
.
fromRGBO
(
26
,
188
,
156
,
1.0
),
size:
2
0
.
sp
,
size:
2
4
.
sp
,
),
SizedBox
(
width:
4
.
w
),
Text
(
item
.
result
,
style:
TextStyle
(
fontSize:
2
2
.
sp
,
fontSize:
2
4
.
sp
,
color:
const
Color
.
fromRGBO
(
26
,
188
,
156
,
1.0
),
fontWeight:
FontWeight
.
bold
,
),
...
...
lib/views/home/inspection_device/widget/start_inspection_button.dart
View file @
59e6cf59
...
...
@@ -83,18 +83,17 @@ class StartInspectionButton extends StatelessWidget {
child:
Container
(
width:
double
.
infinity
,
height:
88
.
h
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
24
.
r
),
),
child:
Center
(
child:
Text
(
'开始巡检'
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
32
.
sp
,
fontWeight:
FontWeight
.
bold
,
),
child:
Text
(
'开始巡检'
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
32
.
sp
,
fontWeight:
FontWeight
.
bold
,
),
),
),
...
...
lib/views/home/inspection_history/inspection_history_view.dart
View file @
59e6cf59
...
...
@@ -49,7 +49,6 @@ class _InspectionHistoryBodyState extends State<_InspectionHistoryBody> {
final
total
=
context
.
read
<
InspectionHistoryCubit
>().
state
.
totalCount
;
final
nextKey
=
state
.
nextIntPageKey
;
if
(
nextKey
==
null
)
return
null
;
if
((
nextKey
-
1
)
*
InspectionHistoryCubit
.
pageSize
>=
total
)
{
return
null
;
}
...
...
@@ -129,8 +128,7 @@ class _InspectionHistoryBodyState extends State<_InspectionHistoryBody> {
style:
TextStyle
(
fontSize:
28
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
const
Color
.
fromRGBO
(
10
,
13
,
20
,
1.0
),
color:
const
Color
.
fromRGBO
(
10
,
13
,
20
,
1.0
),
),
),
],
...
...
@@ -144,6 +142,19 @@ class _InspectionHistoryBodyState extends State<_InspectionHistoryBody> {
fetchNextPage:
fetchNextPage
,
builderDelegate:
PagedChildBuilderDelegate
<
InspectionRecord
>(
firstPageProgressIndicatorBuilder:
(
_
)
=>
const
Center
(
child:
CircularProgressIndicator
(
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
),
),
newPageProgressIndicatorBuilder:
(
_
)
=>
const
Center
(
child:
Padding
(
padding:
EdgeInsets
.
all
(
16
),
child:
CircularProgressIndicator
(
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
),
),
),
firstPageErrorIndicatorBuilder:
(
_
)
=>
Center
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
...
...
lib/views/home/inspection_history/widget/inspection_record_item.dart
View file @
59e6cf59
...
...
@@ -12,121 +12,132 @@ class InspectionRecordItem extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
final
resultColor
=
_getResultColor
(
record
.
result
);
return
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
.
r
),
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
2
0
.
w
,
vertical:
16
.
h
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
2
8
.
w
,
vertical:
28
.
h
),
margin:
EdgeInsets
.
only
(
bottom:
20
.
h
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Row
(
children:
[
Container
(
width:
60
.
w
,
height:
60
.
h
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
242
,
243
,
245
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
8
.
r
),
),
child:
Icon
(
record
.
icon
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
size:
32
.
sp
,
),
),
SizedBox
(
width:
12
.
w
),
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
Container
(
width:
80
.
w
,
height:
64
.
h
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
229
,
241
,
255
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
8
.
r
),
),
child:
Icon
(
record
.
icon
,
color:
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1.0
),
size:
32
.
sp
,
),
),
SizedBox
(
width:
20
.
w
),
Expanded
(
child:
Column
(
spacing:
10
.
h
,
children:
[
Text
(
record
.
deviceName
,
style:
TextStyle
(
fontSize:
26
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
const
Color
.
fromRGBO
(
10
,
13
,
20
,
1.0
),
),
),
SizedBox
(
height:
8
.
h
),
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Icon
(
Icons
.
person
,
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
size:
18
.
sp
,
),
SizedBox
(
width:
4
.
w
),
Text
(
record
.
inspector
Name
,
record
.
device
Name
,
style:
TextStyle
(
fontSize:
22
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
fontSize:
26
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
const
Color
.
fromRGBO
(
10
,
13
,
20
,
1.0
),
),
),
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
16
.
w
,
vertical:
4
.
h
),
decoration:
BoxDecoration
(
color:
resultColor
.
withValues
(
alpha:
0.1
),
borderRadius:
BorderRadius
.
circular
(
40
.
r
),
),
child:
Row
(
children:
[
Icon
(
_getResultIcon
(
record
.
result
),
color:
resultColor
,
size:
24
.
sp
,
),
SizedBox
(
width:
4
.
w
),
Text
(
record
.
result
,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
resultColor
,
fontWeight:
FontWeight
.
bold
,
),
),
],
),
),
],
),
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Row
(
spacing:
4
.
w
,
children:
[
Container
(
width:
24
.
w
,
height:
24
.
h
,
decoration:
const
BoxDecoration
(
color:
Color
.
fromRGBO
(
73
,
149
,
234
,
1
),
shape:
BoxShape
.
circle
,
),
child:
Icon
(
Icons
.
person
,
color:
Colors
.
white
,
size:
22
.
sp
,
),
),
Text
(
record
.
inspectorName
,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
),
),
],
),
Row
(
children:
[
Icon
(
Icons
.
access_time
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
size:
24
.
sp
,
),
SizedBox
(
width:
4
.
w
),
Text
(
record
.
inspectionTime
,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
),
),
],
),
],
)
],
),
],
),
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
16
.
w
,
vertical:
6
.
h
),
decoration:
BoxDecoration
(
color:
_getResultColor
(
record
.
result
).
withOpacity
(
0.1
),
borderRadius:
BorderRadius
.
circular
(
10
.
r
),
border:
Border
.
all
(
color:
_getResultColor
(
record
.
result
),
width:
1
.
w
,
),
),
child:
Row
(
children:
[
Icon
(
_getResultIcon
(
record
.
result
),
color:
_getResultColor
(
record
.
result
),
size:
18
.
sp
,
),
SizedBox
(
width:
4
.
w
),
Text
(
record
.
result
,
style:
TextStyle
(
fontSize:
22
.
sp
,
color:
_getResultColor
(
record
.
result
),
fontWeight:
FontWeight
.
bold
,
),
),
],
),
)
),
],
),
SizedBox
(
height:
12
.
h
),
Row
(
children:
[
Icon
(
Icons
.
access_time
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
size:
20
.
sp
,
),
SizedBox
(
width:
4
.
w
),
Text
(
record
.
inspectionTime
,
style:
TextStyle
(
fontSize:
22
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
),
),
],
),
SizedBox
(
height:
16
.
h
),
SizedBox
(
height:
20
.
h
),
Container
(
width:
double
.
infinity
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
16
.
w
,
vertical:
1
2
.
h
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
16
.
w
,
vertical:
1
6
.
h
),
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
242
,
243
,
245
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
12
.
r
),
...
...
@@ -134,23 +145,24 @@ class InspectionRecordItem extends StatelessWidget {
child:
Text
(
record
.
remark
,
style:
TextStyle
(
fontSize:
2
2
.
sp
,
fontSize:
2
4
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
),
),
),
SizedBox
(
height:
16
.
h
),
SizedBox
(
height:
20
.
h
),
Divider
(
color:
const
Color
.
fromRGBO
(
242
,
243
,
245
,
1.0
),
height:
1
.
h
,
thickness:
0.5
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
0.2
),
),
SizedBox
(
height:
16
.
h
),
SizedBox
(
height:
20
.
h
),
Text
(
'巡检项目'
,
style:
TextStyle
(
fontSize:
24
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
const
Color
.
fromRGBO
(
71
,
85
,
105
,
1.0
),
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
),
),
SizedBox
(
height:
12
.
h
),
...
...
@@ -182,27 +194,27 @@ class InspectionRecordItem extends StatelessWidget {
}
Widget
_buildItemTag
(
InspectionItemRecord
item
)
{
final
resultColor
=
_getResultColor
(
item
.
result
);
final
resultColor
=
_getResultColor
(
record
.
result
);
return
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
14
.
w
,
vertical:
8
.
h
),
decoration:
BoxDecoration
(
color:
Color
.
fromRGBO
(
209
,
250
,
229
,
1.0
),
// resultColor.withValues(alpha: 0.18
),
borderRadius:
BorderRadius
.
circular
(
18
.
r
),
color:
resultColor
.
withValues
(
alpha:
0.1
),
borderRadius:
BorderRadius
.
circular
(
40
.
r
),
),
child:
Row
(
mainAxisSize:
MainAxisSize
.
min
,
spacing:
6
.
w
,
children:
[
Icon
(
_getResultIcon
(
item
.
result
),
_getResultIcon
(
record
.
result
),
color:
resultColor
,
size:
18
.
sp
,
size:
24
.
sp
,
),
SizedBox
(
width:
6
.
w
),
Text
(
item
.
name
,
style:
TextStyle
(
fontSize:
2
2
.
sp
,
fontSize:
2
4
.
sp
,
color:
resultColor
,
),
),
...
...
lib/views/home/inspection_history/widget/statistics_card.dart
View file @
59e6cf59
...
...
@@ -26,10 +26,10 @@ class StatisticsCard extends StatelessWidget {
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceAround
,
children:
[
_buildStatItem
(
'总计'
,
totalCount
,
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
)),
_buildStatItem
(
'通过'
,
passCount
,
const
Color
.
fromRGBO
(
2
6
,
188
,
15
6
,
1.0
)),
_buildStatItem
(
'警告'
,
warningCount
,
const
Color
.
fromRGBO
(
2
47
,
184
,
75
,
1.0
)),
_buildStatItem
(
'不通过'
,
failCount
,
const
Color
.
fromRGBO
(
2
39
,
68
,
68
,
1.0
)),
_buildStatItem
(
'总计'
,
totalCount
,
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1.0
)),
_buildStatItem
(
'通过'
,
passCount
,
const
Color
.
fromRGBO
(
2
0
,
184
,
16
6
,
1.0
)),
_buildStatItem
(
'警告'
,
warningCount
,
const
Color
.
fromRGBO
(
2
50
,
204
,
21
,
1.0
)),
_buildStatItem
(
'不通过'
,
failCount
,
const
Color
.
fromRGBO
(
2
55
,
100
,
101
,
1.0
)),
],
),
);
...
...
@@ -37,6 +37,7 @@ class StatisticsCard extends StatelessWidget {
Widget
_buildStatItem
(
String
label
,
int
count
,
Color
color
)
{
return
Column
(
spacing:
5
.
h
,
children:
[
Text
(
count
.
toString
(),
...
...
@@ -46,7 +47,6 @@ class StatisticsCard extends StatelessWidget {
color:
color
,
),
),
SizedBox
(
height:
4
.
h
),
Text
(
label
,
style:
TextStyle
(
...
...
lib/views/home/inspection_topology/inspection_topology_view.dart
View file @
59e6cf59
...
...
@@ -55,7 +55,7 @@ class InspectionTopologyPage extends StatelessWidget {
builder:
(
context
,
state
)
{
if
(
state
.
isLoading
)
{
return
const
Center
(
child:
CircularProgressIndicator
(),
child:
CircularProgressIndicator
(
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
)
),
);
}
...
...
lib/views/login/widget/btn_login.dart
View file @
59e6cf59
...
...
@@ -33,7 +33,7 @@ class BtnLogin extends StatelessWidget {
height:
40
.
w
,
child:
CircularProgressIndicator
(
strokeWidth:
3
.
w
,
color:
Colors
.
white
,
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
)
,
),
)
:
Text
(
...
...
lib/views/profile/index/widget/profile_header_block.dart
View file @
59e6cf59
...
...
@@ -16,14 +16,14 @@ class ProfileHeaderBlock extends StatelessWidget {
return
Container
(
width:
double
.
infinity
,
color:
Colors
.
white
,
padding:
EdgeInsets
.
only
(
left:
28
.
w
,
right:
28
.
w
,
top:
ScreenUtil
().
statusBarHeight
+
32
.
h
,
bottom:
32
.
h
),
padding:
EdgeInsets
.
only
(
left:
28
.
w
,
right:
28
.
w
,
top:
ScreenUtil
().
statusBarHeight
+
20
.
h
,
bottom:
32
.
h
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
'我的'
,
style:
TextStyle
(
fontSize:
3
6
.
sp
,
fontSize:
3
2
.
sp
,
fontWeight:
FontWeight
.
w500
,
color:
Colors
.
black
,
),
...
...
lib/views/report/device/device_list_view.dart
View file @
59e6cf59
...
...
@@ -115,6 +115,19 @@ class _ReportDeviceListBodyState extends State<_ReportDeviceListBody> {
state:
pagingState
,
fetchNextPage:
fetchNextPage
,
builderDelegate:
PagedChildBuilderDelegate
<
DeviceInfo
>(
firstPageProgressIndicatorBuilder:
(
_
)
=>
const
Center
(
child:
CircularProgressIndicator
(
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
),
),
newPageProgressIndicatorBuilder:
(
_
)
=>
const
Center
(
child:
Padding
(
padding:
EdgeInsets
.
all
(
16
),
child:
CircularProgressIndicator
(
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
),
),
),
firstPageErrorIndicatorBuilder:
(
_
)
=>
Center
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
...
...
lib/views/report/energy/energy_detail_view.dart
View file @
59e6cf59
...
...
@@ -40,7 +40,7 @@ class ReportEnergyDetailView extends StatelessWidget {
body:
BlocBuilder
<
EnergyCubit
,
EnergyState
>(
builder:
(
context
,
state
)
{
if
(
state
.
isLoading
)
{
return
const
Center
(
child:
CircularProgressIndicator
());
return
const
Center
(
child:
CircularProgressIndicator
(
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
)
));
}
if
(
state
.
error
!=
null
)
{
return
Center
(
...
...
lib/views/report/index/index_view.dart
View file @
59e6cf59
...
...
@@ -51,9 +51,10 @@ class _ReportIndexViewState extends State<ReportIndexView> with AutoRouteAwareSt
if
(
state
.
isLoading
)
{
return
Container
(
color:
const
Color
.
fromRGBO
(
242
,
243
,
245
,
1
),
child:
const
Center
(
child:
CircularProgressIndicator
()),
child:
const
Center
(
child:
CircularProgressIndicator
(
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
)
)),
);
}
if
(
state
.
error
!=
null
)
{
return
Container
(
color:
const
Color
.
fromRGBO
(
242
,
243
,
245
,
1
),
...
...
@@ -79,6 +80,7 @@ class _ReportIndexViewState extends State<ReportIndexView> with AutoRouteAwareSt
),
);
}
return
LayoutBuilder
(
builder:
(
context
,
constraints
)
{
return
SingleChildScrollView
(
...
...
@@ -89,31 +91,16 @@ class _ReportIndexViewState extends State<ReportIndexView> with AutoRouteAwareSt
child:
Container
(
width:
double
.
infinity
,
color:
const
Color
.
fromRGBO
(
242
,
243
,
245
,
1
),
padding:
EdgeInsets
.
only
(
left:
28
.
w
,
right:
28
.
w
,
top:
ScreenUtil
().
statusBarHeight
),
padding:
EdgeInsets
.
only
(
left:
28
.
w
,
right:
28
.
w
,
bottom:
15
.
h
),
child:
Column
(
spacing:
15
.
h
,
children:
[
ReportHeaderBlock
(
reportHeader:
state
.
reportHeader
),
SizedBox
(
height:
10
.
h
),
ReportMetricsBlock
(
reportMetrics:
state
.
reportMetrics
),
SizedBox
(
height:
10
.
h
),
WeeklyPowerChart
(
weeklyPowerUsage:
state
.
weeklyPowerUsage
),
SizedBox
(
height:
10
.
h
),
RoomStatusDistribution
(
roomStatusDistribution:
state
.
roomStatusDistribution
),
SizedBox
(
height:
10
.
h
),
DeviceOnlineRate
(
deviceOnlineRate:
state
.
deviceOnlineRate
),
SizedBox
(
height:
10
.
h
),
QuickActionsBlock
(
quickActions:
state
.
quickActions
),
SizedBox
(
height:
10
.
h
),
const
ReportHeaderBlock
(),
ReportMetricsBlock
(
reportMetrics:
state
.
reportMetrics
),
WeeklyPowerChart
(
weeklyPowerUsage:
state
.
weeklyPowerUsage
),
RoomStatusDistribution
(
roomStatusDistribution:
state
.
roomStatusDistribution
),
DeviceOnlineRate
(
deviceOnlineRate:
state
.
deviceOnlineRate
),
QuickActionsBlock
(
quickActions:
state
.
quickActions
),
],
),
),
...
...
lib/views/report/index/widget/report_header_block.dart
View file @
59e6cf59
...
...
@@ -2,23 +2,39 @@ import 'package:flutter/material.dart';
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
class
ReportHeaderBlock
extends
StatelessWidget
{
final
Map
<
String
,
dynamic
>
reportHeader
;
const
ReportHeaderBlock
({
super
.
key
,
required
this
.
reportHeader
});
const
ReportHeaderBlock
({
super
.
key
});
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
width:
double
.
infinity
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
0
.
w
,
vertical:
16
.
h
),
child:
Text
(
reportHeader
[
'title'
]
as
String
,
style:
TextStyle
(
fontSize:
36
.
sp
,
fontWeight:
FontWeight
.
w500
,
color:
const
Color
.
fromRGBO
(
71
,
71
,
71
,
1
),
return
Stack
(
clipBehavior:
Clip
.
none
,
children:
[
Positioned
(
left:
-
28
.
w
,
right:
-
28
.
w
,
top:
0
,
child:
Container
(
height:
150
.
h
,
color:
Colors
.
white
,
),
),
Container
(
height:
150
.
h
,
padding:
EdgeInsets
.
only
(
top:
ScreenUtil
().
statusBarHeight
),
child:
Row
(
children:
[
Text
(
'经营概览看板'
,
style:
TextStyle
(
fontSize:
32
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
const
Color
.
fromRGBO
(
0
,
0
,
0
,
1
),
),
),
],
),
),
)
,
]
,
);
}
}
\ No newline at end of file
lib/views/report/room/room_detail_view.dart
View file @
59e6cf59
...
...
@@ -43,7 +43,7 @@ class ReportRoomDetailView extends StatelessWidget {
),
centerTitle:
true
,
),
body:
const
Center
(
child:
CircularProgressIndicator
()),
body:
const
Center
(
child:
CircularProgressIndicator
(
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
)
)),
);
}
...
...
@@ -126,7 +126,7 @@ class ReportRoomDetailView extends StatelessWidget {
if
(
state
.
isLoading
)
const
Padding
(
padding:
EdgeInsets
.
all
(
16.0
),
child:
Center
(
child:
CircularProgressIndicator
()),
child:
Center
(
child:
CircularProgressIndicator
(
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
)
)),
),
...
state
.
detailRooms
.
map
((
room
)
{
return
Padding
(
...
...
lib/views/service/device/device_detail_view.dart
View file @
59e6cf59
...
...
@@ -44,7 +44,7 @@ class ServiceDeviceDetailView extends StatelessWidget {
builder:
(
context
,
state
)
{
final
cubit
=
context
.
read
<
ServiceDeviceCubit
>();
if
(
state
.
isLoading
)
{
return
const
Center
(
child:
CircularProgressIndicator
());
return
const
Center
(
child:
CircularProgressIndicator
(
color:
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
)
));
}
if
(
state
.
error
!=
null
)
{
return
Center
(
...
...
@@ -68,33 +68,38 @@ class ServiceDeviceDetailView extends StatelessWidget {
);
}
return
SingleChildScrollView
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
28
.
w
),
child:
Column
(
children:
[
SizedBox
(
height:
20
.
h
),
TemperatureControlBlock
(
isOn:
state
.
isOn
,
targetTemperature:
state
.
targetTemperature
,
currentTemperature:
state
.
currentTemperature
,
minTemperature:
state
.
minTemperature
,
maxTemperature:
state
.
maxTemperature
,
onTogglePower:
cubit
.
togglePower
,
onIncreaseTemperature:
cubit
.
increaseTemperature
,
onDecreaseTemperature:
cubit
.
decreaseTemperature
,
),
SizedBox
(
height:
20
.
h
),
ModeSelectionBlock
(
modeData:
state
.
modeData
,
onSelectMode:
cubit
.
selectMode
,
),
SizedBox
(
height:
20
.
h
),
WindSpeedBlock
(
currentSpeed:
state
.
currentSpeed
,
speedOptions:
state
.
speedOptions
,
onSetWindSpeed:
cubit
.
setWindSpeed
,
),
SizedBox
(
height:
20
.
h
),
],
padding:
EdgeInsets
.
symmetric
(
horizontal:
28
.
w
,
vertical:
20
.
h
),
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
28
.
w
,
vertical:
40
.
h
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
24
.
r
),
),
child:
Column
(
children:
[
TemperatureControlBlock
(
isOn:
state
.
isOn
,
targetTemperature:
state
.
targetTemperature
,
currentTemperature:
state
.
currentTemperature
,
minTemperature:
state
.
minTemperature
,
maxTemperature:
state
.
maxTemperature
,
onTogglePower:
cubit
.
togglePower
,
onIncreaseTemperature:
cubit
.
increaseTemperature
,
onDecreaseTemperature:
cubit
.
decreaseTemperature
,
),
SizedBox
(
height:
20
.
h
),
ModeSelectionBlock
(
modeData:
state
.
modeData
,
onSelectMode:
cubit
.
selectMode
,
),
SizedBox
(
height:
20
.
h
),
WindSpeedBlock
(
currentSpeed:
state
.
currentSpeed
,
speedOptions:
state
.
speedOptions
,
onSetWindSpeed:
cubit
.
setWindSpeed
,
),
],
),
),
);
},
...
...
lib/views/service/device/widget/mode_selection_block.dart
View file @
59e6cf59
...
...
@@ -67,7 +67,7 @@ class _ModeSelectionBlockState extends State<ModeSelectionBlock> {
Text
(
mode
[
'name'
]
as
String
,
style:
TextStyle
(
fontSize:
2
2
.
sp
,
fontSize:
2
4
.
sp
,
color:
isSelected
?
Colors
.
white
:
const
Color
.
fromRGBO
(
107
,
114
,
128
,
1
),
...
...
lib/views/service/device/widget/temperature_control_block.dart
View file @
59e6cf59
import
'package:flutter/material.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:flutter_switch/flutter_switch.dart'
;
import
'dart:math'
as
math
;
class
TemperatureControlBlock
extends
StatefulWidget
{
...
...
@@ -29,83 +30,37 @@ class TemperatureControlBlock extends StatefulWidget {
_TemperatureControlBlockState
();
}
class
_TemperatureControlBlockState
extends
State
<
TemperatureControlBlock
>
with
SingleTickerProviderStateMixin
{
class
_TemperatureControlBlockState
extends
State
<
TemperatureControlBlock
>
{
@override
Widget
build
(
BuildContext
context
)
{
final
progress
=
(
widget
.
targetTemperature
-
widget
.
minTemperature
)
/
(
widget
.
maxTemperature
-
widget
.
minTemperature
);
return
Container
(
width:
double
.
infinity
,
padding:
EdgeInsets
.
symmetric
(
vertical:
20
.
w
),
child:
Column
(
children:
[
Align
(
alignment:
Alignment
.
centerRight
,
child:
Padding
(
padding:
EdgeInsets
.
only
(
right:
20
.
w
),
child:
_buildPowerSwitch
(),
),
),
SizedBox
(
height:
20
.
h
),
_buildCircularTemperatureControl
(
progress
),
SizedBox
(
height:
40
.
h
),
_buildControlButtons
(),
],
),
);
}
Widget
_buildPowerSwitch
()
{
return
GestureDetector
(
onTap:
()
=>
widget
.
onTogglePower
(!
widget
.
isOn
),
child:
Container
(
width:
88
.
w
,
height:
48
.
h
,
decoration:
BoxDecoration
(
gradient:
widget
.
isOn
?
const
LinearGradient
(
colors:
[
Color
.
fromRGBO
(
96
,
165
,
250
,
1
),
Color
.
fromRGBO
(
59
,
130
,
246
,
1
),
],
)
:
const
LinearGradient
(
colors:
[
Color
.
fromRGBO
(
209
,
213
,
219
,
1
),
Color
.
fromRGBO
(
156
,
163
,
175
,
1
),
],
),
borderRadius:
BorderRadius
.
circular
(
24
.
r
),
),
child:
Stack
(
return
Column
(
children:
[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
end
,
children:
[
AnimatedAlign
(
duration:
const
Duration
(
milliseconds:
200
),
alignment:
widget
.
isOn
?
Alignment
.
centerRight
:
Alignment
.
centerLeft
,
child:
Padding
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
4
.
w
),
child:
Container
(
width:
40
.
w
,
height:
40
.
h
,
decoration:
BoxDecoration
(
color:
Colors
.
white
,
shape:
BoxShape
.
circle
,
boxShadow:
[
BoxShadow
(
color:
Colors
.
black
.
withOpacity
(
0.1
),
blurRadius:
4
,
offset:
const
Offset
(
0
,
2
),
),
],
),
),
),
FlutterSwitch
(
width:
80
.
w
,
height:
35
.
h
,
valueFontSize:
20
.
sp
,
toggleSize:
25
.
h
,
borderRadius:
20
.
r
,
padding:
4
.
w
,
value:
widget
.
isOn
,
activeColor:
const
Color
.
fromRGBO
(
80
,
162
,
255
,
1
),
inactiveColor:
const
Color
.
fromRGBO
(
210
,
213
,
218
,
1
),
onToggle:
widget
.
onTogglePower
,
),
SizedBox
(
width:
20
.
w
),
],
),
),
SizedBox
(
height:
20
.
h
),
_buildCircularTemperatureControl
(
progress
),
SizedBox
(
height:
40
.
h
),
_buildControlButtons
(),
],
);
}
...
...
@@ -138,40 +93,38 @@ class _TemperatureControlBlockState extends State<TemperatureControlBlock>
Text
(
'
${widget.targetTemperature}
'
,
style:
TextStyle
(
fontSize:
100
.
sp
,
fontSize:
68
.
sp
,
fontWeight:
FontWeight
.
w500
,
color:
widget
.
isOn
?
const
Color
.
fromRGBO
(
3
7
,
99
,
23
5
,
1
)
?
const
Color
.
fromRGBO
(
3
5
,
89
,
24
5
,
1
)
:
const
Color
.
fromRGBO
(
209
,
213
,
219
,
1
),
),
),
SizedBox
(
height:
8
.
h
),
Text
(
'°C'
,
style:
TextStyle
(
fontSize:
48
.
sp
,
fontSize:
36
.
sp
,
fontWeight:
FontWeight
.
w400
,
color:
widget
.
isOn
?
const
Color
.
fromRGBO
(
59
,
130
,
246
,
1
)
?
const
Color
.
fromRGBO
(
35
,
89
,
245
,
1
)
:
const
Color
.
fromRGBO
(
209
,
213
,
219
,
1
),
),
),
SizedBox
(
height:
20
.
h
),
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Text
(
'当前室温 '
,
style:
TextStyle
(
fontSize:
2
8
.
sp
,
color:
const
Color
.
fromRGBO
(
1
56
,
163
,
175
,
1
),
fontSize:
2
4
.
sp
,
color:
const
Color
.
fromRGBO
(
1
00
,
116
,
139
,
1
),
),
),
Text
(
'
${widget.currentTemperature}
°C'
,
style:
TextStyle
(
fontSize:
2
8
.
sp
,
color:
const
Color
.
fromRGBO
(
10
7
,
114
,
128
,
1
),
fontSize:
2
4
.
sp
,
color:
const
Color
.
fromRGBO
(
10
0
,
116
,
139
,
1
),
),
),
],
...
...
@@ -186,14 +139,14 @@ class _TemperatureControlBlockState extends State<TemperatureControlBlock>
child:
Container
(
width:
64
.
w
,
height:
64
.
w
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
37
,
99
,
235
,
1
),
decoration:
const
BoxDecoration
(
color:
Color
.
fromRGBO
(
37
,
99
,
235
,
1
),
shape:
BoxShape
.
circle
,
boxShadow:
[
BoxShadow
(
color:
const
Color
.
fromRGBO
(
37
,
99
,
235
,
0.3
),
color:
Color
.
fromRGBO
(
37
,
99
,
235
,
0.3
),
blurRadius:
10
,
offset:
const
Offset
(
0
,
4
),
offset:
Offset
(
0
,
4
),
),
],
),
...
...
@@ -217,44 +170,43 @@ class _TemperatureControlBlockState extends State<TemperatureControlBlock>
Widget
_buildControlButtons
()
{
return
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
spacing:
40
.
w
,
children:
[
GestureDetector
(
onTap:
widget
.
onDecreaseTemperature
,
child:
Container
(
width:
1
40
.
w
,
height:
120
.
h
,
width:
1
02
.
w
,
height:
82
.
h
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
22
9
,
231
,
235
,
1
),
borderRadius:
BorderRadius
.
circular
(
40
.
r
),
color:
const
Color
.
fromRGBO
(
22
4
,
227
,
232
,
1
),
borderRadius:
BorderRadius
.
circular
(
26
.
r
),
),
child:
Icon
(
Icons
.
remove
,
size:
48
.
sp
,
size:
70
.
sp
,
color:
const
Color
.
fromRGBO
(
107
,
114
,
128
,
1
),
),
),
),
SizedBox
(
width:
40
.
w
),
Text
(
'温度调节'
,
style:
TextStyle
(
fontSize:
32
.
sp
,
color:
const
Color
.
fromRGBO
(
10
7
,
114
,
128
,
1
),
color:
const
Color
.
fromRGBO
(
10
0
,
116
,
139
,
1
),
),
),
SizedBox
(
width:
40
.
w
),
GestureDetector
(
onTap:
widget
.
onIncreaseTemperature
,
child:
Container
(
width:
1
40
.
w
,
height:
120
.
h
,
width:
1
02
.
w
,
height:
82
.
h
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
22
9
,
231
,
235
,
1
),
borderRadius:
BorderRadius
.
circular
(
40
.
r
),
color:
const
Color
.
fromRGBO
(
22
4
,
227
,
232
,
1
),
borderRadius:
BorderRadius
.
circular
(
26
.
r
),
),
child:
Icon
(
Icons
.
add
,
size:
48
.
sp
,
size:
70
.
sp
,
color:
const
Color
.
fromRGBO
(
107
,
114
,
128
,
1
),
),
),
...
...
lib/views/service/device/widget/wind_speed_block.dart
View file @
59e6cf59
...
...
@@ -58,7 +58,7 @@ class _WindSpeedBlockState extends State<WindSpeedBlock> {
child:
Text
(
speed
,
style:
TextStyle
(
fontSize:
2
2
.
sp
,
fontSize:
2
4
.
sp
,
color:
isSelected
?
Colors
.
white
:
const
Color
.
fromRGBO
(
107
,
114
,
128
,
1
),
...
...
lib/views/service/index/cubit/service_index_cubit.dart
View file @
59e6cf59
...
...
@@ -89,10 +89,7 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> {
}
/// 加载房间状态列表
Future
<
void
>
loadRooms
({
int
?
floorId
,
String
?
areaType
,
})
async
{
Future
<
void
>
loadRooms
({
int
?
floorId
,
String
?
areaType
})
async
{
emit
(
state
.
copyWith
(
isLoading:
true
,
error:
null
));
try
{
final
roomStatuses
=
await
_roomService
.
getRoomStatus
(
...
...
@@ -151,7 +148,11 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> {
'roomId'
:
rs
.
roomId
,
'number'
:
rs
.
roomNumber
,
'status'
:
displayStatus
,
'type'
:
'客房'
,
// 默认类型,后续可通过楼层areas信息扩展
'type'
:
'客房'
,
'occupancyStatus'
:
rs
.
occupancyStatus
,
// 0=无人 1=有人
'roomStatus'
:
rs
.
roomStatus
,
// 0=无人 1=有人
'cleanStatus'
:
rs
.
cleanStatus
,
// 0=待清洁 2=已完成
'devicePowerStatus'
:
rs
.
devicePowerStatus
,
// 0=关 1=开
};
}
...
...
@@ -183,15 +184,8 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> {
}
}
void
selectType
(
String
?
type
)
{
emit
(
state
.
copyWith
(
selectedType:
type
));
}
/// 加载非客房-相关楼层区域设备
Future
<
void
>
loadAreaDevices
({
required
int
floorId
,
required
String
areaType
,
})
async
{
Future
<
void
>
loadAreaDevices
({
required
int
floorId
,
required
String
areaType
})
async
{
emit
(
state
.
copyWith
(
isLoadingAreaDevices:
true
,
error:
null
));
try
{
final
devices
=
await
_roomService
.
getAreaDevices
(
...
...
@@ -210,8 +204,103 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> {
}
}
void
selectRoom
(
String
?
room
)
{
emit
(
state
.
copyWith
(
selectedRoom:
room
));
/// 选择房间
void
selectRoom
({
String
?
room
,
int
?
roomId
})
{
emit
(
state
.
copyWith
(
selectedRoom:
room
,
selectedRoomId:
roomId
));
}
/// UI 层切换楼层(含取消选中、重置类型/房间/搜索、加载房间数据)
void
toggleFloor
(
String
floorName
,
int
floorId
)
{
final
isSameFloor
=
state
.
selectedFloor
==
floorName
;
final
newFloor
=
isSameFloor
?
null
:
floorName
;
// 计算新楼层的 areas
List
<
String
>
areas
=
state
.
areas
;
if
(
newFloor
!=
null
)
{
final
matched
=
_floorAreasCache
.
where
(
(
f
)
=>
f
.
floorId
.
toString
()
==
newFloor
,
);
areas
=
matched
.
isNotEmpty
?
matched
.
first
.
areas
:
<
String
>[];
}
emit
(
state
.
copyWith
(
selectedFloor:
newFloor
,
selectedType:
null
,
selectedRoom:
null
,
selectedRoomId:
null
,
searchText:
''
,
areas:
areas
,
));
if
(
newFloor
!=
null
)
{
loadRooms
(
floorId:
floorId
);
}
}
/// UI 层切换区域类型(含取消选中、重置房间、加载非客房设备)
void
toggleType
(
String
type
)
{
final
newType
=
state
.
selectedType
!=
type
?
type
:
null
;
emit
(
state
.
copyWith
(
selectedType:
newType
,
selectedRoom:
null
,
selectedRoomId:
null
,
));
if
(
newType
!=
null
&&
newType
!=
'客房'
)
{
_loadAreaDevicesForCurrentFloor
(
newType
);
}
}
/// 获取当前筛选条件下的房间列表
List
<
Map
<
String
,
dynamic
>>
getFilteredRooms
()
{
List
<
Map
<
String
,
dynamic
>>
allRooms
;
if
(
state
.
selectedFloor
==
null
)
{
allRooms
=
[];
for
(
final
floorMap
in
(
state
.
floors
??
[]))
{
final
floorName
=
floorMap
.
values
.
first
;
allRooms
.
addAll
(
getRoomsByFloor
(
floorName
));
}
}
else
{
allRooms
=
getRoomsByFloor
(
state
.
selectedFloor
!);
}
if
(
state
.
selectedType
!=
null
)
{
allRooms
=
allRooms
.
where
((
room
)
=>
room
[
'type'
]
==
state
.
selectedType
).
toList
();
}
if
(
state
.
searchText
.
isEmpty
)
{
return
allRooms
;
}
return
allRooms
.
where
((
room
)
=>
(
room
[
'number'
]
as
String
)
.
toLowerCase
()
.
contains
(
state
.
searchText
.
toLowerCase
()))
.
toList
();
}
/// 获取当前选中房间的完整数据
Map
<
String
,
dynamic
>?
getSelectedRoomDetail
()
{
if
(
state
.
selectedRoom
==
null
)
return
null
;
return
_findRoomByNumber
(
state
.
selectedRoom
!);
}
/// 根据楼层标签获取楼层 ID
int
?
getFloorIdByLabel
(
String
floorLabel
)
{
for
(
final
floorMap
in
(
state
.
floors
??
[]))
{
if
(
floorMap
.
values
.
first
==
floorLabel
)
{
return
floorMap
.
keys
.
first
;
}
}
return
null
;
}
/// 根据当前选中楼层加载非客房区域设备
void
_loadAreaDevicesForCurrentFloor
(
String
areaType
)
{
if
(
state
.
selectedFloor
==
null
)
return
;
final
floorId
=
getFloorIdByLabel
(
state
.
selectedFloor
!);
if
(
floorId
==
null
)
return
;
loadAreaDevices
(
floorId:
floorId
,
areaType:
areaType
);
}
void
setSearchText
(
String
text
)
{
...
...
@@ -261,4 +350,10 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> {
}
return
null
;
}
@override
Future
<
void
>
close
()
{
return
super
.
close
();
}
}
lib/views/service/index/cubit/service_index_state.dart
View file @
59e6cf59
...
...
@@ -2,15 +2,18 @@ import 'package:equatable/equatable.dart';
import
'package:smart_hotel_app/models/bo/room_bo.dart'
;
class
ServiceIndexState
extends
Equatable
{
/// copyWith sentinel: 区分「未传参」和「显式传 null」
static
const
_nothing
=
Object
();
final
int
pendingCount
;
final
int
occupiedRooms
;
final
int
vacantRooms
;
// final List<String> floors;
final
List
<
Map
<
int
,
String
>>?
floors
;
final
List
<
String
>
areas
;
final
String
?
selectedFloor
;
final
String
?
selectedType
;
final
String
?
selectedRoom
;
final
int
?
selectedRoomId
;
final
String
searchText
;
final
List
<
Map
<
String
,
dynamic
>>
rooms
;
final
List
<
AreaDeviceBO
>
areaDevices
;
...
...
@@ -29,6 +32,7 @@ class ServiceIndexState extends Equatable {
this
.
selectedFloor
,
this
.
selectedType
,
this
.
selectedRoom
,
this
.
selectedRoomId
,
this
.
searchText
=
''
,
this
.
rooms
=
const
[],
this
.
areaDevices
=
const
[],
...
...
@@ -43,18 +47,18 @@ class ServiceIndexState extends Equatable {
int
?
pendingCount
,
int
?
occupiedRooms
,
int
?
vacantRooms
,
// List<String>? floors,
List
<
Map
<
int
,
String
>>?
floors
,
List
<
String
>?
areas
,
String
?
selectedFloor
,
String
?
selectedType
,
String
?
selectedRoom
,
Object
?
selectedFloor
=
_nothing
,
Object
?
selectedType
=
_nothing
,
Object
?
selectedRoom
=
_nothing
,
Object
?
selectedRoomId
=
_nothing
,
String
?
searchText
,
List
<
Map
<
String
,
dynamic
>>?
rooms
,
List
<
AreaDeviceBO
>?
areaDevices
,
bool
?
isLoading
,
bool
?
isLoadingAreaDevices
,
String
?
error
,
Object
?
error
=
_nothing
,
bool
?
isPoweringOn
,
bool
?
isPoweringOff
,
})
{
...
...
@@ -64,15 +68,16 @@ class ServiceIndexState extends Equatable {
vacantRooms:
vacantRooms
??
this
.
vacantRooms
,
floors:
floors
??
this
.
floors
,
areas:
areas
??
this
.
areas
,
selectedFloor:
selectedFloor
??
this
.
selectedFloor
,
selectedType:
selectedType
??
this
.
selectedType
,
selectedRoom:
selectedRoom
??
this
.
selectedRoom
,
selectedFloor:
identical
(
selectedFloor
,
_nothing
)
?
this
.
selectedFloor
:
selectedFloor
as
String
?,
selectedType:
identical
(
selectedType
,
_nothing
)
?
this
.
selectedType
:
selectedType
as
String
?,
selectedRoom:
identical
(
selectedRoom
,
_nothing
)
?
this
.
selectedRoom
:
selectedRoom
as
String
?,
selectedRoomId:
identical
(
selectedRoomId
,
_nothing
)
?
this
.
selectedRoomId
:
selectedRoomId
as
int
?,
searchText:
searchText
??
this
.
searchText
,
rooms:
rooms
??
this
.
rooms
,
areaDevices:
areaDevices
??
this
.
areaDevices
,
isLoading:
isLoading
??
this
.
isLoading
,
isLoadingAreaDevices:
isLoadingAreaDevices
??
this
.
isLoadingAreaDevices
,
error:
error
??
this
.
error
,
error:
identical
(
error
,
_nothing
)
?
this
.
error
:
error
as
String
?
,
isPoweringOn:
isPoweringOn
??
this
.
isPoweringOn
,
isPoweringOff:
isPoweringOff
??
this
.
isPoweringOff
,
);
...
...
@@ -88,6 +93,7 @@ class ServiceIndexState extends Equatable {
selectedFloor
,
selectedType
,
selectedRoom
,
selectedRoomId
,
searchText
,
rooms
,
areaDevices
,
...
...
lib/views/service/index/index_view.dart
View file @
59e6cf59
...
...
@@ -64,7 +64,7 @@ class _ServiceIndexViewState extends State<ServiceIndexView> with AutoRouteAware
occupiedCount:
state
.
occupiedRooms
,
vacantCount:
state
.
vacantRooms
,
),
RoomManagementBlock
(),
const
RoomManagementBlock
(),
SizedBox
(
height:
18
.
h
),
],
);
...
...
lib/views/service/index/widget/area_device_list.dart
View file @
59e6cf59
...
...
@@ -50,7 +50,7 @@ class AreaDeviceList extends StatelessWidget {
return
const
Center
(
child:
Padding
(
padding:
EdgeInsets
.
all
(
20
),
child:
CircularProgressIndicator
(),
child:
CircularProgressIndicator
(
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
)
),
),
);
}
...
...
lib/views/service/index/widget/room_management_block.dart
View file @
59e6cf59
import
'dart:convert'
;
import
'package:auto_route/auto_route.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
...
...
@@ -8,256 +10,145 @@ import 'package:smart_hotel_app/views/service/index/cubit/service_index_state.da
import
'package:smart_hotel_app/views/service/index/widget/area_device_list.dart'
;
import
'package:smart_hotel_app/utils/toast_utils.dart'
;
class
RoomManagementBlock
extends
State
ful
Widget
{
class
RoomManagementBlock
extends
State
less
Widget
{
const
RoomManagementBlock
({
super
.
key
});
@override
State
<
RoomManagementBlock
>
createState
()
=>
_RoomManagementBlockState
();
}
class
_RoomManagementBlockState
extends
State
<
RoomManagementBlock
>
{
String
?
_selectedFloor
;
String
?
_selectedType
;
String
?
_selectedRoom
;
int
?
_selectedRoomId
;
String
_searchText
=
''
;
final
TextEditingController
_searchController
=
TextEditingController
();
final
ScrollController
_scrollController
=
ScrollController
();
List
<
Map
<
String
,
dynamic
>>
_getFilteredRooms
(
ServiceIndexCubit
cubit
)
{
List
<
Map
<
String
,
dynamic
>>
allRooms
;
if
(
_selectedFloor
==
null
)
{
allRooms
=
[];
for
(
final
floorMap
in
(
cubit
.
state
.
floors
??
[]))
{
final
floorName
=
floorMap
.
values
.
first
;
allRooms
.
addAll
(
cubit
.
getRoomsByFloor
(
floorName
));
}
}
else
{
allRooms
=
cubit
.
getRoomsByFloor
(
_selectedFloor
!);
}
if
(
_selectedType
!=
null
)
{
allRooms
=
allRooms
.
where
((
room
)
=>
room
[
'type'
]
==
_selectedType
)
.
toList
();
}
if
(
_searchText
.
isEmpty
)
{
return
allRooms
;
}
final
filtered
=
allRooms
.
where
((
room
)
=>
(
room
[
'number'
]
as
String
).
toLowerCase
().
contains
(
_searchText
.
toLowerCase
()))
.
toList
();
return
filtered
;
}
/// 加载非客房区域设备
void
_loadAreaDevices
(
ServiceIndexCubit
cubit
)
{
if
(
_selectedFloor
==
null
)
return
;
// 从 floors 中找对应 floorId
int
?
floorId
;
for
(
final
floorMap
in
(
cubit
.
state
.
floors
??
[]))
{
if
(
floorMap
.
values
.
first
==
_selectedFloor
)
{
floorId
=
floorMap
.
keys
.
first
;
break
;
}
}
if
(
floorId
==
null
)
return
;
cubit
.
loadAreaDevices
(
floorId:
floorId
,
areaType:
_selectedType
!);
}
@override
Widget
build
(
BuildContext
context
)
{
final
cubit
=
context
.
read
<
ServiceIndexCubit
>();
return
BlocListener
<
ServiceIndexCubit
,
ServiceIndexState
>(
listener:
(
context
,
state
)
{
if
(
_selectedFloor
!=
state
.
selectedFloor
)
{
setState
(()
{
_selectedFloor
=
state
.
selectedFloor
;
});
}
},
child:
Container
(
width:
double
.
infinity
,
padding:
EdgeInsets
.
all
(
20
.
w
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
24
.
r
),
color:
Colors
.
white
,
boxShadow:
[
BoxShadow
(
color:
const
Color
.
fromRGBO
(
0
,
0
,
0
,
0.03
),
blurRadius:
20
.
r
,
offset:
const
Offset
(
0
,
4
),
return
BlocBuilder
<
ServiceIndexCubit
,
ServiceIndexState
>(
builder:
(
context
,
state
)
{
final
cubit
=
context
.
read
<
ServiceIndexCubit
>();
return
Container
(
width:
double
.
infinity
,
padding:
EdgeInsets
.
all
(
28
.
w
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
24
.
r
),
color:
Colors
.
white
,
boxShadow:
[
BoxShadow
(
color:
const
Color
.
fromRGBO
(
0
,
0
,
0
,
0.03
),
blurRadius:
20
.
r
,
offset:
const
Offset
(
0
,
4
),
),
],
),
],
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
_buildFloorSelector
(
cubit
),
SizedBox
(
height:
18
.
h
),
_buildTypeSelector
(),
SizedBox
(
height:
18
.
h
),
if
(
_selectedType
==
null
||
_selectedType
==
'客房'
)
...[
_buildSearchBox
(),
SizedBox
(
height:
32
.
h
),
_buildLine
(),
SizedBox
(
height:
18
.
h
),
_buildRoomGrid
(
cubit
),
SizedBox
(
height:
20
.
h
),
if
(
_selectedRoom
!=
null
)
Padding
(
padding:
EdgeInsets
.
only
(
bottom:
15
.
h
),
child:
Text
(
'已选:
$_selectedRoom
号房'
,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
_buildFloorSelector
(
state
,
cubit
),
SizedBox
(
height:
24
.
h
),
_buildTypeSelector
(
state
,
cubit
),
SizedBox
(
height:
24
.
h
),
if
(
state
.
selectedType
==
null
||
state
.
selectedType
==
'客房'
)
...[
_buildSearchBox
(
state
,
cubit
),
SizedBox
(
height:
32
.
h
),
_buildLine
(),
SizedBox
(
height:
24
.
h
),
_buildRoomGrid
(
state
,
cubit
),
SizedBox
(
height:
24
.
h
),
if
(
state
.
selectedRoom
!=
null
)
...[
_buildLine
(),
SizedBox
(
height:
24
.
h
),
_buildRoomDetail
(
state
,
cubit
),
SizedBox
(
height:
10
.
h
),
],
_buildBottomButtons
(
state
,
cubit
,
context
),
]
else
...[
_buildLine
(),
SizedBox
(
height:
24
.
h
),
AreaDeviceList
(
devices:
state
.
areaDevices
,
isLoading:
state
.
isLoadingAreaDevices
,
),
),
BlocBuilder
<
ServiceIndexCubit
,
ServiceIndexState
>(
builder:
(
context
,
state
)
=>
_buildBottomButtons
(
cubit
),
),
]
else
...[
_buildLine
(),
SizedBox
(
height:
18
.
h
),
BlocBuilder
<
ServiceIndexCubit
,
ServiceIndexState
>(
builder:
(
context
,
state
)
=>
AreaDeviceList
(
devices:
state
.
areaDevices
,
isLoading:
state
.
isLoadingAreaDevices
,
),
),
],
],
),
),
],
],
),
);
},
);
}
Widget
_buildFloorSelector
(
ServiceIndexCubit
cubit
)
{
final
floors
=
cubit
.
state
.
floors
;
return
SingleChildScrollView
(
scrollDirection:
Axis
.
horizontal
,
child:
Row
(
children:
(
floors
??
[]).
map
((
floorMap
)
{
final
floorName
=
floorMap
.
values
.
first
;
final
floorId
=
floorMap
.
keys
.
first
;
final
isSelected
=
_selectedFloor
==
floorName
;
final
displayFloor
=
floorName
;
return
Padding
(
padding:
EdgeInsets
.
only
(
right:
24
.
w
),
child:
GestureDetector
(
onTap:
()
{
setState
(()
{
if
(
_selectedFloor
==
floorName
)
{
_selectedFloor
=
null
;
}
else
{
_selectedFloor
=
floorName
;
}
_selectedType
=
null
;
_searchController
.
clear
();
_searchText
=
''
;
});
// 切换楼层时重新请求接口
if
(
_selectedFloor
!=
null
)
{
cubit
.
selectFloor
(
_selectedFloor
);
cubit
.
loadRooms
(
floorId:
floorId
);
}
},
child:
Column
(
children:
[
Text
(
'
$displayFloor
楼'
,
style:
TextStyle
(
fontSize:
28
.
sp
,
color:
isSelected
?
const
Color
.
fromRGBO
(
80
,
162
,
255
,
1
)
:
const
Color
.
fromRGBO
(
0
,
0
,
0
,
1
),
fontWeight:
isSelected
?
FontWeight
.
bold
:
FontWeight
.
normal
,
),
Widget
_buildFloorSelector
(
ServiceIndexState
state
,
ServiceIndexCubit
cubit
)
{
final
floors
=
state
.
floors
;
return
Row
(
children:
(
floors
??
[]).
map
((
floorMap
)
{
final
floorName
=
floorMap
.
values
.
first
;
final
floorNameNew
=
floorName
==
'1'
?
'一'
:
floorName
==
'2'
?
'二'
:
floorName
==
'3'
?
'三'
:
floorName
==
'4'
?
'四'
:
floorName
==
'5'
?
'五'
:
floorName
==
'6'
?
'六'
:
floorName
==
'7'
?
'七'
:
''
;
final
floorId
=
floorMap
.
keys
.
first
;
final
isSelected
=
state
.
selectedFloor
==
floorName
;
return
Expanded
(
child:
GestureDetector
(
onTap:
()
=>
cubit
.
toggleFloor
(
floorName
,
floorId
),
child:
Column
(
children:
[
Text
(
'
$floorNameNew
楼'
,
style:
TextStyle
(
fontSize:
28
.
sp
,
color:
isSelected
?
const
Color
.
fromRGBO
(
80
,
162
,
255
,
1
)
:
const
Color
.
fromRGBO
(
0
,
0
,
0
,
1
),
fontWeight:
isSelected
?
FontWeight
.
bold
:
FontWeight
.
normal
,
),
SizedBox
(
height:
4
.
h
),
Container
(
width:
50
.
w
,
height:
3
.
h
,
decoration:
BoxDecoration
(
color:
isSelected
?
const
Color
.
fromRGBO
(
80
,
162
,
255
,
1
)
:
Colors
.
transparent
,
borderRadius:
BorderRadius
.
circular
(
2
.
r
)
,
),
),
SizedBox
(
height:
4
.
h
),
Container
(
width:
50
.
w
,
height:
3
.
h
,
decoration:
BoxDecoration
(
color:
isSelected
?
const
Color
.
fromRGBO
(
80
,
162
,
255
,
1
)
:
Colors
.
transparent
,
borderRadius:
BorderRadius
.
circular
(
2
.
r
),
),
]
,
)
,
)
,
]
,
),
)
;
}).
toList
(),
),
)
,
);
}).
toList
(
),
);
}
Widget
_buildTypeSelector
()
{
final
cubit
=
context
.
read
<
ServiceIndexCubit
>();
final
types
=
cubit
.
state
.
areas
.
isNotEmpty
?
cubit
.
state
.
areas
:
[];
Widget
_buildTypeSelector
(
ServiceIndexState
state
,
ServiceIndexCubit
cubit
)
{
return
Row
(
children:
types
.
asMap
().
entries
.
map
((
entry
)
{
final
index
=
entry
.
key
;
children:
state
.
areas
.
asMap
().
entries
.
map
((
entry
)
{
final
type
=
entry
.
value
;
final
isSelected
=
_selectedType
==
type
;
return
Container
(
width:
100
.
w
,
child:
Padding
(
padding:
EdgeInsets
.
only
(
right:
index
<
types
.
length
-
1
?
10
.
w
:
0
),
child:
GestureDetector
(
onTap:
()
{
setState
(()
{
if
(
_selectedType
==
type
)
{
_selectedType
=
null
;
}
else
{
_selectedType
=
type
;
}
_selectedRoom
=
null
;
_selectedRoomId
=
null
;
});
// 非客房类型时,加载区域设备数据
if
(
_selectedType
!=
null
&&
_selectedType
!=
'客房'
)
{
_loadAreaDevices
(
cubit
);
}
},
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
8
.
h
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
.
r
),
border:
Border
.
all
(
color:
isSelected
?
const
Color
.
fromRGBO
(
73
,
149
,
234
,
0.5
)
:
Colors
.
transparent
,
width:
1
.
w
,
),
color:
isSelected
?
const
Color
.
fromRGBO
(
73
,
149
,
234
,
0.2
)
:
const
Color
.
fromRGBO
(
238
,
238
,
238
,
1
),
),
child:
Center
(
child:
Text
(
type
,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
isSelected
?
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
)
:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1
),
fontWeight:
isSelected
?
FontWeight
.
bold
:
FontWeight
.
normal
,
),
),
),
final
isSelected
=
state
.
selectedType
==
type
;
return
GestureDetector
(
onTap:
()
=>
cubit
.
toggleType
(
type
),
child:
Container
(
alignment:
Alignment
.
center
,
width:
110
.
w
,
height:
45
.
h
,
margin:
EdgeInsets
.
only
(
right:
10
.
w
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
.
r
),
border:
Border
.
all
(
color:
isSelected
?
const
Color
.
fromRGBO
(
73
,
149
,
234
,
0.5
)
:
Colors
.
transparent
,
width:
1
.
w
,
),
color:
isSelected
?
const
Color
.
fromRGBO
(
73
,
149
,
234
,
0.2
)
:
const
Color
.
fromRGBO
(
238
,
238
,
238
,
1
),
),
child:
Text
(
type
,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
isSelected
?
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
)
:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1
),
fontWeight:
isSelected
?
FontWeight
.
bold
:
FontWeight
.
normal
,
),
),
),
...
...
@@ -266,10 +157,10 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
);
}
Widget
_buildSearchBox
()
{
Widget
_buildSearchBox
(
ServiceIndexState
state
,
ServiceIndexCubit
cubit
)
{
return
Container
(
height:
80
.
h
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
16
.
w
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
20
.
w
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
86
.
r
),
color:
Colors
.
white
,
...
...
@@ -279,35 +170,17 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
),
),
child:
Row
(
spacing:
20
.
w
,
children:
[
Icon
(
Icons
.
search
,
color:
const
Color
.
fromRGBO
(
1
53
,
153
,
153
,
1
),
size:
37
.
sp
,
color:
const
Color
.
fromRGBO
(
1
00
,
116
,
139
,
1
),
size:
46
.
sp
,
),
SizedBox
(
width:
26
.
w
),
Expanded
(
child:
TextField
(
controller:
_searchController
,
onChanged:
(
value
)
{
setState
(()
{
_searchText
=
value
;
});
},
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1
),
),
decoration:
InputDecoration
(
hintText:
'输入房号快速查找,如301...'
,
hintStyle:
TextStyle
(
fontSize:
24
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1
),
),
border:
InputBorder
.
none
,
contentPadding:
EdgeInsets
.
symmetric
(
vertical:
16
.
h
),
isCollapsed:
true
,
),
child:
_SearchBox
(
selectedFloor:
state
.
selectedFloor
,
onChanged:
(
value
)
=>
cubit
.
setSearchText
(
value
),
),
),
],
...
...
@@ -316,21 +189,60 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
}
Widget
_buildLine
()
{
return
Container
(
height:
1
.
h
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1
),
return
Divider
(
height:
0.5
.
h
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
0.2
),
thickness:
0.5
,
);
}
String
_buildFilterLabel
()
{
final
floorPart
=
_selectedFloor
?.
replaceAll
(
'楼'
,
''
)
??
''
;
return
floorPart
.
isNotEmpty
?
'客房
${floorPart}
楼·左右滑动选择'
:
'左右滑动选择'
;
Widget
_buildRoomDetail
(
ServiceIndexState
state
,
ServiceIndexCubit
cubit
)
{
final
room
=
cubit
.
getSelectedRoomDetail
();
if
(
room
==
null
)
return
const
SizedBox
.
shrink
();
final
items
=
[
(
'房间有无人'
,
room
[
'occupancyStatus'
]
==
'1'
?
'有人'
:
'无人'
),
(
'房间状态'
,
room
[
'occupancyStatus'
]
==
'1'
?
'入住'
:
'空闲'
),
(
'清洁灯'
,
room
[
'cleanStatus'
]
==
'2'
?
'已完成'
:
'待清洁'
),
(
'设备开关'
,
room
[
'devicePowerStatus'
]
==
'1'
?
'开'
:
'关'
),
];
return
Column
(
children:
items
.
map
((
item
)
{
return
Padding
(
padding:
EdgeInsets
.
only
(
bottom:
16
.
h
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Text
(
item
.
$
1
,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1
),
),
),
Text
(
item
.
$
2
,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
),
fontWeight:
FontWeight
.
w500
,
),
),
],
),
);
}).
toList
(),
);
}
Widget
_buildRoomGrid
(
ServiceIndexCubit
cubit
)
{
final
filteredRooms
=
_getFilteredRooms
(
cubit
);
Widget
_buildRoomGrid
(
ServiceIndex
State
state
,
ServiceIndex
Cubit
cubit
)
{
final
filteredRooms
=
cubit
.
getFilteredRooms
(
);
const
crossAxisCount
=
12
;
final
floorPart
=
state
.
selectedFloor
?.
replaceAll
(
'楼'
,
''
)
??
''
;
final
filterLabel
=
floorPart
.
isNotEmpty
?
'客房
$floorPart
楼·左右滑动选择'
:
'左右滑动选择'
;
return
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
...
...
@@ -338,7 +250,7 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Text
(
_buildFilterLabel
()
,
filterLabel
,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1
),
...
...
@@ -353,20 +265,20 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
),
],
),
SizedBox
(
height:
1
0
.
h
),
SizedBox
(
height:
1
8
.
h
),
if
(
filteredRooms
.
isEmpty
)
Container
(
width:
double
.
infinity
,
padding:
EdgeInsets
.
symmetric
(
vertical:
40
.
h
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
15
.
r
),
borderRadius:
BorderRadius
.
circular
(
8
.
r
),
color:
const
Color
.
fromRGBO
(
245
,
245
,
245
,
1
),
),
child:
Center
(
child:
Text
(
'未找到匹配的房间'
,
style:
TextStyle
(
fontSize:
15
.
sp
,
fontSize:
24
.
sp
,
color:
const
Color
.
fromRGBO
(
153
,
153
,
153
,
1
),
),
),
...
...
@@ -375,25 +287,23 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
else
SingleChildScrollView
(
scrollDirection:
Axis
.
horizontal
,
controller:
_scrollController
,
child:
SizedBox
(
width:
(
120
.
w
+
12
.
w
)
*
crossAxisCount
,
child:
GridView
.
builder
(
shrinkWrap:
true
,
physics:
const
NeverScrollableScrollPhysics
(),
padding:
EdgeInsets
.
zero
,
gridDelegate:
const
SliverGridDelegateWithFixedCrossAxisCount
(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
crossAxisCount
,
crossAxisSpacing:
12
,
mainAxisSpacing:
12
,
crossAxisSpacing:
12
.
w
,
mainAxisSpacing:
12
.
h
,
childAspectRatio:
1
,
),
itemCount:
filteredRooms
.
length
,
itemBuilder:
(
context
,
index
)
{
final
room
=
filteredRooms
[
index
];
final
isSelected
=
_
selectedRoom
==
room
[
'number'
];
return
_buildRoomItem
(
room
,
isSelected
);
final
isSelected
=
state
.
selectedRoom
==
room
[
'number'
];
return
_buildRoomItem
(
room
,
isSelected
,
cubit
);
},
),
),
...
...
@@ -402,20 +312,18 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
);
}
Widget
_buildRoomItem
(
Map
<
String
,
dynamic
>
room
,
bool
isSelected
)
{
Widget
_buildRoomItem
(
Map
<
String
,
dynamic
>
room
,
bool
isSelected
,
ServiceIndexCubit
cubit
)
{
final
status
=
room
[
'status'
]
as
String
;
Color
backgroundColor
;
Color
borderColor
;
Color
textColor
;
Color
statusTextColor
;
switch
(
status
)
{
case
'入住'
:
backgroundColor
=
const
Color
.
fromRGBO
(
22
0
,
236
,
255
,
1
);
backgroundColor
=
const
Color
.
fromRGBO
(
22
9
,
241
,
255
,
1
);
borderColor
=
isSelected
?
const
Color
.
fromRGBO
(
64
,
158
,
255
,
1
)
?
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
)
:
Colors
.
transparent
;
textColor
=
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1
);
statusTextColor
=
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
);
textColor
=
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
);
break
;
case
'待清洁'
:
backgroundColor
=
const
Color
.
fromRGBO
(
238
,
238
,
238
,
1
);
...
...
@@ -423,7 +331,6 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
?
const
Color
.
fromRGBO
(
64
,
158
,
255
,
1
)
:
Colors
.
transparent
;
textColor
=
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1
);
statusTextColor
=
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
);
break
;
case
'空闲'
:
default
:
...
...
@@ -432,37 +339,37 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
?
const
Color
.
fromRGBO
(
64
,
158
,
255
,
1
)
:
Colors
.
transparent
;
textColor
=
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1
);
statusTextColor
=
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
);
}
return
GestureDetector
(
onTap:
()
{
setState
(()
{
_selectedRoom
=
room
[
'number'
]
as
String
;
_selectedRoomId
=
room
[
'roomId'
]
as
int
?;
});
},
onTap:
()
=>
cubit
.
selectRoom
(
room:
room
[
'number'
]
as
String
,
roomId:
room
[
'roomId'
]
as
int
?,
),
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
1
2
.
r
),
borderRadius:
BorderRadius
.
circular
(
1
6
.
r
),
color:
backgroundColor
,
border:
Border
.
all
(
color:
borderColor
,
width:
isSelected
?
3
.
w
:
0
,
width:
isSelected
?
1
.
w
:
0
,
),
),
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
spacing:
6
.
h
,
children:
[
Text
(
room
[
'number'
]
as
String
,
style:
TextStyle
(
fontSize:
28
.
sp
,
fontWeight:
FontWeight
.
bold
,
fontWeight:
FontWeight
.
w500
,
color:
textColor
,
),
textAlign:
TextAlign
.
center
,
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
,
),
SizedBox
(
height:
6
.
h
),
Builder
(
builder:
(
context
)
{
if
(
status
==
'入住'
)
{
...
...
@@ -470,7 +377,7 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
'入住'
,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
statusTextColor
,
color:
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
)
,
),
);
}
else
if
(
status
==
'待清洁'
)
{
...
...
@@ -484,7 +391,7 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
' '
,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
statusTextColor
,
color:
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
)
,
),
);
}
...
...
@@ -496,17 +403,18 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
);
}
Widget
_buildBottomButtons
(
ServiceIndex
Cubit
cubi
t
)
{
final
isRoomSelected
=
_
selectedRoom
!=
null
;
final
isProcessing
=
cubit
.
state
.
isPoweringOn
||
cubit
.
state
.
isPoweringOff
;
Widget
_buildBottomButtons
(
ServiceIndex
State
state
,
ServiceIndexCubit
cubit
,
BuildContext
contex
t
)
{
final
isRoomSelected
=
state
.
selectedRoom
!=
null
;
final
isProcessing
=
state
.
isPoweringOn
||
state
.
isPoweringOff
;
return
Row
(
spacing:
16
.
w
,
children:
[
Expanded
(
child:
ElevatedButton
(
style:
ElevatedButton
.
styleFrom
(
backgroundColor:
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
),
disabledBackgroundColor:
const
Color
.
fromRGBO
(
204
,
204
,
204
,
1
),
minimumSize:
Size
(
double
.
infinity
,
88
.
h
),
minimumSize:
Size
(
double
.
infinity
,
70
.
h
),
padding:
EdgeInsets
.
zero
,
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
16
.
r
),
...
...
@@ -516,7 +424,7 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
onPressed:
isRoomSelected
&&
!
isProcessing
?
()
async
{
try
{
await
cubit
.
powerOnRoom
(
_
selectedRoom
!);
await
cubit
.
powerOnRoom
(
state
.
selectedRoom
!);
if
(
context
.
mounted
)
{
showToast
(
'送电成功'
);
}
...
...
@@ -536,19 +444,18 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
),
),
),
SizedBox
(
width:
16
.
w
),
Expanded
(
child:
ElevatedButton
(
style:
ElevatedButton
.
styleFrom
(
backgroundColor:
const
Color
.
fromRGBO
(
229
,
241
,
255
,
1
),
disabledBackgroundColor:
const
Color
.
fromRGBO
(
204
,
204
,
204
,
1
),
minimumSize:
Size
(
double
.
infinity
,
88
.
h
),
minimumSize:
Size
(
double
.
infinity
,
70
.
h
),
padding:
EdgeInsets
.
zero
,
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
16
.
r
),
side:
const
BorderSide
(
color:
Color
.
fromRGBO
(
73
,
149
,
234
,
1
),
width:
1
,
side:
BorderSide
(
color:
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
),
width:
1
.
w
,
),
),
elevation:
0
,
...
...
@@ -556,7 +463,7 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
onPressed:
isRoomSelected
&&
!
isProcessing
?
()
async
{
try
{
await
cubit
.
powerOffRoom
(
_
selectedRoom
!);
await
cubit
.
powerOffRoom
(
state
.
selectedRoom
!);
if
(
context
.
mounted
)
{
showToast
(
'断电成功'
);
}
...
...
@@ -576,24 +483,23 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
),
),
),
SizedBox
(
width:
16
.
w
),
Expanded
(
child:
ElevatedButton
(
style:
ElevatedButton
.
styleFrom
(
backgroundColor:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
0.2
),
disabledBackgroundColor:
const
Color
.
fromRGBO
(
204
,
204
,
204
,
1
),
minimumSize:
Size
(
double
.
infinity
,
88
.
h
),
minimumSize:
Size
(
double
.
infinity
,
70
.
h
),
padding:
EdgeInsets
.
zero
,
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
16
.
r
),
),
elevation:
0
,
),
onPressed:
(
isRoomSelected
&&
_
selectedRoomId
!=
null
)
onPressed:
(
isRoomSelected
&&
state
.
selectedRoomId
!=
null
)
?
()
{
context
.
pushRoute
(
ServiceRoomDetailRoute
(
roomId:
_
selectedRoomId
!,
roomNumber:
_
selectedRoom
,
roomId:
state
.
selectedRoomId
!,
roomNumber:
state
.
selectedRoom
,
));
}
:
null
,
...
...
@@ -610,3 +516,58 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
);
}
}
/// 搜索框 — 独立 StatefulWidget 管理 TextEditingController
class
_SearchBox
extends
StatefulWidget
{
final
String
?
selectedFloor
;
final
ValueChanged
<
String
>
onChanged
;
const
_SearchBox
({
required
this
.
selectedFloor
,
required
this
.
onChanged
});
@override
State
<
_SearchBox
>
createState
()
=>
_SearchBoxState
();
}
class
_SearchBoxState
extends
State
<
_SearchBox
>
{
final
TextEditingController
_controller
=
TextEditingController
();
String
?
_lastFloor
;
@override
void
didUpdateWidget
(
covariant
_SearchBox
oldWidget
)
{
super
.
didUpdateWidget
(
oldWidget
);
if
(
widget
.
selectedFloor
!=
_lastFloor
&&
widget
.
selectedFloor
!=
null
)
{
_controller
.
clear
();
}
_lastFloor
=
widget
.
selectedFloor
;
}
@override
void
dispose
()
{
_controller
.
dispose
();
super
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
TextField
(
controller:
_controller
,
onChanged:
widget
.
onChanged
,
style:
TextStyle
(
fontSize:
28
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1
),
),
decoration:
InputDecoration
(
hintText:
'输入房号快速查找,如301...'
,
hintStyle:
TextStyle
(
fontSize:
26
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1
),
),
border:
InputBorder
.
none
,
contentPadding:
EdgeInsets
.
symmetric
(
vertical:
16
.
h
),
isCollapsed:
true
,
),
);
}
}
lib/views/service/index/widget/service_head_block.dart
View file @
59e6cf59
...
...
@@ -6,7 +6,6 @@ class ServiceHeadBlock extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
final
screenWidth
=
MediaQuery
.
of
(
context
).
size
.
width
;
return
Stack
(
clipBehavior:
Clip
.
none
,
children:
[
...
...
@@ -21,7 +20,7 @@ class ServiceHeadBlock extends StatelessWidget {
),
Container
(
height:
150
.
h
,
padding:
EdgeInsets
.
only
(
top:
ScreenUtil
().
statusBarHeight
,
left:
20
.
w
,
right:
20
.
w
),
padding:
EdgeInsets
.
only
(
top:
ScreenUtil
().
statusBarHeight
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
...
...
@@ -31,26 +30,31 @@ class ServiceHeadBlock extends StatelessWidget {
fontSize:
32
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
const
Color
.
fromRGBO
(
0
,
0
,
0
,
1
),
fontFamily:
'FZLTXH'
,
),
),
Container
(
width:
64
.
w
,
height:
64
.
w
,
height:
64
.
h
,
alignment:
Alignment
.
center
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
229
,
241
,
255
,
1
),
shape:
BoxShape
.
circle
,
border:
Border
.
all
(
color:
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
),
width:
1
.
w
,
width:
2
.
w
,
),
),
child:
CircleAvatar
(
radius:
40
.
w
,
backgroundColor:
Colors
.
white
,
child:
Container
(
width:
40
.
w
,
height:
40
.
h
,
decoration:
const
BoxDecoration
(
color:
Color
.
fromRGBO
(
73
,
149
,
234
,
1
),
shape:
BoxShape
.
circle
,
),
child:
Icon
(
Icons
.
person
,
color:
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
)
,
size:
4
8
.
sp
,
color:
Colors
.
white
,
size:
2
8
.
sp
,
),
),
),
...
...
@@ -60,4 +64,5 @@ class ServiceHeadBlock extends StatelessWidget {
],
);
}
}
lib/views/service/index/widget/service_stats_block.dart
View file @
59e6cf59
...
...
@@ -18,64 +18,40 @@ class ServiceStatsBlock extends StatelessWidget {
return
Container
(
width:
double
.
infinity
,
padding:
EdgeInsets
.
only
(
top:
20
.
w
,
bottom:
20
.
w
),
decoration:
BoxDecoration
(
// borderRadius: BorderRadius.circular(24.r),
color:
Color
.
fromRGBO
(
242
,
243
,
245
,
1.0
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
child:
Row
(
spacing:
12
.
w
,
children:
[
// Text(
// '服务概览',
// style: TextStyle(
// fontSize: 28.sp,
// fontWeight: FontWeight.bold,
// color: const Color.fromRGBO(31, 41, 55, 1),
// ),
// ),
// SizedBox(height: 20.h),
Row
(
children:
[
_buildStatCard
(
'待响应需求'
,
'
$pendingCount
'
,
const
Color
.
fromRGBO
(
239
,
68
,
68
,
1
),
Icons
.
warning_amber_rounded
,
),
SizedBox
(
width:
12
.
w
),
_buildStatCard
(
'入住中'
,
'
$occupiedCount
'
,
const
Color
.
fromRGBO
(
34
,
197
,
94
,
1
),
Icons
.
meeting_room_outlined
,
),
SizedBox
(
width:
12
.
w
),
_buildStatCard
(
'空闲可清洁'
,
'
$vacantCount
'
,
const
Color
.
fromRGBO
(
59
,
130
,
246
,
1
),
Icons
.
cleaning_services_outlined
,
),
],
_buildStatCard
(
'待响应'
,
'
$pendingCount
'
,
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
),
),
_buildStatCard
(
'入住中'
,
'
$occupiedCount
'
,
const
Color
.
fromRGBO
(
20
,
184
,
166
,
1
),
),
_buildStatCard
(
'空闲可清洁'
,
'
$vacantCount
'
,
const
Color
.
fromRGBO
(
10
,
13
,
20
,
1
),
),
],
),
);
}
Widget
_buildStatCard
(
String
label
,
String
value
,
Color
color
,
IconData
icon
)
{
Widget
_buildStatCard
(
String
label
,
String
value
,
Color
color
)
{
return
Expanded
(
child:
Container
(
padding:
EdgeInsets
.
all
(
16
.
w
),
padding:
EdgeInsets
.
symmetric
(
vertical:
16
.
h
),
decoration:
BoxDecoration
(
color:
color
.
withOpacity
(
0.08
)
,
borderRadius:
BorderRadius
.
circular
(
16
.
r
),
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
24
.
r
),
),
child:
Column
(
spacing:
5
.
h
,
children:
[
// Icon(icon, color: color, size: 28.sp),
SizedBox
(
height:
8
.
h
),
Text
(
value
,
style:
TextStyle
(
...
...
@@ -84,12 +60,11 @@ class ServiceStatsBlock extends StatelessWidget {
color:
color
,
),
),
SizedBox
(
height:
4
.
h
),
Text
(
label
,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
const
Color
.
fromRGBO
(
10
7
,
114
,
128
,
1
),
color:
const
Color
.
fromRGBO
(
10
0
,
116
,
139
,
1
),
),
),
],
...
...
lib/views/service/room/room_detail_view.dart
View file @
59e6cf59
...
...
@@ -55,7 +55,7 @@ class ServiceRoomDetailView extends StatelessWidget {
builder:
(
context
,
state
)
{
if
(
state
.
isLoading
)
{
return
const
Center
(
child:
CircularProgressIndicator
(),
child:
CircularProgressIndicator
(
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
)
),
);
}
...
...
@@ -117,7 +117,7 @@ class ServiceRoomDetailView extends StatelessWidget {
onDeviceToggle:
(
index
,
value
)
=>
cubit
.
toggleControlDevice
(
index
,
value
),
onDeviceTap:
(
index
,
device
)
{
if
(
device
.
name
==
'空调'
||
device
.
name
?.
contains
(
'空调'
)
==
true
)
{
if
(
device
.
name
.
contains
(
'空调'
)
)
{
context
.
pushRoute
(
ServiceDeviceDetailRoute
(
deviceId:
device
.
deviceId
));
}
},
...
...
lib/views/service/room/widget/device_control_card.dart
View file @
59e6cf59
...
...
@@ -49,7 +49,7 @@ class DeviceControlCard extends StatelessWidget {
color:
const
Color
.
fromRGBO
(
10
,
13
,
20
,
1.0
),
),
),
SizedBox
(
height:
2
0
.
h
),
SizedBox
(
height:
3
0
.
h
),
...
controlDevices
.
asMap
().
entries
.
map
((
entry
)
{
final
index
=
entry
.
key
;
final
device
=
entry
.
value
;
...
...
@@ -71,10 +71,11 @@ class DeviceControlCard extends StatelessWidget {
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Row
(
spacing:
16
.
w
,
children:
[
Container
(
width:
64
.
w
,
height:
64
.
h
,
height:
53
.
h
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
235
,
244
,
255
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
12
.
r
),
...
...
@@ -85,7 +86,6 @@ class DeviceControlCard extends StatelessWidget {
size:
36
.
sp
,
),
),
SizedBox
(
width:
16
.
w
),
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
...
...
@@ -109,27 +109,24 @@ class DeviceControlCard extends StatelessWidget {
],
),
FlutterSwitch
(
width:
48.0
,
height:
25.0
,
width:
80
.
w
,
height:
35
.
h
,
valueFontSize:
20
.
sp
,
toggleSize:
25
.
h
,
borderRadius:
20
.
r
,
padding:
4
.
w
,
value:
mainPowerOn
,
showOnOff:
false
,
onToggle:
onMainPowerToggle
activeColor:
const
Color
.
fromRGBO
(
80
,
162
,
255
,
1
),
inactiveColor:
const
Color
.
fromRGBO
(
210
,
213
,
218
,
1
),
onToggle:
onMainPowerToggle
,
),
// FlutterSwitch(
// value: mainPowerOn,
// onToggle: onMainPowerToggle,
// activeColor: const Color.fromRGBO(59, 130, 246, 1),
// inactiveColor: const Color.fromRGBO(209, 213, 219, 1),
// width: 50.w,
// height: 28.h,
// // toggleSize: 26,
// ),
],
),
SizedBox
(
height:
2
0
.
h
),
SizedBox
(
height:
3
0
.
h
),
Divider
(
color:
const
Color
.
fromRGBO
(
242
,
243
,
245
,
1.0
),
thickness:
1
.
h
,
height:
0.5
.
h
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
0.2
),
thickness:
0.5
,
),
],
);
...
...
@@ -147,65 +144,47 @@ class DeviceControlCard extends StatelessWidget {
color:
Colors
.
transparent
,
child:
InkWell
(
onTap:
onDeviceTap
!=
null
?
()
=>
onDeviceTap
!(
index
,
device
)
:
null
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
child:
Row
(
children:
[
Row
(
children:
[
Icon
(
device
.
icon
,
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
size:
36
.
sp
,
),
SizedBox
(
width:
8
.
w
),
Text
(
device
.
name
,
style:
TextStyle
(
fontSize:
28
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
const
Color
.
fromRGBO
(
10
,
13
,
20
,
1.0
),
),
),
],
Icon
(
device
.
icon
,
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
size:
36
.
sp
,
),
if
(
device
.
detailText
!=
null
)
...[
SizedBox
(
height:
8
.
h
),
Text
(
device
.
detailText
!,
style:
TextStyle
(
fontSize:
24
.
sp
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
),
SizedBox
(
width:
8
.
w
),
Text
(
device
.
name
,
style:
TextStyle
(
fontSize:
28
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
const
Color
.
fromRGBO
(
10
,
13
,
20
,
1.0
),
),
]
,
)
,
],
),
),
),
),
FlutterSwitch
(
width:
48.0
,
height:
25.0
,
width:
80
.
w
,
height:
35
.
h
,
valueFontSize:
20
.
sp
,
toggleSize:
25
.
h
,
borderRadius:
20
.
r
,
padding:
4
.
w
,
value:
device
.
isOn
,
showOnOff:
false
,
activeColor:
const
Color
.
fromRGBO
(
80
,
162
,
255
,
1
),
inactiveColor:
const
Color
.
fromRGBO
(
210
,
213
,
218
,
1
),
onToggle:
(
value
)
=>
onDeviceToggle
(
index
,
value
),
),
// FlutterSwitch(
// value: device.isOn,
// onToggle: (value) => onDeviceToggle(index, value),
// activeColor: const Color.fromRGBO(66, 165, 245, 1.0),
// inactiveColor: const Color.fromRGBO(200, 208, 220, 1.0),
// width: 60.w,
// height: 30.h,
// toggleSize: 26,
// ),
],
),
if
(
index
<
controlDevices
.
length
-
1
)
...[
SizedBox
(
height:
2
0
.
h
),
SizedBox
(
height:
3
0
.
h
),
Divider
(
color:
const
Color
.
fromRGBO
(
242
,
243
,
245
,
1.0
),
thickness:
1
.
h
,
height:
0.5
.
h
,
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
0.2
),
thickness:
0.5
,
),
],
],
...
...
lib/views/service/room/widget/room_bottom_buttons.dart
View file @
59e6cf59
...
...
@@ -4,59 +4,59 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
class
RoomBottomButtons
extends
StatelessWidget
{
final
VoidCallback
?
onPowerOn
;
final
VoidCallback
?
onPowerOff
;
final
VoidCallback
?
onDeviceControl
;
//
final VoidCallback? onDeviceControl;
final
bool
isProcessing
;
const
RoomBottomButtons
({
super
.
key
,
this
.
onPowerOn
,
this
.
onPowerOff
,
this
.
onDeviceControl
,
//
this.onDeviceControl,
this
.
isProcessing
=
false
,
});
@override
Widget
build
(
BuildContext
context
)
{
return
Row
(
spacing:
12
.
w
,
children:
[
Expanded
(
child:
GestureDetector
(
onTap:
(
onPowerOn
!=
null
&&
!
isProcessing
)
?
onPowerOn
:
null
,
child:
Container
(
height:
88
.
h
,
height:
70
.
h
,
decoration:
BoxDecoration
(
color:
(
onPowerOn
!=
null
&&
!
isProcessing
)
?
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
)
?
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
)
:
const
Color
.
fromRGBO
(
204
,
204
,
204
,
1
),
borderRadius:
BorderRadius
.
circular
(
20
.
r
),
borderRadius:
BorderRadius
.
circular
(
16
.
r
),
),
child:
Center
(
child:
Text
(
'送电'
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
32
.
sp
,
fontWeight:
FontWeight
.
bold
,
fontSize:
28
.
sp
,
fontWeight:
FontWeight
.
w500
,
),
),
),
),
),
),
SizedBox
(
width:
12
.
w
),
Expanded
(
child:
GestureDetector
(
onTap:
(
onPowerOff
!=
null
&&
!
isProcessing
)
?
onPowerOff
:
null
,
child:
Container
(
height:
88
.
h
,
height:
70
.
h
,
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20
.
r
),
color:
const
Color
.
fromRGBO
(
229
,
241
,
255
,
1
)
,
borderRadius:
BorderRadius
.
circular
(
16
.
r
),
border:
Border
.
all
(
color:
(
onPowerOff
!=
null
&&
!
isProcessing
)
?
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
)
?
const
Color
.
fromRGBO
(
73
,
149
,
234
,
1
)
:
const
Color
.
fromRGBO
(
204
,
204
,
204
,
1
),
width:
2
.
w
,
width:
1
.
w
,
),
),
child:
Center
(
...
...
@@ -66,37 +66,36 @@ class RoomBottomButtons extends StatelessWidget {
color:
(
onPowerOff
!=
null
&&
!
isProcessing
)
?
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
)
:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1
),
fontSize:
32
.
sp
,
fontWeight:
FontWeight
.
bold
,
),
),
),
),
),
),
SizedBox
(
width:
12
.
w
),
Expanded
(
child:
GestureDetector
(
onTap:
onDeviceControl
,
child:
Container
(
height:
88
.
h
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
200
,
208
,
220
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
20
.
r
),
),
child:
Center
(
child:
Text
(
'设备控制'
,
style:
TextStyle
(
color:
const
Color
.
fromRGBO
(
100
,
116
,
139
,
1.0
),
fontSize:
32
.
sp
,
fontWeight:
FontWeight
.
bold
,
fontSize:
28
.
sp
,
fontWeight:
FontWeight
.
w500
,
),
),
),
),
),
),
// Expanded(
// child: GestureDetector(
// onTap: onDeviceControl,
// child: Container(
// height: 70.h,
// decoration: BoxDecoration(
// color: const Color.fromRGBO(100, 116, 139, 0.2),
// borderRadius: BorderRadius.circular(16.r),
// ),
// child: Center(
// child: Text(
// '设备控制',
// style: TextStyle(
// color: const Color.fromRGBO(100, 116, 139, 1.0),
// fontSize: 28.sp,
// fontWeight: FontWeight.w500,
// ),
// ),
// ),
// ),
// ),
// ),
],
);
}
...
...
lib/views/service/room/widget/room_device_status_card.dart
View file @
59e6cf59
...
...
@@ -20,6 +20,7 @@ class RoomDeviceStatusCard extends StatelessWidget {
padding:
EdgeInsets
.
symmetric
(
horizontal:
24
.
w
,
vertical:
24
.
h
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
spacing:
20
.
h
,
children:
[
Text
(
'房间设备状态'
,
...
...
@@ -29,7 +30,6 @@ class RoomDeviceStatusCard extends StatelessWidget {
color:
const
Color
.
fromRGBO
(
10
,
13
,
20
,
1.0
),
),
),
SizedBox
(
height:
20
.
h
),
GridView
.
builder
(
shrinkWrap:
true
,
physics:
const
NeverScrollableScrollPhysics
(),
...
...
@@ -37,7 +37,7 @@ class RoomDeviceStatusCard extends StatelessWidget {
crossAxisCount:
2
,
crossAxisSpacing:
16
.
w
,
mainAxisSpacing:
16
.
h
,
childAspectRatio:
2
,
childAspectRatio:
2
.5
,
),
itemCount:
devices
.
length
,
itemBuilder:
(
context
,
index
)
{
...
...
@@ -47,18 +47,20 @@ class RoomDeviceStatusCard extends StatelessWidget {
color:
const
Color
.
fromRGBO
(
235
,
244
,
255
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
28
.
r
),
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
20
.
w
,
vertical:
16
.
h
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
20
.
w
),
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
spacing:
8
.
h
,
children:
[
Row
(
spacing:
8
.
w
,
children:
[
Icon
(
device
.
icon
,
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
size:
36
.
sp
,
),
SizedBox
(
width:
8
.
w
),
Text
(
device
.
name
,
style:
TextStyle
(
...
...
@@ -69,7 +71,6 @@ class RoomDeviceStatusCard extends StatelessWidget {
),
],
),
SizedBox
(
height:
12
.
h
),
if
(
device
.
statusText
!=
null
)
Text
(
device
.
statusText
!,
...
...
lib/views/service/room/widget/room_overview_card.dart
View file @
59e6cf59
...
...
@@ -24,12 +24,13 @@ class RoomOverviewCard extends StatelessWidget {
padding:
EdgeInsets
.
symmetric
(
horizontal:
24
.
w
,
vertical:
24
.
h
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
spacing:
24
.
h
,
children:
[
Row
(
children:
[
Container
(
width:
88
.
w
,
height:
88
.
h
,
width:
64
.
w
,
height:
53
.
h
,
decoration:
BoxDecoration
(
color:
const
Color
.
fromRGBO
(
235
,
244
,
255
,
1.0
),
borderRadius:
BorderRadius
.
circular
(
16
.
r
),
...
...
@@ -41,34 +42,24 @@ class RoomOverviewCard extends StatelessWidget {
),
),
SizedBox
(
width:
20
.
w
),
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Row
(
children:
[
Text
(
roomNumber
,
style:
TextStyle
(
fontSize:
36
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
const
Color
.
fromRGBO
(
10
,
13
,
20
,
1.0
),
),
),
SizedBox
(
width:
12
.
w
),
Text
(
roomStatus
,
style:
TextStyle
(
fontSize:
28
.
sp
,
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
),
),
],
),
],
Text
(
roomNumber
,
style:
TextStyle
(
fontSize:
36
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
const
Color
.
fromRGBO
(
10
,
13
,
20
,
1.0
),
),
),
SizedBox
(
width:
12
.
w
),
Text
(
roomStatus
,
style:
TextStyle
(
fontSize:
28
.
sp
,
color:
const
Color
.
fromRGBO
(
66
,
165
,
245
,
1.0
),
),
),
],
),
SizedBox
(
height:
24
.
h
),
Wrap
(
spacing:
8
.
w
,
children:
statusTags
.
map
((
tag
)
{
...
...
@@ -80,13 +71,13 @@ class RoomOverviewCard extends StatelessWidget {
),
child:
Row
(
mainAxisSize:
MainAxisSize
.
min
,
spacing:
4
.
w
,
children:
[
Icon
(
Icons
.
check
,
color:
const
Color
.
fromRGBO
(
26
,
188
,
156
,
1.0
),
size:
20
.
sp
,
),
SizedBox
(
width:
4
.
w
),
Text
(
_getTagLabel
(
tag
),
style:
TextStyle
(
...
...
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