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
4794c6da
Commit
4794c6da
authored
May 20, 2026
by
张宏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f3f8e77a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
896 additions
and
117 deletions
+896
-117
app_router.dart
lib/routes/app_router.dart
+2
-1
app_router.gr.dart
lib/routes/app_router.gr.dart
+85
-63
abnormal_detail_view.dart
lib/views/home/abnormal/abnormal_detail_view.dart
+51
-25
controller.dart
lib/views/home/abnormal/controller.dart
+11
-0
device_parms_block.dart
lib/views/home/device/child/device_parms_block.dart
+93
-0
power_char_block.dart
lib/views/home/device/child/power_char_block.dart
+132
-0
state_info_block.dart
lib/views/home/device/child/state_info_block.dart
+69
-0
controller.dart
lib/views/home/device/controller.dart
+16
-0
device_detail_view.dart
lib/views/home/device/device_detail_view.dart
+125
-0
voltage_operate_block.dart
lib/views/home/index/child/voltage_operate_block.dart
+9
-3
controller.dart
lib/views/home/index/controller.dart
+5
-4
index_view.dart
lib/views/home/index/index_view.dart
+1
-1
default_view.dart
lib/views/layout/default_view.dart
+1
-1
index_view.dart
lib/views/news/index_view.dart
+0
-19
room_management_block.dart
lib/views/service/index/child/room_management_block.dart
+0
-0
service_head_block.dart
lib/views/service/index/child/service_head_block.dart
+90
-0
service_stats_block.dart
lib/views/service/index/child/service_stats_block.dart
+76
-0
controller.dart
lib/views/service/index/controller.dart
+76
-0
index_view.dart
lib/views/service/index/index_view.dart
+54
-0
No files found.
lib/routes/app_router.dart
View file @
4794c6da
...
@@ -14,12 +14,13 @@ class AppRouter extends $AppRouter {
...
@@ -14,12 +14,13 @@ class AppRouter extends $AppRouter {
page:
DefaultLayoutRoute
.
page
,
page:
DefaultLayoutRoute
.
page
,
children:
[
children:
[
AutoRoute
(
page:
HomeRoute
.
page
,
initial:
true
),
AutoRoute
(
page:
HomeRoute
.
page
,
initial:
true
),
AutoRoute
(
page:
News
Route
.
page
),
AutoRoute
(
page:
ServiceIndex
Route
.
page
),
AutoRoute
(
page:
MessageRoute
.
page
),
AutoRoute
(
page:
MessageRoute
.
page
),
AutoRoute
(
page:
ProfileRoute
.
page
),
AutoRoute
(
page:
ProfileRoute
.
page
),
],
],
),
),
AutoRoute
(
page:
SearchRoute
.
page
),
AutoRoute
(
page:
SearchRoute
.
page
),
AutoRoute
(
page:
AbnormalDetailRoute
.
page
),
AutoRoute
(
page:
AbnormalDetailRoute
.
page
),
AutoRoute
(
page:
DeviceDetailRoute
.
page
),
];
];
}
}
lib/routes/app_router.gr.dart
View file @
4794c6da
...
@@ -8,61 +8,63 @@
...
@@ -8,61 +8,63 @@
// coverage:ignore-file
// coverage:ignore-file
// ignore_for_file: no_leading_underscores_for_library_prefixes
// ignore_for_file: no_leading_underscores_for_library_prefixes
import
'package:auto_route/auto_route.dart'
as
_i
9
;
import
'package:auto_route/auto_route.dart'
as
_i
10
;
import
'package:flutter/material.dart'
as
_i1
0
;
import
'package:flutter/material.dart'
as
_i1
1
;
import
'package:smart_hotel_app/views/home/abnormal/abnormal_detail_view.dart'
import
'package:smart_hotel_app/views/home/abnormal/abnormal_detail_view.dart'
as
_i1
;
as
_i1
;
import
'package:smart_hotel_app/views/home/index/index_view.dart'
as
_i3
;
import
'package:smart_hotel_app/views/home/device/device_detail_view.dart'
as
_i3
;
import
'package:smart_hotel_app/views/home/index/index_view.dart'
as
_i4
;
import
'package:smart_hotel_app/views/layout/default_view.dart'
as
_i2
;
import
'package:smart_hotel_app/views/layout/default_view.dart'
as
_i2
;
import
'package:smart_hotel_app/views/login/login_view.dart'
as
_i4
;
import
'package:smart_hotel_app/views/login/login_view.dart'
as
_i5
;
import
'package:smart_hotel_app/views/message/index_view.dart'
as
_i5
;
import
'package:smart_hotel_app/views/message/index_view.dart'
as
_i6
;
import
'package:smart_hotel_app/views/news/index_view.dart'
as
_i6
;
import
'package:smart_hotel_app/views/profile/index_view.dart'
as
_i7
;
import
'package:smart_hotel_app/views/profile/index_view.dart'
as
_i7
;
import
'package:smart_hotel_app/views/search/index_view.dart'
as
_i8
;
import
'package:smart_hotel_app/views/search/index_view.dart'
as
_i8
;
import
'package:smart_hotel_app/views/service/index/index_view.dart'
as
_i9
;
abstract
class
$
AppRouter
extends
_i
9
.
RootStackRouter
{
abstract
class
$
AppRouter
extends
_i
10
.
RootStackRouter
{
$AppRouter
({
super
.
navigatorKey
});
$AppRouter
({
super
.
navigatorKey
});
@override
@override
final
Map
<
String
,
_i
9
.
PageFactory
>
pagesMap
=
{
final
Map
<
String
,
_i
10
.
PageFactory
>
pagesMap
=
{
AbnormalDetailRoute
.
name
:
(
routeData
)
{
AbnormalDetailRoute
.
name
:
(
routeData
)
{
return
_i
9
.
AutoRoutePage
<
dynamic
>(
return
_i
10
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
routeData:
routeData
,
child:
const
_i1
.
AbnormalDetailView
(),
child:
const
_i1
.
AbnormalDetailView
(),
);
);
},
},
DefaultLayoutRoute
.
name
:
(
routeData
)
{
DefaultLayoutRoute
.
name
:
(
routeData
)
{
return
_i
9
.
AutoRoutePage
<
dynamic
>(
return
_i
10
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
routeData:
routeData
,
child:
const
_i2
.
DefaultLayoutView
(),
child:
const
_i2
.
DefaultLayoutView
(),
);
);
},
},
Home
Route
.
name
:
(
routeData
)
{
DeviceDetail
Route
.
name
:
(
routeData
)
{
return
_i
9
.
AutoRoutePage
<
dynamic
>(
return
_i
10
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
routeData:
routeData
,
child:
const
_i3
.
Home
View
(),
child:
const
_i3
.
DeviceDetail
View
(),
);
);
},
},
Login
Route
.
name
:
(
routeData
)
{
Home
Route
.
name
:
(
routeData
)
{
return
_i
9
.
AutoRoutePage
<
dynamic
>(
return
_i
10
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
routeData:
routeData
,
child:
const
_i4
.
Login
View
(),
child:
const
_i4
.
Home
View
(),
);
);
},
},
Message
Route
.
name
:
(
routeData
)
{
Login
Route
.
name
:
(
routeData
)
{
return
_i
9
.
AutoRoutePage
<
dynamic
>(
return
_i
10
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
routeData:
routeData
,
child:
const
_i5
.
Message
View
(),
child:
const
_i5
.
Login
View
(),
);
);
},
},
News
Route
.
name
:
(
routeData
)
{
Message
Route
.
name
:
(
routeData
)
{
return
_i
9
.
AutoRoutePage
<
dynamic
>(
return
_i
10
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
routeData:
routeData
,
child:
const
_i6
.
News
View
(),
child:
const
_i6
.
Message
View
(),
);
);
},
},
ProfileRoute
.
name
:
(
routeData
)
{
ProfileRoute
.
name
:
(
routeData
)
{
return
_i
9
.
AutoRoutePage
<
dynamic
>(
return
_i
10
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
routeData:
routeData
,
child:
const
_i7
.
ProfileView
(),
child:
const
_i7
.
ProfileView
(),
);
);
...
@@ -70,7 +72,7 @@ abstract class $AppRouter extends _i9.RootStackRouter {
...
@@ -70,7 +72,7 @@ abstract class $AppRouter extends _i9.RootStackRouter {
SearchRoute
.
name
:
(
routeData
)
{
SearchRoute
.
name
:
(
routeData
)
{
final
args
=
routeData
.
argsAs
<
SearchRouteArgs
>(
final
args
=
routeData
.
argsAs
<
SearchRouteArgs
>(
orElse:
()
=>
const
SearchRouteArgs
());
orElse:
()
=>
const
SearchRouteArgs
());
return
_i
9
.
AutoRoutePage
<
dynamic
>(
return
_i
10
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
routeData:
routeData
,
child:
_i8
.
SearchView
(
child:
_i8
.
SearchView
(
key:
args
.
key
,
key:
args
.
key
,
...
@@ -78,13 +80,19 @@ abstract class $AppRouter extends _i9.RootStackRouter {
...
@@ -78,13 +80,19 @@ abstract class $AppRouter extends _i9.RootStackRouter {
),
),
);
);
},
},
ServiceIndexRoute
.
name
:
(
routeData
)
{
return
_i10
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
child:
const
_i9
.
ServiceIndexView
(),
);
},
};
};
}
}
/// generated route for
/// generated route for
/// [_i1.AbnormalDetailView]
/// [_i1.AbnormalDetailView]
class
AbnormalDetailRoute
extends
_i
9
.
PageRouteInfo
<
void
>
{
class
AbnormalDetailRoute
extends
_i
10
.
PageRouteInfo
<
void
>
{
const
AbnormalDetailRoute
({
List
<
_i
9
.
PageRouteInfo
>?
children
})
const
AbnormalDetailRoute
({
List
<
_i
10
.
PageRouteInfo
>?
children
})
:
super
(
:
super
(
AbnormalDetailRoute
.
name
,
AbnormalDetailRoute
.
name
,
initialChildren:
children
,
initialChildren:
children
,
...
@@ -92,13 +100,13 @@ class AbnormalDetailRoute extends _i9.PageRouteInfo<void> {
...
@@ -92,13 +100,13 @@ class AbnormalDetailRoute extends _i9.PageRouteInfo<void> {
static
const
String
name
=
'AbnormalDetailRoute'
;
static
const
String
name
=
'AbnormalDetailRoute'
;
static
const
_i
9
.
PageInfo
<
void
>
page
=
_i9
.
PageInfo
<
void
>(
name
);
static
const
_i
10
.
PageInfo
<
void
>
page
=
_i10
.
PageInfo
<
void
>(
name
);
}
}
/// generated route for
/// generated route for
/// [_i2.DefaultLayoutView]
/// [_i2.DefaultLayoutView]
class
DefaultLayoutRoute
extends
_i
9
.
PageRouteInfo
<
void
>
{
class
DefaultLayoutRoute
extends
_i
10
.
PageRouteInfo
<
void
>
{
const
DefaultLayoutRoute
({
List
<
_i
9
.
PageRouteInfo
>?
children
})
const
DefaultLayoutRoute
({
List
<
_i
10
.
PageRouteInfo
>?
children
})
:
super
(
:
super
(
DefaultLayoutRoute
.
name
,
DefaultLayoutRoute
.
name
,
initialChildren:
children
,
initialChildren:
children
,
...
@@ -106,69 +114,69 @@ class DefaultLayoutRoute extends _i9.PageRouteInfo<void> {
...
@@ -106,69 +114,69 @@ class DefaultLayoutRoute extends _i9.PageRouteInfo<void> {
static
const
String
name
=
'DefaultLayoutRoute'
;
static
const
String
name
=
'DefaultLayoutRoute'
;
static
const
_i
9
.
PageInfo
<
void
>
page
=
_i9
.
PageInfo
<
void
>(
name
);
static
const
_i
10
.
PageInfo
<
void
>
page
=
_i10
.
PageInfo
<
void
>(
name
);
}
}
/// generated route for
/// generated route for
/// [_i3.
Home
View]
/// [_i3.
DeviceDetail
View]
class
HomeRoute
extends
_i9
.
PageRouteInfo
<
void
>
{
class
DeviceDetailRoute
extends
_i10
.
PageRouteInfo
<
void
>
{
const
HomeRoute
({
List
<
_i9
.
PageRouteInfo
>?
children
})
const
DeviceDetailRoute
({
List
<
_i10
.
PageRouteInfo
>?
children
})
:
super
(
:
super
(
Home
Route
.
name
,
DeviceDetail
Route
.
name
,
initialChildren:
children
,
initialChildren:
children
,
);
);
static
const
String
name
=
'
Home
Route'
;
static
const
String
name
=
'
DeviceDetail
Route'
;
static
const
_i
9
.
PageInfo
<
void
>
page
=
_i9
.
PageInfo
<
void
>(
name
);
static
const
_i
10
.
PageInfo
<
void
>
page
=
_i10
.
PageInfo
<
void
>(
name
);
}
}
/// generated route for
/// generated route for
/// [_i4.
Login
View]
/// [_i4.
Home
View]
class
LoginRoute
extends
_i9
.
PageRouteInfo
<
void
>
{
class
HomeRoute
extends
_i10
.
PageRouteInfo
<
void
>
{
const
LoginRoute
({
List
<
_i9
.
PageRouteInfo
>?
children
})
const
HomeRoute
({
List
<
_i10
.
PageRouteInfo
>?
children
})
:
super
(
:
super
(
Login
Route
.
name
,
Home
Route
.
name
,
initialChildren:
children
,
initialChildren:
children
,
);
);
static
const
String
name
=
'
Login
Route'
;
static
const
String
name
=
'
Home
Route'
;
static
const
_i
9
.
PageInfo
<
void
>
page
=
_i9
.
PageInfo
<
void
>(
name
);
static
const
_i
10
.
PageInfo
<
void
>
page
=
_i10
.
PageInfo
<
void
>(
name
);
}
}
/// generated route for
/// generated route for
/// [_i5.
Message
View]
/// [_i5.
Login
View]
class
MessageRoute
extends
_i9
.
PageRouteInfo
<
void
>
{
class
LoginRoute
extends
_i10
.
PageRouteInfo
<
void
>
{
const
MessageRoute
({
List
<
_i9
.
PageRouteInfo
>?
children
})
const
LoginRoute
({
List
<
_i10
.
PageRouteInfo
>?
children
})
:
super
(
:
super
(
Message
Route
.
name
,
Login
Route
.
name
,
initialChildren:
children
,
initialChildren:
children
,
);
);
static
const
String
name
=
'
Message
Route'
;
static
const
String
name
=
'
Login
Route'
;
static
const
_i
9
.
PageInfo
<
void
>
page
=
_i9
.
PageInfo
<
void
>(
name
);
static
const
_i
10
.
PageInfo
<
void
>
page
=
_i10
.
PageInfo
<
void
>(
name
);
}
}
/// generated route for
/// generated route for
/// [_i6.
News
View]
/// [_i6.
Message
View]
class
NewsRoute
extends
_i9
.
PageRouteInfo
<
void
>
{
class
MessageRoute
extends
_i10
.
PageRouteInfo
<
void
>
{
const
NewsRoute
({
List
<
_i9
.
PageRouteInfo
>?
children
})
const
MessageRoute
({
List
<
_i10
.
PageRouteInfo
>?
children
})
:
super
(
:
super
(
News
Route
.
name
,
Message
Route
.
name
,
initialChildren:
children
,
initialChildren:
children
,
);
);
static
const
String
name
=
'
News
Route'
;
static
const
String
name
=
'
Message
Route'
;
static
const
_i
9
.
PageInfo
<
void
>
page
=
_i9
.
PageInfo
<
void
>(
name
);
static
const
_i
10
.
PageInfo
<
void
>
page
=
_i10
.
PageInfo
<
void
>(
name
);
}
}
/// generated route for
/// generated route for
/// [_i7.ProfileView]
/// [_i7.ProfileView]
class
ProfileRoute
extends
_i
9
.
PageRouteInfo
<
void
>
{
class
ProfileRoute
extends
_i
10
.
PageRouteInfo
<
void
>
{
const
ProfileRoute
({
List
<
_i
9
.
PageRouteInfo
>?
children
})
const
ProfileRoute
({
List
<
_i
10
.
PageRouteInfo
>?
children
})
:
super
(
:
super
(
ProfileRoute
.
name
,
ProfileRoute
.
name
,
initialChildren:
children
,
initialChildren:
children
,
...
@@ -176,16 +184,16 @@ class ProfileRoute extends _i9.PageRouteInfo<void> {
...
@@ -176,16 +184,16 @@ class ProfileRoute extends _i9.PageRouteInfo<void> {
static
const
String
name
=
'ProfileRoute'
;
static
const
String
name
=
'ProfileRoute'
;
static
const
_i
9
.
PageInfo
<
void
>
page
=
_i9
.
PageInfo
<
void
>(
name
);
static
const
_i
10
.
PageInfo
<
void
>
page
=
_i10
.
PageInfo
<
void
>(
name
);
}
}
/// generated route for
/// generated route for
/// [_i8.SearchView]
/// [_i8.SearchView]
class
SearchRoute
extends
_i
9
.
PageRouteInfo
<
SearchRouteArgs
>
{
class
SearchRoute
extends
_i
10
.
PageRouteInfo
<
SearchRouteArgs
>
{
SearchRoute
({
SearchRoute
({
_i1
0
.
Key
?
key
,
_i1
1
.
Key
?
key
,
String
?
searchKey
,
String
?
searchKey
,
List
<
_i
9
.
PageRouteInfo
>?
children
,
List
<
_i
10
.
PageRouteInfo
>?
children
,
})
:
super
(
})
:
super
(
SearchRoute
.
name
,
SearchRoute
.
name
,
args:
SearchRouteArgs
(
args:
SearchRouteArgs
(
...
@@ -197,8 +205,8 @@ class SearchRoute extends _i9.PageRouteInfo<SearchRouteArgs> {
...
@@ -197,8 +205,8 @@ class SearchRoute extends _i9.PageRouteInfo<SearchRouteArgs> {
static
const
String
name
=
'SearchRoute'
;
static
const
String
name
=
'SearchRoute'
;
static
const
_i
9
.
PageInfo
<
SearchRouteArgs
>
page
=
static
const
_i
10
.
PageInfo
<
SearchRouteArgs
>
page
=
_i
9
.
PageInfo
<
SearchRouteArgs
>(
name
);
_i
10
.
PageInfo
<
SearchRouteArgs
>(
name
);
}
}
class
SearchRouteArgs
{
class
SearchRouteArgs
{
...
@@ -207,7 +215,7 @@ class SearchRouteArgs {
...
@@ -207,7 +215,7 @@ class SearchRouteArgs {
this
.
searchKey
,
this
.
searchKey
,
});
});
final
_i1
0
.
Key
?
key
;
final
_i1
1
.
Key
?
key
;
final
String
?
searchKey
;
final
String
?
searchKey
;
...
@@ -216,3 +224,17 @@ class SearchRouteArgs {
...
@@ -216,3 +224,17 @@ class SearchRouteArgs {
return
'SearchRouteArgs{key:
$key
, searchKey:
$searchKey
}'
;
return
'SearchRouteArgs{key:
$key
, searchKey:
$searchKey
}'
;
}
}
}
}
/// generated route for
/// [_i9.ServiceIndexView]
class
ServiceIndexRoute
extends
_i10
.
PageRouteInfo
<
void
>
{
const
ServiceIndexRoute
({
List
<
_i10
.
PageRouteInfo
>?
children
})
:
super
(
ServiceIndexRoute
.
name
,
initialChildren:
children
,
);
static
const
String
name
=
'ServiceIndexRoute'
;
static
const
_i10
.
PageInfo
<
void
>
page
=
_i10
.
PageInfo
<
void
>(
name
);
}
lib/views/home/abnormal/abnormal_detail_view.dart
View file @
4794c6da
...
@@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
...
@@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import
'package:smart_hotel_app/views/home/abnormal/child/alarm_info_block.dart'
;
import
'package:smart_hotel_app/views/home/abnormal/child/alarm_info_block.dart'
;
import
'package:smart_hotel_app/views/home/abnormal/child/temperature_block.dart'
;
import
'package:smart_hotel_app/views/home/abnormal/child/temperature_block.dart'
;
import
'package:smart_hotel_app/views/home/abnormal/child/temperature_char_block.dart'
;
import
'package:smart_hotel_app/views/home/abnormal/child/temperature_char_block.dart'
;
import
'package:smart_hotel_app/views/home/abnormal/controller.dart'
;
@RoutePage
()
@RoutePage
()
class
AbnormalDetailView
extends
StatefulWidget
{
class
AbnormalDetailView
extends
StatefulWidget
{
...
@@ -14,10 +15,37 @@ class AbnormalDetailView extends StatefulWidget {
...
@@ -14,10 +15,37 @@ class AbnormalDetailView extends StatefulWidget {
}
}
class
_AbnormalDetailViewState
extends
State
<
AbnormalDetailView
>
{
class
_AbnormalDetailViewState
extends
State
<
AbnormalDetailView
>
{
late
final
HomeAbnormalController
_controller
;
@override
void
initState
()
{
super
.
initState
();
_controller
=
HomeAbnormalController
(
context
);
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
Scaffold
(
backgroundColor:
Color
.
fromRGBO
(
15
,
23
,
42
,
1
),
backgroundColor:
Color
.
fromRGBO
(
15
,
23
,
42
,
1
),
appBar:
AppBar
(
backgroundColor:
Color
.
fromRGBO
(
15
,
23
,
42
,
1
),
elevation:
0
,
leading:
IconButton
(
icon:
Icon
(
Icons
.
arrow_back
,
color:
Colors
.
white
),
onPressed:
()
{
context
.
popRoute
();
},
),
title:
Text
(
'告警详情'
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
18
.
sp
,
fontWeight:
FontWeight
.
bold
,
),
),
centerTitle:
true
,
),
body:
SingleChildScrollView
(
body:
SingleChildScrollView
(
child:
Column
(
child:
Column
(
children:
[
children:
[
...
@@ -80,38 +108,36 @@ class _AbnormalDetailViewState extends State<AbnormalDetailView> {
...
@@ -80,38 +108,36 @@ class _AbnormalDetailViewState extends State<AbnormalDetailView> {
borderRadius:
BorderRadius
.
circular
(
15
.
r
),
borderRadius:
BorderRadius
.
circular
(
15
.
r
),
),
),
),
),
onPressed:
()
{
onPressed:
_controller
.
navigateToDeviceDetail
,
print
(
"转派工单"
);
},
child:
Text
(
child:
Text
(
"
转派工单
"
,
"
查看关联设备 →
"
,
style:
TextStyle
(
fontSize:
16
.
sp
,
color:
Colors
.
white
),
style:
TextStyle
(
fontSize:
16
.
sp
,
color:
Colors
.
white
),
),
),
),
),
),
),
],
],
),
),
SizedBox
(
height:
10
.
h
),
//
SizedBox(height: 10.h),
Container
(
//
Container(
width:
double
.
infinity
,
//
width: double.infinity,
height:
55
.
h
,
//
height: 55.h,
decoration:
BoxDecoration
(
//
decoration: BoxDecoration(
color:
Color
.
fromRGBO
(
30
,
41
,
59
,
1
),
//
color: Color.fromRGBO(30, 41, 59, 1),
borderRadius:
BorderRadius
.
circular
(
15
.
r
),
//
borderRadius: BorderRadius.circular(15.r),
),
//
),
child:
TextButton
(
//
child: TextButton(
onPressed:
()
{
//
onPressed: () {
print
(
"查看关联设备"
);
//
print("查看关联设备");
},
//
},
child:
Text
(
//
child: Text(
"查看关联设备 →"
,
//
"查看关联设备 →",
style:
TextStyle
(
//
style: TextStyle(
fontSize:
16
.
sp
,
//
fontSize: 16.sp,
color:
Colors
.
grey
,
//
color: Colors.grey,
),
//
),
),
//
),
),
//
),
),
//
),
],
],
),
),
);
);
...
...
lib/views/home/abnormal/controller.dart
View file @
4794c6da
import
'package:auto_route/auto_route.dart'
;
import
'package:flutter/material.dart'
;
import
'package:smart_hotel_app/routes/app_router.gr.dart'
;
class
HomeAbnormalController
{
class
HomeAbnormalController
{
final
BuildContext
context
;
HomeAbnormalController
(
this
.
context
);
void
navigateToDeviceDetail
()
{
context
.
pushRoute
(
const
DeviceDetailRoute
());
}
}
}
\ No newline at end of file
lib/views/home/device/child/device_parms_block.dart
0 → 100644
View file @
4794c6da
import
'package:flutter/material.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
class
DeviceParmsBlock
extends
StatefulWidget
{
const
DeviceParmsBlock
({
super
.
key
});
@override
State
<
DeviceParmsBlock
>
createState
()
=>
_DeviceParmsBlockState
();
}
class
_DeviceParmsBlockState
extends
State
<
DeviceParmsBlock
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
width:
double
.
infinity
,
margin:
EdgeInsets
.
only
(
top:
10
.
h
,
left:
20
.
w
,
right:
20
.
w
),
padding:
EdgeInsets
.
all
(
20
.
w
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
25
.
r
),
color:
Color
.
fromRGBO
(
30
,
41
,
59
,
1
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
'实时参数'
,
style:
TextStyle
(
fontSize:
18
.
sp
,
color:
Colors
.
white
,
fontWeight:
FontWeight
.
bold
,
),
),
SizedBox
(
height:
15
.
h
),
Row
(
children:
[
Expanded
(
child:
_buildParamCard
(
'220V'
,
'电压'
),
),
SizedBox
(
width:
12
.
w
),
Expanded
(
child:
_buildParamCard
(
'2.36A'
,
'电流'
),
),
],
),
SizedBox
(
height:
12
.
h
),
Row
(
children:
[
Expanded
(
child:
_buildParamCard
(
'520W'
,
'有功功率'
,
isGreen:
true
),
),
SizedBox
(
width:
12
.
w
),
Expanded
(
child:
_buildParamCard
(
'38°C'
,
'设备温度'
),
),
],
),
],
),
);
}
Widget
_buildParamCard
(
String
value
,
String
label
,
{
bool
isGreen
=
false
})
{
return
Container
(
padding:
EdgeInsets
.
all
(
20
.
w
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
15
.
r
),
color:
Color
.
fromRGBO
(
45
,
55
,
72
,
1
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
value
,
style:
TextStyle
(
fontSize:
28
.
sp
,
color:
isGreen
?
Color
.
fromRGBO
(
34
,
197
,
94
,
1
)
:
Colors
.
white
,
fontWeight:
FontWeight
.
bold
,
),
),
SizedBox
(
height:
8
.
h
),
Text
(
label
,
style:
TextStyle
(
fontSize:
15
.
sp
,
color:
Colors
.
grey
,
),
),
],
),
);
}
}
\ No newline at end of file
lib/views/home/device/child/power_char_block.dart
0 → 100644
View file @
4794c6da
import
'package:flutter/material.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:fl_chart/fl_chart.dart'
;
class
PowerCharBlock
extends
StatefulWidget
{
const
PowerCharBlock
({
super
.
key
});
@override
State
<
PowerCharBlock
>
createState
()
=>
_PowerCharBlockState
();
}
class
_PowerCharBlockState
extends
State
<
PowerCharBlock
>
{
int
_selectedIndex
=
0
;
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
width:
double
.
infinity
,
margin:
EdgeInsets
.
only
(
top:
10
.
h
,
left:
20
.
w
,
right:
20
.
w
),
padding:
EdgeInsets
.
all
(
20
.
w
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
25
.
r
),
color:
Color
.
fromRGBO
(
30
,
41
,
59
,
1
),
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Text
(
'24h 功率趋势'
,
style:
TextStyle
(
fontSize:
16
.
sp
,
color:
Colors
.
white
,
fontWeight:
FontWeight
.
bold
,
),
),
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
20
.
r
),
color:
Color
.
fromRGBO
(
45
,
55
,
72
,
1
),
),
child:
Row
(
children:
[
_buildTab
(
'功率'
,
0
),
_buildTab
(
'温度'
,
1
),
],
),
),
],
),
SizedBox
(
height:
20
.
h
),
Container
(
height:
200
.
h
,
child:
BarChart
(
BarChartData
(
alignment:
BarChartAlignment
.
spaceAround
,
maxY:
100
,
minY:
0
,
groupsSpace:
8
,
barTouchData:
BarTouchData
(
enabled:
false
),
titlesData:
FlTitlesData
(
show:
true
,
rightTitles:
AxisTitles
(
sideTitles:
SideTitles
(
showTitles:
false
)),
topTitles:
AxisTitles
(
sideTitles:
SideTitles
(
showTitles:
false
)),
leftTitles:
AxisTitles
(
sideTitles:
SideTitles
(
showTitles:
false
)),
bottomTitles:
AxisTitles
(
sideTitles:
SideTitles
(
showTitles:
false
)),
),
borderData:
FlBorderData
(
show:
false
),
barGroups:
_buildBarGroups
(
_selectedIndex
),
),
),
),
],
),
);
}
Widget
_buildTab
(
String
title
,
int
index
)
{
final
isSelected
=
_selectedIndex
==
index
;
return
GestureDetector
(
onTap:
()
{
setState
(()
{
_selectedIndex
=
index
;
});
},
child:
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
16
.
w
,
vertical:
8
.
h
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
20
.
r
),
color:
isSelected
?
Color
.
fromRGBO
(
59
,
130
,
246
,
1
)
:
Colors
.
transparent
,
),
child:
Text
(
title
,
style:
TextStyle
(
fontSize:
14
.
sp
,
color:
isSelected
?
Colors
.
white
:
Colors
.
grey
,
),
),
),
);
}
List
<
BarChartGroupData
>
_buildBarGroups
(
int
index
)
{
final
powerData
=
[
30
,
45
,
55
,
65
,
75
,
80
,
70
,
60
,
45
,
30
,
25
];
final
tempData
=
[
25
,
28
,
30
,
32
,
35
,
38
,
36
,
34
,
32
,
29
,
26
];
final
data
=
index
==
0
?
powerData
:
tempData
;
final
Color
mainColor
=
index
==
0
?
Color
.
fromRGBO
(
59
,
130
,
246
,
1
)
:
Color
.
fromRGBO
(
246
,
158
,
11
,
1.0
);
final
Color
highlightColor
=
index
==
0
?
Color
.
fromRGBO
(
34
,
197
,
94
,
1
)
:
Color
.
fromRGBO
(
239
,
68
,
68
,
1
);
return
List
.
generate
(
data
.
length
,
(
i
)
=>
BarChartGroupData
(
x:
i
,
barRods:
[
BarChartRodData
(
toY:
data
[
i
].
toDouble
(),
color:
i
==
5
?
highlightColor
:
mainColor
,
width:
20
.
w
,
borderRadius:
BorderRadius
.
vertical
(
top:
Radius
.
circular
(
4
.
r
)),
),
],
),
);
}
}
\ No newline at end of file
lib/views/home/device/child/state_info_block.dart
0 → 100644
View file @
4794c6da
import
'package:flutter/material.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
class
StateInfoBlock
extends
StatelessWidget
{
const
StateInfoBlock
({
super
.
key
});
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
width:
double
.
infinity
,
margin:
EdgeInsets
.
only
(
top:
10
.
h
,
left:
20
.
w
,
right:
20
.
w
),
padding:
EdgeInsets
.
all
(
20
.
w
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
25
.
r
),
color:
Color
.
fromRGBO
(
30
,
41
,
59
,
1
),
),
child:
Row
(
children:
[
Container
(
width:
70
.
w
,
height:
70
.
h
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
20
.
r
),
color:
Color
.
fromRGBO
(
51
,
65
,
85
,
1
),
),
child:
Icon
(
Icons
.
power
,
color:
Color
.
fromRGBO
(
59
,
130
,
246
,
1
),
size:
32
.
sp
,
),
),
SizedBox
(
width:
20
.
w
),
Expanded
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
'客房 305 智能空开'
,
style:
TextStyle
(
fontSize:
18
.
sp
,
color:
Colors
.
white
,
fontWeight:
FontWeight
.
bold
,
),
),
SizedBox
(
height:
8
.
h
),
Text
(
'A-305 · 位置:3楼客房区'
,
style:
TextStyle
(
fontSize:
15
.
sp
,
color:
Colors
.
grey
,
),
),
],
),
),
Text
(
'在线'
,
style:
TextStyle
(
fontSize:
16
.
sp
,
color:
Color
.
fromRGBO
(
34
,
197
,
94
,
1
),
fontWeight:
FontWeight
.
bold
,
),
),
],
),
);
}
}
\ No newline at end of file
lib/views/home/device/controller.dart
0 → 100644
View file @
4794c6da
import
'package:flutter/material.dart'
;
class
HomeDeviceController
{
final
BuildContext
context
;
HomeDeviceController
(
this
.
context
);
void
remotePowerOn
()
{
// 远程送电
}
void
remotePowerOff
()
{
// 远程断电
}
}
\ No newline at end of file
lib/views/home/device/device_detail_view.dart
0 → 100644
View file @
4794c6da
import
'package:auto_route/auto_route.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:smart_hotel_app/views/home/device/child/device_parms_block.dart'
;
import
'package:smart_hotel_app/views/home/device/child/power_char_block.dart'
;
import
'package:smart_hotel_app/views/home/device/child/state_info_block.dart'
;
import
'package:smart_hotel_app/views/home/device/controller.dart'
;
@RoutePage
()
class
DeviceDetailView
extends
StatefulWidget
{
const
DeviceDetailView
({
super
.
key
});
@override
State
<
DeviceDetailView
>
createState
()
=>
_DeviceDetailViewState
();
}
class
_DeviceDetailViewState
extends
State
<
DeviceDetailView
>
{
late
final
HomeDeviceController
_controller
;
@override
void
initState
()
{
super
.
initState
();
_controller
=
HomeDeviceController
(
context
);
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
backgroundColor:
Color
.
fromRGBO
(
15
,
23
,
42
,
1
),
appBar:
AppBar
(
backgroundColor:
Color
.
fromRGBO
(
15
,
23
,
42
,
1
),
elevation:
0
,
leading:
IconButton
(
icon:
Icon
(
Icons
.
arrow_back
,
color:
Colors
.
white
),
onPressed:
()
{
context
.
popRoute
();
},
),
title:
Text
(
'设备详情'
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
18
.
sp
,
fontWeight:
FontWeight
.
bold
,
),
),
centerTitle:
true
,
),
body:
SingleChildScrollView
(
child:
Column
(
children:
[
StateInfoBlock
(),
SizedBox
(
height:
10
.
h
),
DeviceParmsBlock
(),
SizedBox
(
height:
10
.
h
),
PowerCharBlock
(),
SizedBox
(
height:
120
.
h
),
],
),
),
bottomNavigationBar:
_buildBottomButtons
(),
);
}
Widget
_buildBottomButtons
()
{
return
Container
(
width:
double
.
infinity
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
20
.
w
,
vertical:
15
.
h
),
decoration:
BoxDecoration
(
color:
Color
.
fromRGBO
(
15
,
23
,
42
,
1
),
border:
Border
(
top:
BorderSide
(
color:
Color
.
fromRGBO
(
30
,
41
,
59
,
1
),
width:
1
.
w
,
),
),
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
Row
(
children:
[
Expanded
(
child:
ElevatedButton
(
style:
ElevatedButton
.
styleFrom
(
backgroundColor:
Color
.
fromRGBO
(
34
,
197
,
94
,
1
),
minimumSize:
Size
(
double
.
infinity
,
55
.
h
),
padding:
EdgeInsets
.
zero
,
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
15
.
r
),
),
),
onPressed:
_controller
.
remotePowerOn
,
child:
Text
(
"远程送电"
,
style:
TextStyle
(
fontSize:
16
.
sp
,
color:
Colors
.
white
,
fontWeight:
FontWeight
.
bold
),
),
),
),
SizedBox
(
width:
12
.
w
),
Expanded
(
child:
ElevatedButton
(
style:
ElevatedButton
.
styleFrom
(
backgroundColor:
Color
.
fromRGBO
(
239
,
68
,
68
,
1
),
minimumSize:
Size
(
double
.
infinity
,
55
.
h
),
padding:
EdgeInsets
.
zero
,
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
15
.
r
),
),
),
onPressed:
_controller
.
remotePowerOff
,
child:
Text
(
"远程断电"
,
style:
TextStyle
(
fontSize:
16
.
sp
,
color:
Colors
.
white
,
fontWeight:
FontWeight
.
bold
),
),
),
),
],
),
],
),
);
}
}
\ No newline at end of file
lib/views/home/index/child/voltage_operate_block.dart
View file @
4794c6da
...
@@ -10,10 +10,16 @@ class VoltageOperateBlock extends StatefulWidget {
...
@@ -10,10 +10,16 @@ class VoltageOperateBlock extends StatefulWidget {
}
}
class
_VoltageOperateBlockState
extends
State
<
VoltageOperateBlock
>
{
class
_VoltageOperateBlockState
extends
State
<
VoltageOperateBlock
>
{
final
HomeIndexController
_controller
=
HomeIndexController
();
late
final
HomeIndexController
_controller
;
@override
void
initState
()
{
super
.
initState
();
_controller
=
HomeIndexController
(
context
);
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Container
(
return
Container
(
width:
double
.
infinity
,
width:
double
.
infinity
,
// height: 280.h,
// height: 280.h,
...
@@ -133,7 +139,7 @@ class _VoltageOperateBlockState extends State<VoltageOperateBlock> {
...
@@ -133,7 +139,7 @@ class _VoltageOperateBlockState extends State<VoltageOperateBlock> {
),
),
),
),
onPressed:
()
{
onPressed:
()
{
_controller
.
handleToAbnormalDetail
(
context
);
_controller
.
handleToAbnormalDetail
();
},
},
child:
Text
(
"查看详情"
,
style:
TextStyle
(
fontSize:
14
.
sp
,
color:
Colors
.
white
),),
child:
Text
(
"查看详情"
,
style:
TextStyle
(
fontSize:
14
.
sp
,
color:
Colors
.
white
),),
),
),
...
...
lib/views/home/index/controller.dart
View file @
4794c6da
...
@@ -4,10 +4,10 @@ import 'package:flutter/material.dart';
...
@@ -4,10 +4,10 @@ import 'package:flutter/material.dart';
import
'package:smart_hotel_app/routes/app_router.gr.dart'
;
import
'package:smart_hotel_app/routes/app_router.gr.dart'
;
class
HomeIndexController
{
class
HomeIndexController
{
// final AppRouter _appRouter = AppRouter()
;
final
BuildContext
context
;
HomeIndexController
();
HomeIndexController
(
this
.
context
);
void
handleToAbnormalDetail
(
BuildContext
context
)
{
void
handleToAbnormalDetail
()
{
context
.
router
.
push
(
const
AbnormalDetailRoute
());
context
.
pushRoute
(
const
AbnormalDetailRoute
());
}
}
}
}
\ No newline at end of file
lib/views/home/index/index_view.dart
View file @
4794c6da
...
@@ -25,7 +25,7 @@ class _HomeViewState extends State<HomeView> {
...
@@ -25,7 +25,7 @@ class _HomeViewState extends State<HomeView> {
@override
@override
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
_controller
=
HomeIndexController
();
_controller
=
HomeIndexController
(
context
);
}
}
@override
@override
...
...
lib/views/layout/default_view.dart
View file @
4794c6da
...
@@ -14,7 +14,7 @@ class _DefaultLayoutViewState extends State<DefaultLayoutView> {
...
@@ -14,7 +14,7 @@ class _DefaultLayoutViewState extends State<DefaultLayoutView> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
AutoTabsScaffold
(
return
AutoTabsScaffold
(
routes:
const
[
HomeRoute
(),
News
Route
(),
MessageRoute
(),
ProfileRoute
()],
routes:
const
[
HomeRoute
(),
ServiceIndex
Route
(),
MessageRoute
(),
ProfileRoute
()],
transitionBuilder:
(
context
,
child
,
animation
)
=>
child
,
transitionBuilder:
(
context
,
child
,
animation
)
=>
child
,
bottomNavigationBuilder:
(
context
,
tabsRouter
)
{
bottomNavigationBuilder:
(
context
,
tabsRouter
)
{
return
Container
(
return
Container
(
...
...
lib/views/news/index_view.dart
deleted
100644 → 0
View file @
f3f8e77a
import
'package:auto_route/auto_route.dart'
;
import
'package:flutter/material.dart'
;
@RoutePage
()
class
NewsView
extends
StatefulWidget
{
const
NewsView
({
super
.
key
});
@override
State
<
NewsView
>
createState
()
=>
_NewsViewState
();
}
class
_NewsViewState
extends
State
<
NewsView
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
const
Center
(
child:
Text
(
'NewsView'
),
);
}
}
lib/views/service/index/child/room_management_block.dart
0 → 100644
View file @
4794c6da
This diff is collapsed.
Click to expand it.
lib/views/service/index/child/service_head_block.dart
0 → 100644
View file @
4794c6da
import
'package:flutter/material.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
class
ServiceHeadBlock
extends
StatefulWidget
{
const
ServiceHeadBlock
({
super
.
key
});
@override
State
<
ServiceHeadBlock
>
createState
()
=>
_ServiceHeadBlockState
();
}
class
_ServiceHeadBlockState
extends
State
<
ServiceHeadBlock
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
width:
double
.
infinity
,
height:
140
.
h
,
padding:
EdgeInsets
.
only
(
top:
ScreenUtil
().
statusBarHeight
,
left:
20
.
w
,
right:
20
.
w
),
decoration:
BoxDecoration
(
border:
Border
(
bottom:
BorderSide
(
color:
Color
.
fromRGBO
(
30
,
41
,
59
,
1
),
width:
1
.
w
,
),
),
),
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Flex
(
direction:
Axis
.
horizontal
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Row
(
children:
[
Container
(
width:
4
.
w
,
height:
20
.
h
,
decoration:
BoxDecoration
(
color:
Color
.
fromRGBO
(
239
,
68
,
68
,
1
),
borderRadius:
BorderRadius
.
circular
(
2
.
r
),
),
),
SizedBox
(
width:
10
.
w
),
Text
(
'客房服务看板'
,
style:
TextStyle
(
fontSize:
24
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
Colors
.
white
,
),
),
],
),
SizedBox
(
height:
8
.
h
),
Text
(
'服务员视角 · 2条待响应需求'
,
style:
TextStyle
(
fontSize:
16
.
sp
,
color:
Color
.
fromRGBO
(
61
,
79
,
106
,
1.0
),
),
),
],
),
Container
(
width:
50
.
w
,
height:
50
.
h
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
25
.
r
),
color:
Color
.
fromRGBO
(
51
,
65
,
85
,
1
),
border:
Border
.
all
(
color:
Color
.
fromRGBO
(
71
,
85
,
105
,
1
),
width:
1
.
w
,
),
),
child:
Icon
(
Icons
.
person
,
color:
Colors
.
white
,
size:
24
.
sp
,
),
),
],
),
],
),
);
}
}
lib/views/service/index/child/service_stats_block.dart
0 → 100644
View file @
4794c6da
import
'package:flutter/material.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
class
ServiceStatsBlock
extends
StatefulWidget
{
const
ServiceStatsBlock
({
super
.
key
});
@override
State
<
ServiceStatsBlock
>
createState
()
=>
_ServiceStatsBlockState
();
}
class
_ServiceStatsBlockState
extends
State
<
ServiceStatsBlock
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
width:
double
.
infinity
,
padding:
EdgeInsets
.
symmetric
(
horizontal:
20
.
w
,
vertical:
20
.
h
),
child:
Row
(
children:
[
Expanded
(
child:
_buildStatCard
(
'2'
,
'待响应'
,
Color
.
fromRGBO
(
59
,
130
,
246
,
1
),
),
),
SizedBox
(
width:
12
.
w
),
Expanded
(
child:
_buildStatCard
(
'45'
,
'入住中'
,
Color
.
fromRGBO
(
34
,
197
,
94
,
1
),
),
),
SizedBox
(
width:
12
.
w
),
Expanded
(
child:
_buildStatCard
(
'7'
,
'空闲可清洁'
,
Colors
.
white
,
),
),
],
),
);
}
Widget
_buildStatCard
(
String
value
,
String
label
,
Color
valueColor
)
{
return
Container
(
padding:
EdgeInsets
.
symmetric
(
vertical:
20
.
h
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
20
.
r
),
color:
Color
.
fromRGBO
(
30
,
41
,
59
,
1
),
),
child:
Column
(
children:
[
Text
(
value
,
style:
TextStyle
(
fontSize:
28
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
valueColor
,
),
),
SizedBox
(
height:
8
.
h
),
Text
(
label
,
style:
TextStyle
(
fontSize:
14
.
sp
,
color:
Colors
.
grey
,
),
),
],
),
);
}
}
lib/views/service/index/controller.dart
0 → 100644
View file @
4794c6da
import
'dart:math'
;
import
'package:flutter/material.dart'
;
class
ServiceIndexController
{
final
BuildContext
context
;
ServiceIndexController
(
this
.
context
);
int
getPendingCount
()
{
// 获取待响应需求数量
return
2
;
}
int
getOccupiedRooms
()
{
// 获取入住中房间数
return
45
;
}
int
getVacantRooms
()
{
// 获取空闲可清洁房间数
return
7
;
}
List
<
String
>
getFloors
()
{
// 获取楼层列表
return
[
'1楼'
,
'2楼'
,
'3楼'
,
'4楼'
,
'5楼'
,
'6楼'
];
}
List
<
Map
<
String
,
dynamic
>>
getRoomsByFloor
(
String
floor
)
{
// 根据楼层获取房间列表
final
roomData
=
{
'1楼'
:
_generateRooms
(
1
,
40
),
'2楼'
:
_generateRooms
(
2
,
Random
().
nextInt
(
41
)
+
10
),
'3楼'
:
_generateRooms
(
3
,
Random
().
nextInt
(
41
)
+
10
),
'4楼'
:
_generateRooms
(
4
,
Random
().
nextInt
(
41
)
+
10
),
'5楼'
:
_generateRooms
(
5
,
Random
().
nextInt
(
5
)
+
10
),
'6楼'
:
_generateRooms
(
6
,
Random
().
nextInt
(
41
)
+
10
),
};
return
roomData
[
floor
]
??
[];
}
List
<
Map
<
String
,
dynamic
>>
_generateRooms
(
int
floor
,
int
count
)
{
final
statuses
=
[
'空闲'
,
'入住'
,
'待清洁'
];
final
List
<
Map
<
String
,
dynamic
>>
rooms
=
[];
for
(
int
i
=
1
;
i
<=
count
;
i
++)
{
final
roomNum
=
floor
*
100
+
i
;
// 随机分配状态,但保持一定比例
final
statusIndex
=
(
roomNum
%
3
);
rooms
.
add
({
'number'
:
roomNum
.
toString
(),
'status'
:
statuses
[
statusIndex
],
});
}
return
rooms
;
}
void
powerOnRoom
(
String
roomNumber
)
{
// 房间送电
print
(
'给
$roomNumber
号房送电'
);
}
void
powerOffRoom
(
String
roomNumber
)
{
// 房间断电
print
(
'给
$roomNumber
号房断电'
);
}
void
viewRoom
(
String
roomNumber
)
{
// 查看房间详情
print
(
'查看
$roomNumber
号房详情'
);
}
}
\ No newline at end of file
lib/views/service/index/index_view.dart
0 → 100644
View file @
4794c6da
import
'package:auto_route/auto_route.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:smart_hotel_app/views/service/index/child/service_head_block.dart'
;
import
'package:smart_hotel_app/views/service/index/child/service_stats_block.dart'
;
import
'package:smart_hotel_app/views/service/index/child/room_management_block.dart'
;
import
'package:smart_hotel_app/views/service/index/controller.dart'
;
@RoutePage
()
class
ServiceIndexView
extends
StatefulWidget
{
const
ServiceIndexView
({
super
.
key
});
@override
State
<
ServiceIndexView
>
createState
()
=>
_ServiceIndexViewState
();
}
class
_ServiceIndexViewState
extends
State
<
ServiceIndexView
>
{
late
final
ServiceIndexController
_controller
;
@override
void
initState
()
{
super
.
initState
();
_controller
=
ServiceIndexController
(
context
);
}
@override
Widget
build
(
BuildContext
context
)
{
return
LayoutBuilder
(
builder:
(
context
,
constraints
)
{
return
SingleChildScrollView
(
child:
ConstrainedBox
(
constraints:
BoxConstraints
(
minHeight:
constraints
.
maxHeight
,
),
child:
Container
(
width:
double
.
infinity
,
color:
Color
.
fromRGBO
(
15
,
23
,
42
,
1
),
child:
Column
(
children:
[
ServiceHeadBlock
(),
ServiceStatsBlock
(),
SizedBox
(
height:
10
.
h
),
RoomManagementBlock
(
controller:
_controller
),
SizedBox
(
height:
10
.
h
),
],
),
),
),
);
},
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment