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
7f4d2341
Commit
7f4d2341
authored
May 20, 2026
by
张宏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4794c6da
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
337 additions
and
65 deletions
+337
-65
app_router.dart
lib/routes/app_router.dart
+1
-0
app_router.gr.dart
lib/routes/app_router.gr.dart
+95
-43
room_management_block.dart
lib/views/service/index/child/room_management_block.dart
+10
-17
controller.dart
lib/views/service/index/controller.dart
+8
-4
index_view.dart
lib/views/service/index/index_view.dart
+1
-1
room_info_block.dart
lib/views/service/room/child/room_info_block.dart
+129
-0
controller.dart
lib/views/service/room/controller.dart
+32
-0
room_detail_view.dart
lib/views/service/room/room_detail_view.dart
+61
-0
No files found.
lib/routes/app_router.dart
View file @
7f4d2341
...
@@ -22,5 +22,6 @@ class AppRouter extends $AppRouter {
...
@@ -22,5 +22,6 @@ class AppRouter extends $AppRouter {
AutoRoute
(
page:
SearchRoute
.
page
),
AutoRoute
(
page:
SearchRoute
.
page
),
AutoRoute
(
page:
AbnormalDetailRoute
.
page
),
AutoRoute
(
page:
AbnormalDetailRoute
.
page
),
AutoRoute
(
page:
DeviceDetailRoute
.
page
),
AutoRoute
(
page:
DeviceDetailRoute
.
page
),
AutoRoute
(
page:
ServiceRoomDetailRoute
.
page
),
];
];
}
}
lib/routes/app_router.gr.dart
View file @
7f4d2341
...
@@ -8,8 +8,8 @@
...
@@ -8,8 +8,8 @@
// 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
_i1
0
;
import
'package:auto_route/auto_route.dart'
as
_i1
1
;
import
'package:flutter/material.dart'
as
_i1
1
;
import
'package:flutter/material.dart'
as
_i1
2
;
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/device/device_detail_view.dart'
import
'package:smart_hotel_app/views/home/device/device_detail_view.dart'
...
@@ -21,50 +21,52 @@ import 'package:smart_hotel_app/views/message/index_view.dart' as _i6;
...
@@ -21,50 +21,52 @@ import 'package:smart_hotel_app/views/message/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
;
import
'package:smart_hotel_app/views/service/index/index_view.dart'
as
_i9
;
import
'package:smart_hotel_app/views/service/room/room_detail_view.dart'
as
_i10
;
abstract
class
$
AppRouter
extends
_i1
0
.
RootStackRouter
{
abstract
class
$
AppRouter
extends
_i1
1
.
RootStackRouter
{
$AppRouter
({
super
.
navigatorKey
});
$AppRouter
({
super
.
navigatorKey
});
@override
@override
final
Map
<
String
,
_i1
0
.
PageFactory
>
pagesMap
=
{
final
Map
<
String
,
_i1
1
.
PageFactory
>
pagesMap
=
{
AbnormalDetailRoute
.
name
:
(
routeData
)
{
AbnormalDetailRoute
.
name
:
(
routeData
)
{
return
_i1
0
.
AutoRoutePage
<
dynamic
>(
return
_i1
1
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
routeData:
routeData
,
child:
const
_i1
.
AbnormalDetailView
(),
child:
const
_i1
.
AbnormalDetailView
(),
);
);
},
},
DefaultLayoutRoute
.
name
:
(
routeData
)
{
DefaultLayoutRoute
.
name
:
(
routeData
)
{
return
_i1
0
.
AutoRoutePage
<
dynamic
>(
return
_i1
1
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
routeData:
routeData
,
child:
const
_i2
.
DefaultLayoutView
(),
child:
const
_i2
.
DefaultLayoutView
(),
);
);
},
},
DeviceDetailRoute
.
name
:
(
routeData
)
{
DeviceDetailRoute
.
name
:
(
routeData
)
{
return
_i1
0
.
AutoRoutePage
<
dynamic
>(
return
_i1
1
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
routeData:
routeData
,
child:
const
_i3
.
DeviceDetailView
(),
child:
const
_i3
.
DeviceDetailView
(),
);
);
},
},
HomeRoute
.
name
:
(
routeData
)
{
HomeRoute
.
name
:
(
routeData
)
{
return
_i1
0
.
AutoRoutePage
<
dynamic
>(
return
_i1
1
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
routeData:
routeData
,
child:
const
_i4
.
HomeView
(),
child:
const
_i4
.
HomeView
(),
);
);
},
},
LoginRoute
.
name
:
(
routeData
)
{
LoginRoute
.
name
:
(
routeData
)
{
return
_i1
0
.
AutoRoutePage
<
dynamic
>(
return
_i1
1
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
routeData:
routeData
,
child:
const
_i5
.
LoginView
(),
child:
const
_i5
.
LoginView
(),
);
);
},
},
MessageRoute
.
name
:
(
routeData
)
{
MessageRoute
.
name
:
(
routeData
)
{
return
_i1
0
.
AutoRoutePage
<
dynamic
>(
return
_i1
1
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
routeData:
routeData
,
child:
const
_i6
.
MessageView
(),
child:
const
_i6
.
MessageView
(),
);
);
},
},
ProfileRoute
.
name
:
(
routeData
)
{
ProfileRoute
.
name
:
(
routeData
)
{
return
_i1
0
.
AutoRoutePage
<
dynamic
>(
return
_i1
1
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
routeData:
routeData
,
child:
const
_i7
.
ProfileView
(),
child:
const
_i7
.
ProfileView
(),
);
);
...
@@ -72,7 +74,7 @@ abstract class $AppRouter extends _i10.RootStackRouter {
...
@@ -72,7 +74,7 @@ abstract class $AppRouter extends _i10.RootStackRouter {
SearchRoute
.
name
:
(
routeData
)
{
SearchRoute
.
name
:
(
routeData
)
{
final
args
=
routeData
.
argsAs
<
SearchRouteArgs
>(
final
args
=
routeData
.
argsAs
<
SearchRouteArgs
>(
orElse:
()
=>
const
SearchRouteArgs
());
orElse:
()
=>
const
SearchRouteArgs
());
return
_i1
0
.
AutoRoutePage
<
dynamic
>(
return
_i1
1
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
routeData:
routeData
,
child:
_i8
.
SearchView
(
child:
_i8
.
SearchView
(
key:
args
.
key
,
key:
args
.
key
,
...
@@ -81,18 +83,29 @@ abstract class $AppRouter extends _i10.RootStackRouter {
...
@@ -81,18 +83,29 @@ abstract class $AppRouter extends _i10.RootStackRouter {
);
);
},
},
ServiceIndexRoute
.
name
:
(
routeData
)
{
ServiceIndexRoute
.
name
:
(
routeData
)
{
return
_i1
0
.
AutoRoutePage
<
dynamic
>(
return
_i1
1
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
routeData:
routeData
,
child:
const
_i9
.
ServiceIndexView
(),
child:
const
_i9
.
ServiceIndexView
(),
);
);
},
},
ServiceRoomDetailRoute
.
name
:
(
routeData
)
{
final
args
=
routeData
.
argsAs
<
ServiceRoomDetailRouteArgs
>(
orElse:
()
=>
const
ServiceRoomDetailRouteArgs
());
return
_i11
.
AutoRoutePage
<
dynamic
>(
routeData:
routeData
,
child:
_i10
.
ServiceRoomDetailView
(
key:
args
.
key
,
roomNumber:
args
.
roomNumber
,
),
);
},
};
};
}
}
/// generated route for
/// generated route for
/// [_i1.AbnormalDetailView]
/// [_i1.AbnormalDetailView]
class
AbnormalDetailRoute
extends
_i1
0
.
PageRouteInfo
<
void
>
{
class
AbnormalDetailRoute
extends
_i1
1
.
PageRouteInfo
<
void
>
{
const
AbnormalDetailRoute
({
List
<
_i1
0
.
PageRouteInfo
>?
children
})
const
AbnormalDetailRoute
({
List
<
_i1
1
.
PageRouteInfo
>?
children
})
:
super
(
:
super
(
AbnormalDetailRoute
.
name
,
AbnormalDetailRoute
.
name
,
initialChildren:
children
,
initialChildren:
children
,
...
@@ -100,13 +113,13 @@ class AbnormalDetailRoute extends _i10.PageRouteInfo<void> {
...
@@ -100,13 +113,13 @@ class AbnormalDetailRoute extends _i10.PageRouteInfo<void> {
static
const
String
name
=
'AbnormalDetailRoute'
;
static
const
String
name
=
'AbnormalDetailRoute'
;
static
const
_i1
0
.
PageInfo
<
void
>
page
=
_i10
.
PageInfo
<
void
>(
name
);
static
const
_i1
1
.
PageInfo
<
void
>
page
=
_i11
.
PageInfo
<
void
>(
name
);
}
}
/// generated route for
/// generated route for
/// [_i2.DefaultLayoutView]
/// [_i2.DefaultLayoutView]
class
DefaultLayoutRoute
extends
_i1
0
.
PageRouteInfo
<
void
>
{
class
DefaultLayoutRoute
extends
_i1
1
.
PageRouteInfo
<
void
>
{
const
DefaultLayoutRoute
({
List
<
_i1
0
.
PageRouteInfo
>?
children
})
const
DefaultLayoutRoute
({
List
<
_i1
1
.
PageRouteInfo
>?
children
})
:
super
(
:
super
(
DefaultLayoutRoute
.
name
,
DefaultLayoutRoute
.
name
,
initialChildren:
children
,
initialChildren:
children
,
...
@@ -114,13 +127,13 @@ class DefaultLayoutRoute extends _i10.PageRouteInfo<void> {
...
@@ -114,13 +127,13 @@ class DefaultLayoutRoute extends _i10.PageRouteInfo<void> {
static
const
String
name
=
'DefaultLayoutRoute'
;
static
const
String
name
=
'DefaultLayoutRoute'
;
static
const
_i1
0
.
PageInfo
<
void
>
page
=
_i10
.
PageInfo
<
void
>(
name
);
static
const
_i1
1
.
PageInfo
<
void
>
page
=
_i11
.
PageInfo
<
void
>(
name
);
}
}
/// generated route for
/// generated route for
/// [_i3.DeviceDetailView]
/// [_i3.DeviceDetailView]
class
DeviceDetailRoute
extends
_i1
0
.
PageRouteInfo
<
void
>
{
class
DeviceDetailRoute
extends
_i1
1
.
PageRouteInfo
<
void
>
{
const
DeviceDetailRoute
({
List
<
_i1
0
.
PageRouteInfo
>?
children
})
const
DeviceDetailRoute
({
List
<
_i1
1
.
PageRouteInfo
>?
children
})
:
super
(
:
super
(
DeviceDetailRoute
.
name
,
DeviceDetailRoute
.
name
,
initialChildren:
children
,
initialChildren:
children
,
...
@@ -128,13 +141,13 @@ class DeviceDetailRoute extends _i10.PageRouteInfo<void> {
...
@@ -128,13 +141,13 @@ class DeviceDetailRoute extends _i10.PageRouteInfo<void> {
static
const
String
name
=
'DeviceDetailRoute'
;
static
const
String
name
=
'DeviceDetailRoute'
;
static
const
_i1
0
.
PageInfo
<
void
>
page
=
_i10
.
PageInfo
<
void
>(
name
);
static
const
_i1
1
.
PageInfo
<
void
>
page
=
_i11
.
PageInfo
<
void
>(
name
);
}
}
/// generated route for
/// generated route for
/// [_i4.HomeView]
/// [_i4.HomeView]
class
HomeRoute
extends
_i1
0
.
PageRouteInfo
<
void
>
{
class
HomeRoute
extends
_i1
1
.
PageRouteInfo
<
void
>
{
const
HomeRoute
({
List
<
_i1
0
.
PageRouteInfo
>?
children
})
const
HomeRoute
({
List
<
_i1
1
.
PageRouteInfo
>?
children
})
:
super
(
:
super
(
HomeRoute
.
name
,
HomeRoute
.
name
,
initialChildren:
children
,
initialChildren:
children
,
...
@@ -142,13 +155,13 @@ class HomeRoute extends _i10.PageRouteInfo<void> {
...
@@ -142,13 +155,13 @@ class HomeRoute extends _i10.PageRouteInfo<void> {
static
const
String
name
=
'HomeRoute'
;
static
const
String
name
=
'HomeRoute'
;
static
const
_i1
0
.
PageInfo
<
void
>
page
=
_i10
.
PageInfo
<
void
>(
name
);
static
const
_i1
1
.
PageInfo
<
void
>
page
=
_i11
.
PageInfo
<
void
>(
name
);
}
}
/// generated route for
/// generated route for
/// [_i5.LoginView]
/// [_i5.LoginView]
class
LoginRoute
extends
_i1
0
.
PageRouteInfo
<
void
>
{
class
LoginRoute
extends
_i1
1
.
PageRouteInfo
<
void
>
{
const
LoginRoute
({
List
<
_i1
0
.
PageRouteInfo
>?
children
})
const
LoginRoute
({
List
<
_i1
1
.
PageRouteInfo
>?
children
})
:
super
(
:
super
(
LoginRoute
.
name
,
LoginRoute
.
name
,
initialChildren:
children
,
initialChildren:
children
,
...
@@ -156,13 +169,13 @@ class LoginRoute extends _i10.PageRouteInfo<void> {
...
@@ -156,13 +169,13 @@ class LoginRoute extends _i10.PageRouteInfo<void> {
static
const
String
name
=
'LoginRoute'
;
static
const
String
name
=
'LoginRoute'
;
static
const
_i1
0
.
PageInfo
<
void
>
page
=
_i10
.
PageInfo
<
void
>(
name
);
static
const
_i1
1
.
PageInfo
<
void
>
page
=
_i11
.
PageInfo
<
void
>(
name
);
}
}
/// generated route for
/// generated route for
/// [_i6.MessageView]
/// [_i6.MessageView]
class
MessageRoute
extends
_i1
0
.
PageRouteInfo
<
void
>
{
class
MessageRoute
extends
_i1
1
.
PageRouteInfo
<
void
>
{
const
MessageRoute
({
List
<
_i1
0
.
PageRouteInfo
>?
children
})
const
MessageRoute
({
List
<
_i1
1
.
PageRouteInfo
>?
children
})
:
super
(
:
super
(
MessageRoute
.
name
,
MessageRoute
.
name
,
initialChildren:
children
,
initialChildren:
children
,
...
@@ -170,13 +183,13 @@ class MessageRoute extends _i10.PageRouteInfo<void> {
...
@@ -170,13 +183,13 @@ class MessageRoute extends _i10.PageRouteInfo<void> {
static
const
String
name
=
'MessageRoute'
;
static
const
String
name
=
'MessageRoute'
;
static
const
_i1
0
.
PageInfo
<
void
>
page
=
_i10
.
PageInfo
<
void
>(
name
);
static
const
_i1
1
.
PageInfo
<
void
>
page
=
_i11
.
PageInfo
<
void
>(
name
);
}
}
/// generated route for
/// generated route for
/// [_i7.ProfileView]
/// [_i7.ProfileView]
class
ProfileRoute
extends
_i1
0
.
PageRouteInfo
<
void
>
{
class
ProfileRoute
extends
_i1
1
.
PageRouteInfo
<
void
>
{
const
ProfileRoute
({
List
<
_i1
0
.
PageRouteInfo
>?
children
})
const
ProfileRoute
({
List
<
_i1
1
.
PageRouteInfo
>?
children
})
:
super
(
:
super
(
ProfileRoute
.
name
,
ProfileRoute
.
name
,
initialChildren:
children
,
initialChildren:
children
,
...
@@ -184,16 +197,16 @@ class ProfileRoute extends _i10.PageRouteInfo<void> {
...
@@ -184,16 +197,16 @@ class ProfileRoute extends _i10.PageRouteInfo<void> {
static
const
String
name
=
'ProfileRoute'
;
static
const
String
name
=
'ProfileRoute'
;
static
const
_i1
0
.
PageInfo
<
void
>
page
=
_i10
.
PageInfo
<
void
>(
name
);
static
const
_i1
1
.
PageInfo
<
void
>
page
=
_i11
.
PageInfo
<
void
>(
name
);
}
}
/// generated route for
/// generated route for
/// [_i8.SearchView]
/// [_i8.SearchView]
class
SearchRoute
extends
_i1
0
.
PageRouteInfo
<
SearchRouteArgs
>
{
class
SearchRoute
extends
_i1
1
.
PageRouteInfo
<
SearchRouteArgs
>
{
SearchRoute
({
SearchRoute
({
_i1
1
.
Key
?
key
,
_i1
2
.
Key
?
key
,
String
?
searchKey
,
String
?
searchKey
,
List
<
_i1
0
.
PageRouteInfo
>?
children
,
List
<
_i1
1
.
PageRouteInfo
>?
children
,
})
:
super
(
})
:
super
(
SearchRoute
.
name
,
SearchRoute
.
name
,
args:
SearchRouteArgs
(
args:
SearchRouteArgs
(
...
@@ -205,8 +218,8 @@ class SearchRoute extends _i10.PageRouteInfo<SearchRouteArgs> {
...
@@ -205,8 +218,8 @@ class SearchRoute extends _i10.PageRouteInfo<SearchRouteArgs> {
static
const
String
name
=
'SearchRoute'
;
static
const
String
name
=
'SearchRoute'
;
static
const
_i1
0
.
PageInfo
<
SearchRouteArgs
>
page
=
static
const
_i1
1
.
PageInfo
<
SearchRouteArgs
>
page
=
_i1
0
.
PageInfo
<
SearchRouteArgs
>(
name
);
_i1
1
.
PageInfo
<
SearchRouteArgs
>(
name
);
}
}
class
SearchRouteArgs
{
class
SearchRouteArgs
{
...
@@ -215,7 +228,7 @@ class SearchRouteArgs {
...
@@ -215,7 +228,7 @@ class SearchRouteArgs {
this
.
searchKey
,
this
.
searchKey
,
});
});
final
_i1
1
.
Key
?
key
;
final
_i1
2
.
Key
?
key
;
final
String
?
searchKey
;
final
String
?
searchKey
;
...
@@ -227,8 +240,8 @@ class SearchRouteArgs {
...
@@ -227,8 +240,8 @@ class SearchRouteArgs {
/// generated route for
/// generated route for
/// [_i9.ServiceIndexView]
/// [_i9.ServiceIndexView]
class
ServiceIndexRoute
extends
_i1
0
.
PageRouteInfo
<
void
>
{
class
ServiceIndexRoute
extends
_i1
1
.
PageRouteInfo
<
void
>
{
const
ServiceIndexRoute
({
List
<
_i1
0
.
PageRouteInfo
>?
children
})
const
ServiceIndexRoute
({
List
<
_i1
1
.
PageRouteInfo
>?
children
})
:
super
(
:
super
(
ServiceIndexRoute
.
name
,
ServiceIndexRoute
.
name
,
initialChildren:
children
,
initialChildren:
children
,
...
@@ -236,5 +249,44 @@ class ServiceIndexRoute extends _i10.PageRouteInfo<void> {
...
@@ -236,5 +249,44 @@ class ServiceIndexRoute extends _i10.PageRouteInfo<void> {
static
const
String
name
=
'ServiceIndexRoute'
;
static
const
String
name
=
'ServiceIndexRoute'
;
static
const
_i10
.
PageInfo
<
void
>
page
=
_i10
.
PageInfo
<
void
>(
name
);
static
const
_i11
.
PageInfo
<
void
>
page
=
_i11
.
PageInfo
<
void
>(
name
);
}
/// generated route for
/// [_i10.ServiceRoomDetailView]
class
ServiceRoomDetailRoute
extends
_i11
.
PageRouteInfo
<
ServiceRoomDetailRouteArgs
>
{
ServiceRoomDetailRoute
({
_i12
.
Key
?
key
,
String
?
roomNumber
,
List
<
_i11
.
PageRouteInfo
>?
children
,
})
:
super
(
ServiceRoomDetailRoute
.
name
,
args:
ServiceRoomDetailRouteArgs
(
key:
key
,
roomNumber:
roomNumber
,
),
initialChildren:
children
,
);
static
const
String
name
=
'ServiceRoomDetailRoute'
;
static
const
_i11
.
PageInfo
<
ServiceRoomDetailRouteArgs
>
page
=
_i11
.
PageInfo
<
ServiceRoomDetailRouteArgs
>(
name
);
}
class
ServiceRoomDetailRouteArgs
{
const
ServiceRoomDetailRouteArgs
({
this
.
key
,
this
.
roomNumber
,
});
final
_i12
.
Key
?
key
;
final
String
?
roomNumber
;
@override
String
toString
()
{
return
'ServiceRoomDetailRouteArgs{key:
$key
, roomNumber:
$roomNumber
}'
;
}
}
}
lib/views/service/index/child/room_management_block.dart
View file @
7f4d2341
...
@@ -3,18 +3,14 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
...
@@ -3,18 +3,14 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import
'package:smart_hotel_app/views/service/index/controller.dart'
;
import
'package:smart_hotel_app/views/service/index/controller.dart'
;
class
RoomManagementBlock
extends
StatefulWidget
{
class
RoomManagementBlock
extends
StatefulWidget
{
final
ServiceIndexController
controller
;
const
RoomManagementBlock
({
super
.
key
});
const
RoomManagementBlock
({
super
.
key
,
required
this
.
controller
,
});
@override
@override
State
<
RoomManagementBlock
>
createState
()
=>
_RoomManagementBlockState
();
State
<
RoomManagementBlock
>
createState
()
=>
_RoomManagementBlockState
();
}
}
class
_RoomManagementBlockState
extends
State
<
RoomManagementBlock
>
{
class
_RoomManagementBlockState
extends
State
<
RoomManagementBlock
>
{
late
final
ServiceIndexController
_controller
;
String
_selectedFloor
=
'1楼'
;
String
_selectedFloor
=
'1楼'
;
String
_selectedType
=
'客房'
;
String
_selectedType
=
'客房'
;
String
?
_selectedRoom
;
String
?
_selectedRoom
;
...
@@ -25,17 +21,14 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
...
@@ -25,17 +21,14 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
@override
@override
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
_controller
=
ServiceIndexController
(
context
);
}
}
@override
void
dispose
()
{
_searchController
.
dispose
();
_scrollController
.
dispose
();
super
.
dispose
();
}
List
<
Map
<
String
,
dynamic
>>
_getFilteredRooms
()
{
List
<
Map
<
String
,
dynamic
>>
_getFilteredRooms
()
{
final
allRooms
=
widget
.
controller
.
getRoomsByFloor
(
_selectedFloor
);
final
allRooms
=
_
controller
.
getRoomsByFloor
(
_selectedFloor
);
if
(
_searchText
.
isEmpty
)
{
if
(
_searchText
.
isEmpty
)
{
return
allRooms
;
return
allRooms
;
}
}
...
@@ -111,7 +104,7 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
...
@@ -111,7 +104,7 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
}
}
Widget
_buildFloorSelector
()
{
Widget
_buildFloorSelector
()
{
final
floors
=
widget
.
controller
.
getFloors
();
final
floors
=
_
controller
.
getFloors
();
return
SingleChildScrollView
(
return
SingleChildScrollView
(
scrollDirection:
Axis
.
horizontal
,
scrollDirection:
Axis
.
horizontal
,
child:
Row
(
child:
Row
(
...
@@ -419,7 +412,7 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
...
@@ -419,7 +412,7 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
),
),
onPressed:
()
{
onPressed:
()
{
if
(
_selectedRoom
!=
null
)
{
if
(
_selectedRoom
!=
null
)
{
widget
.
controller
.
powerOnRoom
(
_selectedRoom
!);
_
controller
.
powerOnRoom
(
_selectedRoom
!);
}
else
{
}
else
{
_showMessage
(
'请先选择房间'
);
_showMessage
(
'请先选择房间'
);
}
}
...
@@ -450,7 +443,7 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
...
@@ -450,7 +443,7 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
),
),
onPressed:
()
{
onPressed:
()
{
if
(
_selectedRoom
!=
null
)
{
if
(
_selectedRoom
!=
null
)
{
widget
.
controller
.
powerOffRoom
(
_selectedRoom
!);
_
controller
.
powerOffRoom
(
_selectedRoom
!);
}
else
{
}
else
{
_showMessage
(
'请先选择房间'
);
_showMessage
(
'请先选择房间'
);
}
}
...
@@ -481,7 +474,7 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
...
@@ -481,7 +474,7 @@ class _RoomManagementBlockState extends State<RoomManagementBlock> {
),
),
onPressed:
()
{
onPressed:
()
{
if
(
_selectedRoom
!=
null
)
{
if
(
_selectedRoom
!=
null
)
{
widget
.
controller
.
viewRoom
(
_selectedRoom
!);
_
controller
.
viewRoom
(
_selectedRoom
!);
}
else
{
}
else
{
_showMessage
(
'请先选择房间'
);
_showMessage
(
'请先选择房间'
);
}
}
...
...
lib/views/service/index/controller.dart
View file @
7f4d2341
import
'dart:math'
;
import
'dart:math'
;
import
'package:auto_route/auto_route.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:smart_hotel_app/routes/app_router.gr.dart'
;
class
ServiceIndexController
{
class
ServiceIndexController
{
final
BuildContext
context
;
final
BuildContext
context
;
ServiceIndexController
(
this
.
context
);
ServiceIndexController
(
this
.
context
);
Map
<
String
,
List
<
Map
<
String
,
dynamic
>>>?
_roomCache
;
int
getPendingCount
()
{
int
getPendingCount
()
{
// 获取待响应需求数量
// 获取待响应需求数量
return
2
;
return
2
;
...
@@ -28,8 +32,7 @@ class ServiceIndexController {
...
@@ -28,8 +32,7 @@ class ServiceIndexController {
}
}
List
<
Map
<
String
,
dynamic
>>
getRoomsByFloor
(
String
floor
)
{
List
<
Map
<
String
,
dynamic
>>
getRoomsByFloor
(
String
floor
)
{
// 根据楼层获取房间列表
_roomCache
??=
{
final
roomData
=
{
'1楼'
:
_generateRooms
(
1
,
40
),
'1楼'
:
_generateRooms
(
1
,
40
),
'2楼'
:
_generateRooms
(
2
,
Random
().
nextInt
(
41
)
+
10
),
'2楼'
:
_generateRooms
(
2
,
Random
().
nextInt
(
41
)
+
10
),
'3楼'
:
_generateRooms
(
3
,
Random
().
nextInt
(
41
)
+
10
),
'3楼'
:
_generateRooms
(
3
,
Random
().
nextInt
(
41
)
+
10
),
...
@@ -38,7 +41,7 @@ class ServiceIndexController {
...
@@ -38,7 +41,7 @@ class ServiceIndexController {
'6楼'
:
_generateRooms
(
6
,
Random
().
nextInt
(
41
)
+
10
),
'6楼'
:
_generateRooms
(
6
,
Random
().
nextInt
(
41
)
+
10
),
};
};
return
roomData
[
floor
]
??
[];
return
_roomCache
!
[
floor
]
??
[];
}
}
List
<
Map
<
String
,
dynamic
>>
_generateRooms
(
int
floor
,
int
count
)
{
List
<
Map
<
String
,
dynamic
>>
_generateRooms
(
int
floor
,
int
count
)
{
...
@@ -70,6 +73,6 @@ class ServiceIndexController {
...
@@ -70,6 +73,6 @@ class ServiceIndexController {
void
viewRoom
(
String
roomNumber
)
{
void
viewRoom
(
String
roomNumber
)
{
// 查看房间详情
// 查看房间详情
print
(
'查看
$roomNumber
号房详情'
);
context
.
pushRoute
(
ServiceRoomDetailRoute
(
roomNumber:
roomNumber
)
);
}
}
}
}
\ No newline at end of file
lib/views/service/index/index_view.dart
View file @
7f4d2341
...
@@ -40,7 +40,7 @@ class _ServiceIndexViewState extends State<ServiceIndexView> {
...
@@ -40,7 +40,7 @@ class _ServiceIndexViewState extends State<ServiceIndexView> {
ServiceHeadBlock
(),
ServiceHeadBlock
(),
ServiceStatsBlock
(),
ServiceStatsBlock
(),
SizedBox
(
height:
10
.
h
),
SizedBox
(
height:
10
.
h
),
RoomManagementBlock
(
controller:
_controller
),
RoomManagementBlock
(),
SizedBox
(
height:
10
.
h
),
SizedBox
(
height:
10
.
h
),
],
],
),
),
...
...
lib/views/service/room/child/room_info_block.dart
0 → 100644
View file @
7f4d2341
import
'package:flutter/material.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:smart_hotel_app/views/service/room/controller.dart'
;
class
RoomInfoBlock
extends
StatefulWidget
{
final
ServiceRoomController
controller
;
const
RoomInfoBlock
({
super
.
key
,
required
this
.
controller
,
});
@override
State
<
RoomInfoBlock
>
createState
()
=>
_RoomInfoBlockState
();
}
class
_RoomInfoBlockState
extends
State
<
RoomInfoBlock
>
{
@override
Widget
build
(
BuildContext
context
)
{
final
roomDetail
=
widget
.
controller
.
getRoomDetail
();
final
guestName
=
roomDetail
[
'guestName'
]
as
String
?;
final
checkInDate
=
roomDetail
[
'checkInDate'
]
as
String
?;
final
checkOutDate
=
roomDetail
[
'checkOutDate'
]
as
String
?;
final
status
=
roomDetail
[
'status'
]
as
String
;
Color
statusColor
;
Color
statusBgColor
;
switch
(
status
)
{
case
'入住中'
:
statusColor
=
Color
.
fromRGBO
(
59
,
130
,
246
,
1
);
statusBgColor
=
Color
.
fromRGBO
(
59
,
130
,
246
,
0.2
);
break
;
case
'待清洁'
:
statusColor
=
Color
.
fromRGBO
(
246
,
158
,
11
,
1
);
statusBgColor
=
Color
.
fromRGBO
(
246
,
158
,
11
,
0.2
);
break
;
case
'空闲'
:
default
:
statusColor
=
Color
.
fromRGBO
(
34
,
197
,
94
,
1
);
statusBgColor
=
Color
.
fromRGBO
(
34
,
197
,
94
,
0.2
);
break
;
}
return
Container
(
width:
double
.
infinity
,
margin:
EdgeInsets
.
symmetric
(
horizontal:
20
.
w
),
padding:
EdgeInsets
.
all
(
20
.
w
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
20
.
r
),
color:
Color
.
fromRGBO
(
30
,
41
,
59
,
1
),
border:
Border
.
all
(
color:
Color
.
fromRGBO
(
71
,
85
,
105
,
1
),
width:
1
.
w
,
),
),
child:
Row
(
children:
[
Container
(
width:
80
.
w
,
height:
80
.
w
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
20
.
r
),
color:
Color
.
fromRGBO
(
51
,
65
,
85
,
1
),
),
child:
Icon
(
Icons
.
bed
,
color:
statusColor
,
size:
40
.
sp
,
),
),
SizedBox
(
width:
20
.
w
),
Expanded
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Row
(
children:
[
Text
(
roomDetail
[
'roomNumber'
]
as
String
,
style:
TextStyle
(
fontSize:
24
.
sp
,
fontWeight:
FontWeight
.
bold
,
color:
Colors
.
white
,
),
),
SizedBox
(
width:
15
.
w
),
Container
(
padding:
EdgeInsets
.
symmetric
(
horizontal:
10
.
w
,
vertical:
5
.
h
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
.
r
),
color:
statusBgColor
,
),
child:
Text
(
status
,
style:
TextStyle
(
fontSize:
14
.
sp
,
color:
statusColor
,
fontWeight:
FontWeight
.
w500
,
),
),
),
],
),
SizedBox
(
height:
10
.
h
),
if
(
guestName
!=
null
&&
checkInDate
!=
null
&&
checkOutDate
!=
null
)
Text
(
'
$guestName
·
$checkInDate
-
$checkOutDate
·
${roomDetail['roomType']}
'
,
style:
TextStyle
(
fontSize:
14
.
sp
,
color:
Colors
.
grey
,
),
)
else
Text
(
roomDetail
[
'roomType'
]
as
String
,
style:
TextStyle
(
fontSize:
14
.
sp
,
color:
Colors
.
grey
,
),
),
],
),
),
],
),
);
}
}
lib/views/service/room/controller.dart
0 → 100644
View file @
7f4d2341
import
'package:flutter/material.dart'
;
class
ServiceRoomController
{
final
BuildContext
context
;
final
String
?
roomNumber
;
ServiceRoomController
(
this
.
context
,
{
this
.
roomNumber
});
Map
<
String
,
dynamic
>
getRoomDetail
()
{
final
statuses
=
[
'空闲'
,
'入住中'
,
'待清洁'
];
final
roomTypes
=
[
'标准大床房'
,
'豪华双床房'
,
'商务套房'
,
'总统套房'
];
final
guestNames
=
[
'张先生'
,
'李女士'
,
'王先生'
,
'赵女士'
,
'刘先生'
];
final
months
=
[
'5月'
,
'6月'
,
'7月'
,
'8月'
];
final
num
=
roomNumber
??
'302'
;
final
numInt
=
int
.
tryParse
(
num
)
??
302
;
final
statusIndex
=
numInt
%
3
;
final
typeIndex
=
numInt
%
4
;
final
guestIndex
=
numInt
%
5
;
final
monthIndex
=
(
numInt
~/
100
)
%
4
;
return
{
'roomNumber'
:
num
,
'status'
:
statuses
[
statusIndex
],
'guestName'
:
statusIndex
==
0
?
null
:
guestNames
[
guestIndex
],
'checkInDate'
:
statusIndex
==
0
?
null
:
'
${months[monthIndex]}${(numInt % 20) + 1}
日'
,
'checkOutDate'
:
statusIndex
==
0
?
null
:
'
${months[monthIndex]}${(numInt % 20) + 3}
日'
,
'roomType'
:
roomTypes
[
typeIndex
],
};
}
}
\ No newline at end of file
lib/views/service/room/room_detail_view.dart
0 → 100644
View file @
7f4d2341
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/room/child/room_info_block.dart'
;
import
'package:smart_hotel_app/views/service/room/controller.dart'
;
@RoutePage
()
class
ServiceRoomDetailView
extends
StatefulWidget
{
final
String
?
roomNumber
;
const
ServiceRoomDetailView
({
super
.
key
,
this
.
roomNumber
});
@override
State
<
ServiceRoomDetailView
>
createState
()
=>
_ServiceRoomDetailViewState
();
}
class
_ServiceRoomDetailViewState
extends
State
<
ServiceRoomDetailView
>
{
late
final
ServiceRoomController
_controller
;
@override
void
initState
()
{
super
.
initState
();
_controller
=
ServiceRoomController
(
context
,
roomNumber:
widget
.
roomNumber
);
}
@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
(
'
${widget.roomNumber ?? '客房'}
详情'
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
18
.
sp
,
fontWeight:
FontWeight
.
bold
,
),
),
centerTitle:
true
,
),
body:
SingleChildScrollView
(
child:
Column
(
children:
[
SizedBox
(
height:
20
.
h
),
RoomInfoBlock
(
controller:
_controller
),
],
),
),
);
}
}
\ 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