Commit 95ab7cfd authored by 张宏's avatar 张宏

.

parent 3978e40d
...@@ -23,5 +23,7 @@ class AppRouter extends $AppRouter { ...@@ -23,5 +23,7 @@ class AppRouter extends $AppRouter {
AutoRoute(page: AbnormalDetailRoute.page), AutoRoute(page: AbnormalDetailRoute.page),
AutoRoute(page:DeviceDetailRoute.page), AutoRoute(page:DeviceDetailRoute.page),
AutoRoute(page: ServiceRoomDetailRoute.page), AutoRoute(page: ServiceRoomDetailRoute.page),
AutoRoute(page: ReportEnergyDetailRoute.page),
AutoRoute(page: ReportRoomDetailRoute.page),
]; ];
} }
...@@ -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 _i11; import 'package:auto_route/auto_route.dart' as _i13;
import 'package:flutter/material.dart' as _i12; import 'package:flutter/material.dart' as _i14;
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'
...@@ -18,82 +18,97 @@ import 'package:smart_hotel_app/views/home/index/index_view.dart' as _i4; ...@@ -18,82 +18,97 @@ 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 _i5; import 'package:smart_hotel_app/views/login/login_view.dart' as _i5;
import 'package:smart_hotel_app/views/profile/index_view.dart' as _i6; import 'package:smart_hotel_app/views/profile/index_view.dart' as _i6;
import 'package:smart_hotel_app/views/report/index/index_view.dart' as _i7; import 'package:smart_hotel_app/views/report/energy/energy_detail_view.dart'
import 'package:smart_hotel_app/views/search/index_view.dart' as _i8; as _i7;
import 'package:smart_hotel_app/views/service/index/index_view.dart' as _i9; import 'package:smart_hotel_app/views/report/index/index_view.dart' as _i8;
import 'package:smart_hotel_app/views/report/room/room_detail.dart' as _i9;
import 'package:smart_hotel_app/views/search/index_view.dart' as _i10;
import 'package:smart_hotel_app/views/service/index/index_view.dart' as _i11;
import 'package:smart_hotel_app/views/service/room/room_detail_view.dart' import 'package:smart_hotel_app/views/service/room/room_detail_view.dart'
as _i10; as _i12;
abstract class $AppRouter extends _i11.RootStackRouter { abstract class $AppRouter extends _i13.RootStackRouter {
$AppRouter({super.navigatorKey}); $AppRouter({super.navigatorKey});
@override @override
final Map<String, _i11.PageFactory> pagesMap = { final Map<String, _i13.PageFactory> pagesMap = {
AbnormalDetailRoute.name: (routeData) { AbnormalDetailRoute.name: (routeData) {
return _i11.AutoRoutePage<dynamic>( return _i13.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i1.AbnormalDetailView(), child: const _i1.AbnormalDetailView(),
); );
}, },
DefaultLayoutRoute.name: (routeData) { DefaultLayoutRoute.name: (routeData) {
return _i11.AutoRoutePage<dynamic>( return _i13.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i2.DefaultLayoutView(), child: const _i2.DefaultLayoutView(),
); );
}, },
DeviceDetailRoute.name: (routeData) { DeviceDetailRoute.name: (routeData) {
return _i11.AutoRoutePage<dynamic>( return _i13.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i3.DeviceDetailView(), child: const _i3.DeviceDetailView(),
); );
}, },
HomeRoute.name: (routeData) { HomeRoute.name: (routeData) {
return _i11.AutoRoutePage<dynamic>( return _i13.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i4.HomeView(), child: const _i4.HomeView(),
); );
}, },
LoginRoute.name: (routeData) { LoginRoute.name: (routeData) {
return _i11.AutoRoutePage<dynamic>( return _i13.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i5.LoginView(), child: const _i5.LoginView(),
); );
}, },
ProfileRoute.name: (routeData) { ProfileRoute.name: (routeData) {
return _i11.AutoRoutePage<dynamic>( return _i13.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i6.ProfileView(), child: const _i6.ProfileView(),
); );
}, },
ReportEnergyDetailRoute.name: (routeData) {
return _i13.AutoRoutePage<dynamic>(
routeData: routeData,
child: const _i7.ReportEnergyDetailView(),
);
},
ReportIndexRoute.name: (routeData) { ReportIndexRoute.name: (routeData) {
return _i11.AutoRoutePage<dynamic>( return _i13.AutoRoutePage<dynamic>(
routeData: routeData,
child: const _i8.ReportIndexView(),
);
},
ReportRoomDetailRoute.name: (routeData) {
return _i13.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i7.ReportIndexView(), child: const _i9.ReportRoomDetailView(),
); );
}, },
SearchRoute.name: (routeData) { SearchRoute.name: (routeData) {
final args = routeData.argsAs<SearchRouteArgs>( final args = routeData.argsAs<SearchRouteArgs>(
orElse: () => const SearchRouteArgs()); orElse: () => const SearchRouteArgs());
return _i11.AutoRoutePage<dynamic>( return _i13.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: _i8.SearchView( child: _i10.SearchView(
key: args.key, key: args.key,
searchKey: args.searchKey, searchKey: args.searchKey,
), ),
); );
}, },
ServiceIndexRoute.name: (routeData) { ServiceIndexRoute.name: (routeData) {
return _i11.AutoRoutePage<dynamic>( return _i13.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i9.ServiceIndexView(), child: const _i11.ServiceIndexView(),
); );
}, },
ServiceRoomDetailRoute.name: (routeData) { ServiceRoomDetailRoute.name: (routeData) {
final args = routeData.argsAs<ServiceRoomDetailRouteArgs>( final args = routeData.argsAs<ServiceRoomDetailRouteArgs>(
orElse: () => const ServiceRoomDetailRouteArgs()); orElse: () => const ServiceRoomDetailRouteArgs());
return _i11.AutoRoutePage<dynamic>( return _i13.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: _i10.ServiceRoomDetailView( child: _i12.ServiceRoomDetailView(
key: args.key, key: args.key,
roomNumber: args.roomNumber, roomNumber: args.roomNumber,
), ),
...@@ -104,8 +119,8 @@ abstract class $AppRouter extends _i11.RootStackRouter { ...@@ -104,8 +119,8 @@ abstract class $AppRouter extends _i11.RootStackRouter {
/// generated route for /// generated route for
/// [_i1.AbnormalDetailView] /// [_i1.AbnormalDetailView]
class AbnormalDetailRoute extends _i11.PageRouteInfo<void> { class AbnormalDetailRoute extends _i13.PageRouteInfo<void> {
const AbnormalDetailRoute({List<_i11.PageRouteInfo>? children}) const AbnormalDetailRoute({List<_i13.PageRouteInfo>? children})
: super( : super(
AbnormalDetailRoute.name, AbnormalDetailRoute.name,
initialChildren: children, initialChildren: children,
...@@ -113,13 +128,13 @@ class AbnormalDetailRoute extends _i11.PageRouteInfo<void> { ...@@ -113,13 +128,13 @@ class AbnormalDetailRoute extends _i11.PageRouteInfo<void> {
static const String name = 'AbnormalDetailRoute'; static const String name = 'AbnormalDetailRoute';
static const _i11.PageInfo<void> page = _i11.PageInfo<void>(name); static const _i13.PageInfo<void> page = _i13.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i2.DefaultLayoutView] /// [_i2.DefaultLayoutView]
class DefaultLayoutRoute extends _i11.PageRouteInfo<void> { class DefaultLayoutRoute extends _i13.PageRouteInfo<void> {
const DefaultLayoutRoute({List<_i11.PageRouteInfo>? children}) const DefaultLayoutRoute({List<_i13.PageRouteInfo>? children})
: super( : super(
DefaultLayoutRoute.name, DefaultLayoutRoute.name,
initialChildren: children, initialChildren: children,
...@@ -127,13 +142,13 @@ class DefaultLayoutRoute extends _i11.PageRouteInfo<void> { ...@@ -127,13 +142,13 @@ class DefaultLayoutRoute extends _i11.PageRouteInfo<void> {
static const String name = 'DefaultLayoutRoute'; static const String name = 'DefaultLayoutRoute';
static const _i11.PageInfo<void> page = _i11.PageInfo<void>(name); static const _i13.PageInfo<void> page = _i13.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i3.DeviceDetailView] /// [_i3.DeviceDetailView]
class DeviceDetailRoute extends _i11.PageRouteInfo<void> { class DeviceDetailRoute extends _i13.PageRouteInfo<void> {
const DeviceDetailRoute({List<_i11.PageRouteInfo>? children}) const DeviceDetailRoute({List<_i13.PageRouteInfo>? children})
: super( : super(
DeviceDetailRoute.name, DeviceDetailRoute.name,
initialChildren: children, initialChildren: children,
...@@ -141,13 +156,13 @@ class DeviceDetailRoute extends _i11.PageRouteInfo<void> { ...@@ -141,13 +156,13 @@ class DeviceDetailRoute extends _i11.PageRouteInfo<void> {
static const String name = 'DeviceDetailRoute'; static const String name = 'DeviceDetailRoute';
static const _i11.PageInfo<void> page = _i11.PageInfo<void>(name); static const _i13.PageInfo<void> page = _i13.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i4.HomeView] /// [_i4.HomeView]
class HomeRoute extends _i11.PageRouteInfo<void> { class HomeRoute extends _i13.PageRouteInfo<void> {
const HomeRoute({List<_i11.PageRouteInfo>? children}) const HomeRoute({List<_i13.PageRouteInfo>? children})
: super( : super(
HomeRoute.name, HomeRoute.name,
initialChildren: children, initialChildren: children,
...@@ -155,13 +170,13 @@ class HomeRoute extends _i11.PageRouteInfo<void> { ...@@ -155,13 +170,13 @@ class HomeRoute extends _i11.PageRouteInfo<void> {
static const String name = 'HomeRoute'; static const String name = 'HomeRoute';
static const _i11.PageInfo<void> page = _i11.PageInfo<void>(name); static const _i13.PageInfo<void> page = _i13.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i5.LoginView] /// [_i5.LoginView]
class LoginRoute extends _i11.PageRouteInfo<void> { class LoginRoute extends _i13.PageRouteInfo<void> {
const LoginRoute({List<_i11.PageRouteInfo>? children}) const LoginRoute({List<_i13.PageRouteInfo>? children})
: super( : super(
LoginRoute.name, LoginRoute.name,
initialChildren: children, initialChildren: children,
...@@ -169,13 +184,13 @@ class LoginRoute extends _i11.PageRouteInfo<void> { ...@@ -169,13 +184,13 @@ class LoginRoute extends _i11.PageRouteInfo<void> {
static const String name = 'LoginRoute'; static const String name = 'LoginRoute';
static const _i11.PageInfo<void> page = _i11.PageInfo<void>(name); static const _i13.PageInfo<void> page = _i13.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i6.ProfileView] /// [_i6.ProfileView]
class ProfileRoute extends _i11.PageRouteInfo<void> { class ProfileRoute extends _i13.PageRouteInfo<void> {
const ProfileRoute({List<_i11.PageRouteInfo>? children}) const ProfileRoute({List<_i13.PageRouteInfo>? children})
: super( : super(
ProfileRoute.name, ProfileRoute.name,
initialChildren: children, initialChildren: children,
...@@ -183,13 +198,27 @@ class ProfileRoute extends _i11.PageRouteInfo<void> { ...@@ -183,13 +198,27 @@ class ProfileRoute extends _i11.PageRouteInfo<void> {
static const String name = 'ProfileRoute'; static const String name = 'ProfileRoute';
static const _i11.PageInfo<void> page = _i11.PageInfo<void>(name); static const _i13.PageInfo<void> page = _i13.PageInfo<void>(name);
}
/// generated route for
/// [_i7.ReportEnergyDetailView]
class ReportEnergyDetailRoute extends _i13.PageRouteInfo<void> {
const ReportEnergyDetailRoute({List<_i13.PageRouteInfo>? children})
: super(
ReportEnergyDetailRoute.name,
initialChildren: children,
);
static const String name = 'ReportEnergyDetailRoute';
static const _i13.PageInfo<void> page = _i13.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i7.ReportIndexView] /// [_i8.ReportIndexView]
class ReportIndexRoute extends _i11.PageRouteInfo<void> { class ReportIndexRoute extends _i13.PageRouteInfo<void> {
const ReportIndexRoute({List<_i11.PageRouteInfo>? children}) const ReportIndexRoute({List<_i13.PageRouteInfo>? children})
: super( : super(
ReportIndexRoute.name, ReportIndexRoute.name,
initialChildren: children, initialChildren: children,
...@@ -197,16 +226,30 @@ class ReportIndexRoute extends _i11.PageRouteInfo<void> { ...@@ -197,16 +226,30 @@ class ReportIndexRoute extends _i11.PageRouteInfo<void> {
static const String name = 'ReportIndexRoute'; static const String name = 'ReportIndexRoute';
static const _i11.PageInfo<void> page = _i11.PageInfo<void>(name); static const _i13.PageInfo<void> page = _i13.PageInfo<void>(name);
}
/// generated route for
/// [_i9.ReportRoomDetailView]
class ReportRoomDetailRoute extends _i13.PageRouteInfo<void> {
const ReportRoomDetailRoute({List<_i13.PageRouteInfo>? children})
: super(
ReportRoomDetailRoute.name,
initialChildren: children,
);
static const String name = 'ReportRoomDetailRoute';
static const _i13.PageInfo<void> page = _i13.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i8.SearchView] /// [_i10.SearchView]
class SearchRoute extends _i11.PageRouteInfo<SearchRouteArgs> { class SearchRoute extends _i13.PageRouteInfo<SearchRouteArgs> {
SearchRoute({ SearchRoute({
_i12.Key? key, _i14.Key? key,
String? searchKey, String? searchKey,
List<_i11.PageRouteInfo>? children, List<_i13.PageRouteInfo>? children,
}) : super( }) : super(
SearchRoute.name, SearchRoute.name,
args: SearchRouteArgs( args: SearchRouteArgs(
...@@ -218,8 +261,8 @@ class SearchRoute extends _i11.PageRouteInfo<SearchRouteArgs> { ...@@ -218,8 +261,8 @@ class SearchRoute extends _i11.PageRouteInfo<SearchRouteArgs> {
static const String name = 'SearchRoute'; static const String name = 'SearchRoute';
static const _i11.PageInfo<SearchRouteArgs> page = static const _i13.PageInfo<SearchRouteArgs> page =
_i11.PageInfo<SearchRouteArgs>(name); _i13.PageInfo<SearchRouteArgs>(name);
} }
class SearchRouteArgs { class SearchRouteArgs {
...@@ -228,7 +271,7 @@ class SearchRouteArgs { ...@@ -228,7 +271,7 @@ class SearchRouteArgs {
this.searchKey, this.searchKey,
}); });
final _i12.Key? key; final _i14.Key? key;
final String? searchKey; final String? searchKey;
...@@ -239,9 +282,9 @@ class SearchRouteArgs { ...@@ -239,9 +282,9 @@ class SearchRouteArgs {
} }
/// generated route for /// generated route for
/// [_i9.ServiceIndexView] /// [_i11.ServiceIndexView]
class ServiceIndexRoute extends _i11.PageRouteInfo<void> { class ServiceIndexRoute extends _i13.PageRouteInfo<void> {
const ServiceIndexRoute({List<_i11.PageRouteInfo>? children}) const ServiceIndexRoute({List<_i13.PageRouteInfo>? children})
: super( : super(
ServiceIndexRoute.name, ServiceIndexRoute.name,
initialChildren: children, initialChildren: children,
...@@ -249,17 +292,17 @@ class ServiceIndexRoute extends _i11.PageRouteInfo<void> { ...@@ -249,17 +292,17 @@ class ServiceIndexRoute extends _i11.PageRouteInfo<void> {
static const String name = 'ServiceIndexRoute'; static const String name = 'ServiceIndexRoute';
static const _i11.PageInfo<void> page = _i11.PageInfo<void>(name); static const _i13.PageInfo<void> page = _i13.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i10.ServiceRoomDetailView] /// [_i12.ServiceRoomDetailView]
class ServiceRoomDetailRoute class ServiceRoomDetailRoute
extends _i11.PageRouteInfo<ServiceRoomDetailRouteArgs> { extends _i13.PageRouteInfo<ServiceRoomDetailRouteArgs> {
ServiceRoomDetailRoute({ ServiceRoomDetailRoute({
_i12.Key? key, _i14.Key? key,
String? roomNumber, String? roomNumber,
List<_i11.PageRouteInfo>? children, List<_i13.PageRouteInfo>? children,
}) : super( }) : super(
ServiceRoomDetailRoute.name, ServiceRoomDetailRoute.name,
args: ServiceRoomDetailRouteArgs( args: ServiceRoomDetailRouteArgs(
...@@ -271,8 +314,8 @@ class ServiceRoomDetailRoute ...@@ -271,8 +314,8 @@ class ServiceRoomDetailRoute
static const String name = 'ServiceRoomDetailRoute'; static const String name = 'ServiceRoomDetailRoute';
static const _i11.PageInfo<ServiceRoomDetailRouteArgs> page = static const _i13.PageInfo<ServiceRoomDetailRouteArgs> page =
_i11.PageInfo<ServiceRoomDetailRouteArgs>(name); _i13.PageInfo<ServiceRoomDetailRouteArgs>(name);
} }
class ServiceRoomDetailRouteArgs { class ServiceRoomDetailRouteArgs {
...@@ -281,7 +324,7 @@ class ServiceRoomDetailRouteArgs { ...@@ -281,7 +324,7 @@ class ServiceRoomDetailRouteArgs {
this.roomNumber, this.roomNumber,
}); });
final _i12.Key? key; final _i14.Key? key;
final String? roomNumber; final String? roomNumber;
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:smart_hotel_app/views/home/index/controller.dart';
class EquipmentListBlock extends StatefulWidget { class EquipmentListBlock extends StatefulWidget {
const EquipmentListBlock({super.key}); final HomeIndexController controller;
const EquipmentListBlock({super.key, required this.controller});
@override @override
State<EquipmentListBlock> createState() => _EquipmentListBlockState(); State<EquipmentListBlock> createState() => _EquipmentListBlockState();
} }
class _EquipmentListBlockState extends State<EquipmentListBlock> { class _EquipmentListBlockState extends State<EquipmentListBlock> {
final List<Map<String, dynamic>> _equipmentList = [ Widget _buildEquipmentItem(EquipmentItem item) {
{
'icon': Icons.electrical_services,
'title': '空调主机-01',
'subtitle': '位置:A栋3楼机房',
'status': '运行中',
'statusColor': Color.fromRGBO(34, 197, 94, 1),
},
{
'icon': Icons.thermostat,
'title': '温度传感器-02',
'subtitle': '位置:B栋2楼走廊',
'status': '异常',
'statusColor': Color.fromRGBO(246, 158, 11, 1),
},
{
'icon': Icons.water_drop,
'title': '水管阀门-03',
'subtitle': '位置:C栋1楼大厅',
'status': '待检修',
'statusColor': Color.fromRGBO(239, 68, 68, 1),
},
{
'icon': Icons.lightbulb,
'title': '照明系统-04',
'subtitle': '位置:D栋5楼会议室',
'status': '运行中',
'statusColor': Color.fromRGBO(34, 197, 94, 1),
},
{
'icon': Icons.electrical_services,
'title': '空调主机-05',
'subtitle': '位置:A栋3楼机房',
'status': '运行中',
'statusColor': Color.fromRGBO(34, 197, 94, 1),
},
{
'icon': Icons.thermostat,
'title': '温度传感器-06',
'subtitle': '位置:B栋2楼走廊',
'status': '异常',
'statusColor': Color.fromRGBO(246, 158, 11, 1),
},
{
'icon': Icons.water_drop,
'title': '水管阀门-07',
'subtitle': '位置:C栋1楼大厅',
'status': '待检修',
'statusColor': Color.fromRGBO(239, 68, 68, 1),
},
{
'icon': Icons.lightbulb,
'title': '照明系统-08',
'subtitle': '位置:D栋5楼会议室',
'status': '运行中',
'statusColor': Color.fromRGBO(34, 197, 94, 1),
},
{
'icon': Icons.lightbulb,
'title': '照明系统-08',
'subtitle': '位置:D栋5楼会议室',
'status': '运行中',
'statusColor': Color.fromRGBO(34, 197, 94, 1),
},
{
'icon': Icons.lightbulb,
'title': '照明系统-08',
'subtitle': '位置:D栋5楼会议室',
'status': '运行中',
'statusColor': Color.fromRGBO(34, 197, 94, 1),
},
{
'icon': Icons.lightbulb,
'title': '照明系统-08',
'subtitle': '位置:D栋5楼会议室',
'status': '运行中',
'statusColor': Color.fromRGBO(34, 197, 94, 1),
},
{
'icon': Icons.lightbulb,
'title': '照明系统-08',
'subtitle': '位置:D栋5楼会议室',
'status': '运行中',
'statusColor': Color.fromRGBO(34, 197, 94, 1),
},
];
Widget _buildEquipmentItem(Map<String, dynamic> item) {
return Container( return Container(
padding: EdgeInsets.symmetric(vertical: 8.h), padding: EdgeInsets.symmetric(vertical: 16.h),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border( border: Border(
bottom: BorderSide( bottom: BorderSide(
color: Color.fromRGBO(71, 85, 105, 0.3), color: Color.fromRGBO(235, 235, 235, 1.0),
width: 1, width: 1.w,
), ),
), ),
), ),
child: Row( child: Row(
children: [ children: [
Container( Container(
width: 40.w, width: 64.w,
height: 40.h, height: 66.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color.fromRGBO(71, 85, 105, 0.3), color: Color.fromRGBO(235, 244, 255, 1.0),
borderRadius: BorderRadius.circular(8.r), borderRadius: BorderRadius.circular(12.r),
), ),
child: Icon( child: Icon(
item['icon'] as IconData, item.icon,
color: Color.fromRGBO(246, 158, 11, 1), color: Color.fromRGBO(66, 165, 245, 1.0),
size: 20.sp, size: 32.sp,
), ),
), ),
SizedBox(width: 12.w), SizedBox(width: 16.w),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Transform.translate(
item['title'] as String, offset: Offset(0, 2.h),
child: Text(
item.title,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 28.sp,
fontWeight: FontWeight.w500, fontWeight: FontWeight.bold,
color: Colors.white, color: Colors.black,
),
), ),
), ),
SizedBox(height: 4.h), SizedBox(height: 4.h),
Text( Text(
item['subtitle'] as String, item.subtitle,
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 24.sp,
color: Color.fromRGBO(148, 163, 184, 1), color: Color.fromRGBO(100, 116, 139, 1.0),
), ),
), ),
], ],
), ),
), ),
Container( Text(
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h), item.status,
decoration: BoxDecoration(
color: (item['statusColor'] as Color).withOpacity(0.2),
borderRadius: BorderRadius.circular(4.r),
),
child: Text(
item['status'] as String,
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 24.sp,
color: item['statusColor'] as Color, fontWeight: FontWeight.bold,
), color: item.statusColor,
), ),
), ),
], ],
...@@ -167,9 +80,11 @@ class _EquipmentListBlockState extends State<EquipmentListBlock> { ...@@ -167,9 +80,11 @@ class _EquipmentListBlockState extends State<EquipmentListBlock> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final equipmentList = widget.controller.getEquipmentList();
return Container( return Container(
width: double.infinity, width: double.infinity,
margin: EdgeInsets.only(top: 10.h,left: 20.w,right: 20.w), // margin: EdgeInsets.symmetric(horizontal: 14.w, vertical: 24.h),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
...@@ -177,29 +92,38 @@ class _EquipmentListBlockState extends State<EquipmentListBlock> { ...@@ -177,29 +92,38 @@ class _EquipmentListBlockState extends State<EquipmentListBlock> {
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text('设备巡检',style: TextStyle(fontSize: 14.sp,fontWeight: FontWeight.bold,color: Colors.white),), Text(
Text('查看全部',style: TextStyle(fontSize: 14.sp,fontWeight: FontWeight.bold,color: Colors.white),), '设备巡检',
style: TextStyle(
fontSize: 28.sp,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
Text(
'查看全部>',
style: TextStyle(
fontSize: 28.sp,
fontWeight: FontWeight.bold,
color: Color.fromRGBO(73, 149, 234, 1.0),
),
),
], ],
), ),
SizedBox(height: 12.h), SizedBox(height: 12.h),
Container( Container(
width: double.infinity, width: double.infinity,
padding: EdgeInsets.all(20.w), padding: EdgeInsets.only(top: 20.w,bottom: 20.w,left: 42.w,right: 42.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r), borderRadius: BorderRadius.circular(20.r),
color: Color.fromRGBO(30, 41, 59, 1), color: Colors.white,
border: BoxBorder.all(
color: Color.fromRGBO(246, 158, 11, 1.0),
width: 1.w,
),
), ),
child: Column( child: Column(
children: [ children: [
..._equipmentList.map((item) => _buildEquipmentItem(item)).toList(), ...equipmentList.map((item) => _buildEquipmentItem(item)).toList(),
], ],
), ),
), ),
SizedBox(height: 20.h),
], ],
), ),
); );
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:smart_hotel_app/views/home/index/controller.dart';
class TaskHeadBlock extends StatefulWidget { class TaskHeadBlock extends StatefulWidget {
const TaskHeadBlock({super.key}); final HomeIndexController controller;
const TaskHeadBlock({super.key, required this.controller});
@override @override
State<TaskHeadBlock> createState() => _TaskHeadBlockState(); State<TaskHeadBlock> createState() => _TaskHeadBlockState();
...@@ -13,51 +16,28 @@ class _TaskHeadBlockState extends State<TaskHeadBlock> { ...@@ -13,51 +16,28 @@ class _TaskHeadBlockState extends State<TaskHeadBlock> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
width: double.infinity, width: double.infinity,
height: 140.h, // height: 140.h,
padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight,left: 20.w,right: 20.w), padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.blueGrey,
width: 1.w,
),
),
// color: Colors.red,
),
child: Column( child: Column(
children: [ mainAxisAlignment: MainAxisAlignment.center,
Flex(
direction: Axis.horizontal,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text('设备告警看板',style: TextStyle(fontSize: 28.sp,fontWeight: FontWeight.bold,color: Colors.white),), Text(
Text('工程运维视角 今日xx条待处理',style: TextStyle(fontSize: 24.sp,color: Color.fromRGBO(61, 79, 106, 1.0)),), '设备告警看板',
], style: TextStyle(
), fontSize: 28.sp,
Container( fontWeight: FontWeight.bold,
width: 50.w, color: Color.fromRGBO(51, 51, 51, 1.0),
height: 50.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r),
color: Colors.grey,
border: Border.all(
color: Colors.blueGrey,
width: 1.w,
), ),
), ),
SizedBox(height: 8.h),
Text(
'工程运维视角·今日${widget.controller.getPendingTaskCount()}条待处理',
style: TextStyle(
fontSize: 16.sp,
color: Color.fromRGBO(102, 102, 102, 1.0),
), ),
],
), ),
], ],
), ),
); );
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:smart_hotel_app/views/home/index/controller.dart';
class TaskTotalBlock extends StatefulWidget { class TaskTotalBlock extends StatefulWidget {
const TaskTotalBlock({super.key}); final HomeIndexController controller;
const TaskTotalBlock({super.key, required this.controller});
@override @override
State<TaskTotalBlock> createState() => _TaskTotalBlockState(); State<TaskTotalBlock> createState() => _TaskTotalBlockState();
...@@ -13,141 +16,119 @@ class _TaskTotalBlockState extends State<TaskTotalBlock> { ...@@ -13,141 +16,119 @@ class _TaskTotalBlockState extends State<TaskTotalBlock> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
width: double.infinity, width: double.infinity,
height: 180.h, // height: 180.h,
decoration: BoxDecoration(
// color: Colors.red,
border: Border(
bottom: BorderSide(
width: 1.w,
),
),
),
alignment: Alignment.center,
child: Flex( child: Flex(
direction: Axis.horizontal, direction: Axis.horizontal,
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
// 告警待处理 // 高警待处理
Column( Expanded(
mainAxisAlignment: MainAxisAlignment.center, child: Container(
children: [ margin: EdgeInsets.only(right: 10.w),
Container(
width: 190.w,
height: 120.h, height: 120.h,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r), borderRadius: BorderRadius.circular(16.r),
color: Colors.white, color: Colors.white,
border: Border.all(
color: Colors.blueGrey,
width: 1.w,
),
), ),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text('1',style: TextStyle(fontSize: 28.sp,fontWeight: FontWeight.bold,color: Colors.green),), Text(
Text('告警待处理',style: TextStyle(fontSize: 14.sp,fontWeight: FontWeight.bold,color: Colors.grey),), '${widget.controller.getHighAlarmCount()}',
], style: TextStyle(
fontSize: 48.sp,
fontWeight: FontWeight.bold,
color: Color.fromRGBO(255, 77, 79, 1.0),
), ),
), ),
Container( // SizedBox(height: 5.h),
width: 160.w, Transform.translate(
height: 1.h, offset: Offset(0, -8.h),
margin: EdgeInsets.only(top: 5.h), child: Text(
decoration: BoxDecoration( '高警待处理',
color: Colors.white, style: TextStyle(
border: Border(bottom: BorderSide( fontSize: 24.sp,
color: Colors.blueGrey, color: Color.fromRGBO(100, 116, 139, 1.0),
width: 1.w, ),
)),
), ),
), ),
], ],
), ),
),
),
// 中警待处理 // 中警待处理
Column( Expanded(
mainAxisAlignment: MainAxisAlignment.center, child: Container(
children: [ margin: EdgeInsets.symmetric(horizontal: 10.w),
Container(
width: 190.w,
height: 120.h, height: 120.h,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r), borderRadius: BorderRadius.circular(16.r),
color: Colors.white, color: Colors.white,
border: Border.all(
color: Colors.blueGrey,
width: 1.w,
),
), ),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text('12',style: TextStyle(fontSize: 28.sp,fontWeight: FontWeight.bold,color: Colors.green),), Text(
Text('中警待处理',style: TextStyle(fontSize: 14.sp,fontWeight: FontWeight.bold,color: Colors.grey),), '${widget.controller.getMediumAlarmCount()}',
], style: TextStyle(
fontSize: 48.sp,
fontWeight: FontWeight.bold,
color: Color.fromRGBO(100, 116, 139, 1.0),
), ),
), ),
Container( // SizedBox(height: 8.h),
width: 160.w, Transform.translate(
height: 1.h, offset: Offset(0, -8.h),
margin: EdgeInsets.only(top: 5.h), child: Text(
decoration: BoxDecoration( '中警待处理',
color: Colors.white, style: TextStyle(
border: Border(bottom: BorderSide( fontSize: 24.sp,
color: Colors.blueGrey, color: Color.fromRGBO(100, 116, 139, 1.0),
width: 1.w, ),
)),
), ),
), ),
], ],
), ),
),
),
// 设备在线 // 设备在线
Column( Expanded(
mainAxisAlignment: MainAxisAlignment.center, child: Container(
children: [ margin: EdgeInsets.only(left: 10.w),
Container(
width: 190.w,
height: 120.h, height: 120.h,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r), borderRadius: BorderRadius.circular(16.r),
color: Colors.white, color: Colors.white,
border: Border.all(
color: Colors.blueGrey,
width: 1.w,
),
), ),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text('88',style: TextStyle(fontSize: 28.sp,fontWeight: FontWeight.bold,color: Colors.green),), Text(
Text('设备在线',style: TextStyle(fontSize: 14.sp,fontWeight: FontWeight.bold,color: Colors.grey),), '${widget.controller.getOnlineDeviceCount()}',
], style: TextStyle(
fontSize: 48.sp,
fontWeight: FontWeight.bold,
color: Color.fromRGBO(26, 188, 156, 1.0),
), ),
), ),
Container( // SizedBox(height: 8.h),
width: 160.w, Transform.translate(
height: 1.h, offset: Offset(0, -8.h),
margin: EdgeInsets.only(top: 5.h), child: Text(
decoration: BoxDecoration( '设备在线',
color: Colors.white, style: TextStyle(
border: Border(bottom: BorderSide( fontSize: 24.sp,
color: Colors.blueGrey, color: Color.fromRGBO(100, 116, 139, 1.0),
width: 1.w, ),
)),
), ),
), ),
], ],
), ),
),
),
], ],
), ),
); );
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:smart_hotel_app/views/home/index/controller.dart';
class TemperatureBlock extends StatefulWidget { class TemperatureBlock extends StatefulWidget {
const TemperatureBlock({super.key}); final HomeIndexController controller;
const TemperatureBlock({super.key, required this.controller});
@override @override
State<TemperatureBlock> createState() => _TemperatureBlockState(); State<TemperatureBlock> createState() => _TemperatureBlockState();
...@@ -13,127 +16,157 @@ class _TemperatureBlockState extends State<TemperatureBlock> { ...@@ -13,127 +16,157 @@ class _TemperatureBlockState extends State<TemperatureBlock> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
width: double.infinity, width: double.infinity,
// height: 280.h,
margin: EdgeInsets.only(top: 10.h,left: 20.w,right: 20.w),
padding: EdgeInsets.all(20.w), padding: EdgeInsets.all(20.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r), borderRadius: BorderRadius.circular(20.r),
color: Color.fromRGBO(30, 41, 59, 1), color: Colors.white,
border: Border(
left: BorderSide(
color: Color.fromRGBO(246, 158, 11, 1.0),
width: 10.w,
)),
), ),
child: Column( child: Column(
children: [ children: [
// 描述信息 // 描述信息
Container( Container(
width: double.infinity, width: double.infinity,
// height: 100.h, margin: EdgeInsets.only(bottom: 16.h),
margin: EdgeInsets.only(bottom: 10.h), child: Row(
decoration: BoxDecoration(
border:BoxBorder.all(
color: Color.fromRGBO(246, 158, 11, 1.0),
width: 1.w,
),
),
child:Flex(
direction: Axis.horizontal,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Container( Container(
width: 50.w, width: 66.w,
height: 50.h, height: 68.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color.fromRGBO(71, 85, 105, 0.3), color: Color.fromRGBO(235, 244, 255, 1.0),
borderRadius: BorderRadius.circular(8.r), borderRadius: BorderRadius.circular(12.r),
),
child: Icon(
Icons.thermostat_outlined,
color: Color.fromRGBO(66, 165, 245, 1.0),
size: 32.sp,
), ),
child: Icon(Icons.thermostat,color: Color.fromRGBO(246, 158, 11, 1),size: 20.sp,),
), ),
SizedBox(width: 16.w),
Expanded( Expanded(
child: Container(
width: 50.w,
padding: EdgeInsets.only(left: 10.w),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text("温度异常告警",style: TextStyle(fontSize: 20.sp,color: Color.fromRGBO(246, 158, 11, 1.0),),), Text(
Text("客房301 A-301 智能空开",style: TextStyle(fontSize: 15.sp,color: Colors.grey),), widget.controller.getTemperatureAlarmTitle(),
style: TextStyle(
fontSize: 28.sp,
fontWeight: FontWeight.bold,
color: Color.fromRGBO(0, 0, 0, 1.0),
),
),
SizedBox(height: 4.h),
Text(
widget.controller.getTemperatureAlarmLocation(),
style: TextStyle(
fontSize: 24.sp,
color: Color.fromRGBO(100, 116, 139, 1.0),
),
),
], ],
), ),
), ),
Text(
'置顶',
style: TextStyle(
fontSize: 24.sp,
color: Color.fromRGBO(255, 100, 101, 1.0),
),
), ),
Text("置顶",style: TextStyle(fontSize: 15.sp,color: Color.fromRGBO(246, 158, 11, 1.0)),)
], ],
) ),
), ),
// 数据行 // 数据行
Container( Container(
width: double.infinity, width: double.infinity,
height: 100.h, padding: EdgeInsets.symmetric(vertical: 20.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color.fromRGBO(24, 33, 47, 1.0), color: Color.fromRGBO(235, 244, 255, 1.0),
borderRadius: BorderRadius.circular(25.r), borderRadius: BorderRadius.circular(16.r),
border:BoxBorder.all(
color: Color.fromRGBO(246, 158, 11, 1.0),
width: 1.w,
),
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Container( Expanded(
width: 100.w,
height: 80.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r),
color: Colors.white,
),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text("85℃",style: TextStyle(fontSize: 20.sp,color: Color.fromRGBO(246, 158, 11, 1.0),),), Text(
Text("当前温度",style: TextStyle(fontSize: 15.sp,color: Colors.grey),), '${widget.controller.getCurrentTemperature()}°C',
], style: TextStyle(
fontSize: 40.sp,
fontWeight: FontWeight.bold,
color: Color.fromRGBO(255, 100, 101, 1.0),
),
),
// SizedBox(height: 4.h),
Transform.translate(
offset: Offset(0, -8.h),
child: Text(
'当前温度',
style: TextStyle(
fontSize: 24.sp,
color: Color.fromRGBO(100, 116, 139, 1.0),
), ),
), ),
Container(
width: 100.w,
height: 80.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r),
color: Colors.white,
), ),
],
),
),
Expanded(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text("22V",style: TextStyle(fontSize: 20.sp,color: Color.fromRGBO(246, 158, 11, 1.0),),), Text(
Text("电压",style: TextStyle(fontSize: 15.sp,color: Colors.grey),), '${widget.controller.getCurrentVoltage()}V',
], style: TextStyle(
fontSize: 40.sp,
fontWeight: FontWeight.bold,
color: Color.fromRGBO(73, 149, 234, 1.0),
), ),
), ),
Container( // SizedBox(height: 4.h),
width: 100.w, Transform.translate(
height: 80.h, offset: Offset(0, -8.h),
decoration: BoxDecoration( child: Text(
borderRadius: BorderRadius.circular(25.r), '电压',
color: Colors.white, style: TextStyle(
fontSize: 24.sp,
color: Color.fromRGBO(100, 116, 139, 1.0),
),
),
),
],
), ),
),
Expanded(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text("3.2A",style: TextStyle(fontSize: 20.sp,color: Color.fromRGBO(246, 158, 11, 1.0),),), Text(
Text("电流",style: TextStyle(fontSize: 15.sp,color: Colors.grey),), '${widget.controller.getCurrentCurrent()}A',
style: TextStyle(
fontSize: 40.sp,
fontWeight: FontWeight.bold,
color: Color.fromRGBO(73, 149, 234, 1.0),
),
),
// SizedBox(height: 4.h),
Transform.translate(
offset: Offset(0, -8.h),
child: Text(
'电流',
style: TextStyle(
fontSize: 24.sp,
color: Color.fromRGBO(100, 116, 139, 1.0),
),
),
),
], ],
), ),
) ),
], ],
), ),
), ),
...@@ -141,66 +174,60 @@ class _TemperatureBlockState extends State<TemperatureBlock> { ...@@ -141,66 +174,60 @@ class _TemperatureBlockState extends State<TemperatureBlock> {
// 操作行 // 操作行
Container( Container(
width: double.infinity, width: double.infinity,
// height: 100.h, margin: EdgeInsets.only(top: 14.h),
margin: EdgeInsets.only(top: 10.h), child: Row(
decoration: BoxDecoration(
border:BoxBorder.all(
color: Color.fromRGBO(246, 158, 11, 1.0),
width: 1.w,
),
),
child: Flex(
direction: Axis.horizontal,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Icon(Icons.warning, size: 15.sp, color: Color.fromRGBO(246, 158, 11, 1.0),),
Expanded(child: Text("已等待2h37m 紧急", style: TextStyle(fontSize: 15.sp,color: Color.fromRGBO(246, 158, 11, 1.0)),),),
Row( Row(
mainAxisSize: MainAxisSize.min,
children: [ children: [
Icon(
Icons.access_time,
size: 22.sp,
color: Color.fromRGBO(100, 116, 139, 1.0),
),
SizedBox(width: 8.w),
Text(
'已等待${widget.controller.getWaitTime()}·',
style: TextStyle(
fontSize: 24.sp,
color: Color.fromRGBO(100, 116, 139, 1.0),
),
),
Text(
widget.controller.getAlarmLevel(),
style: TextStyle(
fontSize: 24.sp,
color: Color.fromRGBO(255, 112, 112, 1.0),
// fontWeight: FontWeight.bold,
),
),
],
),
ElevatedButton( ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: Color.fromRGBO(246, 158, 11, 1.0), backgroundColor: Color.fromRGBO(73, 149, 234, 1.0),
minimumSize: Size(100.w, 55.h), minimumSize: Size(149.w, 60.h),
padding: EdgeInsets.zero, padding: EdgeInsets.symmetric(horizontal: 24.w),
alignment: Alignment.center,
visualDensity: VisualDensity.compact,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.r), borderRadius: BorderRadius.circular(16.r),
), ),
), ),
onPressed: () { onPressed: () {
print("立即处理"); print("立即处理");
}, },
child: Text("立即处理",style: TextStyle(fontSize: 14.sp,color: Colors.white),), child: Text(
), "立即处理",
// SizedBox(width: 8.w), style: TextStyle(
// ElevatedButton( fontSize: 24.sp,
// style: ElevatedButton.styleFrom( color: Colors.white,
// backgroundColor: Color.fromRGBO(51, 65, 85, 1), fontWeight: FontWeight.w200,
// minimumSize: Size(80.w, 55.h), ),
// padding: EdgeInsets.zero, ),
// alignment: Alignment.center, ),
// visualDensity: VisualDensity.compact,
// tapTargetSize: MaterialTapTargetSize.shrinkWrap,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(10.r),
// ),
// ),
// onPressed: () {
// print("派工");
// },
// child: Text("派工",style: TextStyle(fontSize: 14.sp,color: Colors.white),),
// ),
],
)
], ],
), ),
), ),
], ],
), ),
); );
......
...@@ -3,155 +3,154 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; ...@@ -3,155 +3,154 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:smart_hotel_app/views/home/index/controller.dart'; import 'package:smart_hotel_app/views/home/index/controller.dart';
class VoltageOperateBlock extends StatefulWidget { class VoltageOperateBlock extends StatefulWidget {
const VoltageOperateBlock({super.key}); final HomeIndexController controller;
const VoltageOperateBlock({super.key, required this.controller});
@override @override
State<VoltageOperateBlock> createState() => _VoltageOperateBlockState(); State<VoltageOperateBlock> createState() => _VoltageOperateBlockState();
} }
class _VoltageOperateBlockState extends State<VoltageOperateBlock> { class _VoltageOperateBlockState extends State<VoltageOperateBlock> {
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, // margin: EdgeInsets.symmetric(horizontal: 14.w, vertical: 24.h),
margin: EdgeInsets.only(top: 10.h,left: 20.w,right: 20.w),
padding: EdgeInsets.all(20.w), padding: EdgeInsets.all(20.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r), borderRadius: BorderRadius.circular(20.r),
color: Color.fromRGBO(30, 41, 59, 1), color: Colors.white,
border: BoxBorder.all(
color: Color.fromRGBO(246, 158, 11, 1.0),
width: 1.w,
),
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// 描述信息 // 描述信息
Container( Container(
width: double.infinity, width: double.infinity,
// height: 100.h, margin: EdgeInsets.only(bottom: 16.h),
margin: EdgeInsets.only(bottom: 10.h), child: Row(
decoration: BoxDecoration(
border:BoxBorder.all(
color: Color.fromRGBO(246, 158, 11, 1.0),
width: 1.w,
),
),
child:Flex(
direction: Axis.horizontal,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Container( Container(
width: 50.w, width: 64.w,
height: 50.h, height: 66.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color.fromRGBO(71, 85, 105, 0.3), color: Color.fromRGBO(235, 244, 255, 1.0),
borderRadius: BorderRadius.circular(8.r), borderRadius: BorderRadius.circular(12.r),
),
child: Icon(
Icons.thermostat_outlined,
color: Color.fromRGBO(66, 165, 245, 1.0),
size: 32.sp,
), ),
child: Icon(Icons.thermostat,color: Color.fromRGBO(246, 158, 11, 1),size: 20.sp,),
), ),
SizedBox(width: 16.w),
Expanded( Expanded(
child: Container(
width: 50.w,
padding: EdgeInsets.only(left: 10.w),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text("电压波动告警",style: TextStyle(fontSize: 20.sp,color: Color.fromRGBO(246, 158, 11, 1.0),),), Text(
Text("客房301 A-301 智能空开",style: TextStyle(fontSize: 15.sp,color: Colors.grey),), widget.controller.getVoltageAlarmTitle(),
style: TextStyle(
fontSize: 28.sp,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
SizedBox(height: 4.h),
Text(
widget.controller.getVoltageAlarmLocation(),
style: TextStyle(
fontSize: 24.sp,
color: Color.fromRGBO(100, 116, 139, 1.0),
),
),
], ],
), ),
), ),
Text(
widget.controller.getVoltageAlarmLevel(),
style: TextStyle(
fontSize: 24.sp,
fontWeight: FontWeight.bold,
color: Color.fromRGBO(255, 204, 21, 1.0),
),
), ),
Text("中警",style: TextStyle(fontSize: 15.sp,color: Color.fromRGBO(246, 158, 11, 1.0)),)
], ],
) ),
), ),
// 数据行 // 数据行
Container( Container(
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( margin: EdgeInsets.only(left: 80.w,bottom: 10.h),
color: Color.fromRGBO(24, 33, 47, 1.0), child: Text(
borderRadius: BorderRadius.circular(25.r), '电压${widget.controller.getVoltageValue()}V (正常≤${widget.controller.getNormalVoltage()}V)·已等待${widget.controller.getVoltageWaitTime()}',
border:BoxBorder.all( style: TextStyle(
color: Color.fromRGBO(246, 158, 11, 1.0), fontSize: 24.sp,
width: 1.w, color: Color.fromRGBO(100, 116, 139, 1.0),
), ),
), ),
child: Text("电压220V(正常《235V) 已等待1h20m",style: TextStyle(fontSize: 15.sp,color: Colors.grey),)
), ),
// 操作行 // 操作行
Container( Container(
width: double.infinity, width: double.infinity,
// height: 100.h, child: Row(
margin: EdgeInsets.only(top: 10.h),
decoration: BoxDecoration(
border:BoxBorder.all(
color: Color.fromRGBO(246, 158, 11, 1.0),
width: 1.w,
),
),
child: Flex(
direction: Axis.horizontal,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
ElevatedButton( Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: Color.fromRGBO(246, 158, 11, 1.0), backgroundColor: Color.fromRGBO(73, 149, 234, 1.0),
minimumSize: Size(330.w, 55.h), minimumSize: Size(0, 60.h),
padding: EdgeInsets.zero, padding: EdgeInsets.symmetric(vertical: 16.h),
alignment: Alignment.center,
visualDensity: VisualDensity.compact,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.r), borderRadius: BorderRadius.circular(16.r),
), ),
), ),
onPressed: () { onPressed: () {
print("确认处理"); print("确认处理");
}, },
child: Text("确认处理",style: TextStyle(fontSize: 14.sp,color: Colors.white),), child: Text(
"确认处理",
style: TextStyle(
fontSize: 24.sp,
color: Colors.white,
fontWeight: FontWeight.w200,
),
),
),
), ),
SizedBox(width: 8.w), SizedBox(width: 16.w),
ElevatedButton( Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: Color.fromRGBO(51, 65, 85, 1), backgroundColor: Color.fromRGBO(229, 241, 255, 1.0),
minimumSize: Size(330.w, 55.h), minimumSize: Size(0, 60.h),
padding: EdgeInsets.zero, padding: EdgeInsets.symmetric(vertical: 16.h),
alignment: Alignment.center,
visualDensity: VisualDensity.compact,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.r), borderRadius: BorderRadius.circular(16.r),
), ),
), ),
onPressed: () { onPressed: () {
_controller.handleToAbnormalDetail(); widget.controller.handleToAbnormalDetail();
}, },
child: Text("查看详情",style: TextStyle(fontSize: 14.sp,color: Colors.white),), child: Text(
"查看详情",
style: TextStyle(
fontSize: 24.sp,
color: Color.fromRGBO(100, 116, 139, 1.0),
fontWeight: FontWeight.bold,
),
),
),
), ),
], ],
), ),
), ),
], ],
), ),
); );
} }
} }
\ No newline at end of file
...@@ -3,6 +3,22 @@ import 'package:flutter/material.dart'; ...@@ -3,6 +3,22 @@ import 'package:flutter/material.dart';
// import 'package:smart_hotel_app/routes/app_router.dart'; // import 'package:smart_hotel_app/routes/app_router.dart';
import 'package:smart_hotel_app/routes/app_router.gr.dart'; import 'package:smart_hotel_app/routes/app_router.gr.dart';
class EquipmentItem {
final IconData icon;
final String title;
final String subtitle;
final String status;
final Color statusColor;
EquipmentItem({
required this.icon,
required this.title,
required this.subtitle,
required this.status,
required this.statusColor,
});
}
class HomeIndexController { class HomeIndexController {
final BuildContext context; final BuildContext context;
HomeIndexController(this.context); HomeIndexController(this.context);
...@@ -10,4 +26,161 @@ class HomeIndexController { ...@@ -10,4 +26,161 @@ class HomeIndexController {
void handleToAbnormalDetail() { void handleToAbnormalDetail() {
context.pushRoute(const AbnormalDetailRoute()); context.pushRoute(const AbnormalDetailRoute());
} }
int getPendingTaskCount() {
return 3;
}
int getHighAlarmCount() {
return 1;
}
int getMediumAlarmCount() {
return 1;
}
int getOnlineDeviceCount() {
return 48;
}
String getTemperatureAlarmTitle() {
return '温度异常告警';
}
String getTemperatureAlarmLocation() {
return '客房301·A-301智能空开';
}
String getCurrentTemperature() {
return '85';
}
String getCurrentVoltage() {
return '220';
}
String getCurrentCurrent() {
return '3.2';
}
String getWaitTime() {
return '2h37m';
}
String getAlarmLevel() {
return '紧急';
}
String getVoltageAlarmTitle() {
return '电压波动告警';
}
String getVoltageAlarmLocation() {
return '会议室2F-01';
}
String getVoltageValue() {
return '248';
}
String getNormalVoltage() {
return '235';
}
String getVoltageWaitTime() {
return '1h19m';
}
String getVoltageAlarmLevel() {
return '中警';
}
List<EquipmentItem> getEquipmentList() {
return [
EquipmentItem(
icon: Icons.power,
title: '客房305空开',
subtitle: '38°C·220V·520W',
status: '正常',
statusColor: Color.fromRGBO(26, 188, 156, 1.0),
),
EquipmentItem(
icon: Icons.power,
title: '大堂总空开L-01',
subtitle: '380V·42A·28.6kW',
status: '正常',
statusColor: Color.fromRGBO(26, 188, 156, 1.0),
),
EquipmentItem(
icon: Icons.wifi,
title: '招牌AP-03',
subtitle: '信号弱·RSSI-78dBm',
status: '注意',
statusColor: Color.fromRGBO(255, 193, 7, 1.0),
),
EquipmentItem(
icon: Icons.power,
title: '客房201空开',
subtitle: '25°C·220V·380W',
status: '正常',
statusColor: Color.fromRGBO(26, 188, 156, 1.0),
),
EquipmentItem(
icon: Icons.power,
title: '水泵控制箱',
subtitle: '运行中·2.2kW',
status: '正常',
statusColor: Color.fromRGBO(26, 188, 156, 1.0),
),
EquipmentItem(
icon: Icons.thermostat,
title: '冷库温控器',
subtitle: '-18°C·异常波动',
status: '告警',
statusColor: Color.fromRGBO(255, 77, 79, 1.0),
),
EquipmentItem(
icon: Icons.light,
title: '走廊照明回路',
subtitle: '12盏·功率240W',
status: '正常',
statusColor: Color.fromRGBO(26, 188, 156, 1.0),
),
EquipmentItem(
icon: Icons.wifi,
title: '会议室AP-01',
subtitle: '连接数12·信号强',
status: '正常',
statusColor: Color.fromRGBO(26, 188, 156, 1.0),
),
EquipmentItem(
icon: Icons.power,
title: '电梯控制柜',
subtitle: '运行中·电压稳定',
status: '正常',
statusColor: Color.fromRGBO(26, 188, 156, 1.0),
),
EquipmentItem(
icon: Icons.thermostat,
title: '空调外机',
subtitle: '压力偏高·需检查',
status: '注意',
statusColor: Color.fromRGBO(255, 193, 7, 1.0),
),
EquipmentItem(
icon: Icons.wifi,
title: '楼道AP-05',
subtitle: '离线·需重启',
status: '离线',
statusColor: Color.fromRGBO(102, 102, 102, 1.0),
),
EquipmentItem(
icon: Icons.power,
title: '厨房消毒柜',
subtitle: '消毒中·温度120°C',
status: '正常',
statusColor: Color.fromRGBO(26, 188, 156, 1.0),
),
];
}
} }
\ No newline at end of file
...@@ -39,19 +39,24 @@ class _HomeViewState extends State<HomeView> { ...@@ -39,19 +39,24 @@ class _HomeViewState extends State<HomeView> {
), ),
child: Container( child: Container(
width: double.infinity, width: double.infinity,
color: Color.fromRGBO(15, 23, 42, 1), color: Color.fromRGBO(242, 243, 245, 1),
child: const Column( padding: EdgeInsets.symmetric(horizontal: 28.w),
child: Column(
children: [ children: [
TaskHeadBlock(), TaskHeadBlock(controller: _controller),
TaskTotalBlock(), SizedBox(height: 20.h),
TemperatureBlock(), TaskTotalBlock(controller: _controller),
VoltageOperateBlock(), SizedBox(height: 20.h),
EquipmentListBlock(), TemperatureBlock(controller: _controller),
SizedBox(height: 20.h),
VoltageOperateBlock(controller: _controller),
SizedBox(height: 20.h),
EquipmentListBlock(controller: _controller),
SizedBox(height: 20.h),
], ],
), ),
), ),
) ),
); );
}, },
); );
......
import 'package:auto_route/auto_route.dart'; import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:smart_hotel_app/routes/app_router.gr.dart'; import 'package:smart_hotel_app/routes/app_router.gr.dart';
@RoutePage() @RoutePage()
...@@ -29,17 +30,64 @@ class _DefaultLayoutViewState extends State<DefaultLayoutView> { ...@@ -29,17 +30,64 @@ class _DefaultLayoutViewState extends State<DefaultLayoutView> {
onTap: tabsRouter.setActiveIndex, onTap: tabsRouter.setActiveIndex,
elevation: 0, elevation: 0,
backgroundColor: Colors.white, backgroundColor: Colors.white,
selectedItemColor: Colors.blue, selectedItemColor: const Color(0xFF4995EA),
unselectedItemColor: const Color(0xFF666666), unselectedItemColor: const Color(0xFF666666),
type: BottomNavigationBarType.fixed, type: BottomNavigationBarType.fixed,
selectedFontSize: 12, selectedFontSize: 24.sp,
unselectedFontSize: 12, unselectedFontSize: 24.sp,
items: const [ items: [
BottomNavigationBarItem(icon: Icon(Icons.home), label: "告警"),
BottomNavigationBarItem(icon: Icon(Icons.new_label), label: "服务"),
BottomNavigationBarItem(icon: Icon(Icons.message), label: "看板"),
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon(Icons.my_location), label: "我的") icon: Image.asset(
'lib/assets/tab/tab1.png',
width: 48.w,
height: 48.h,
),
activeIcon: Image.asset(
'lib/assets/tab/tab1_active.png',
width: 48.w,
height: 48.h,
),
label: "告警",
),
BottomNavigationBarItem(
icon: Image.asset(
'lib/assets/tab/tab2.png',
width: 48.w,
height: 48.h,
),
activeIcon: Image.asset(
'lib/assets/tab/tab2_active.png',
width: 48.w,
height: 48.h,
),
label: "服务",
),
BottomNavigationBarItem(
icon: Image.asset(
'lib/assets/tab/tab3.png',
width: 48.w,
height: 48.h,
),
activeIcon: Image.asset(
'lib/assets/tab/tab3_active.png',
width: 48.w,
height: 48.h,
),
label: "看板",
),
BottomNavigationBarItem(
icon: Image.asset(
'lib/assets/tab/tab4.png',
width: 48.w,
height: 48.h,
),
activeIcon: Image.asset(
'lib/assets/tab/tab4_active.png',
width: 48.w,
height: 48.h,
),
label: "我的",
),
], ],
), ),
); );
......
...@@ -15,10 +15,10 @@ class BtnLogin extends StatelessWidget { ...@@ -15,10 +15,10 @@ class BtnLogin extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
width: double.infinity, width: double.infinity,
height: 70.h, height: 96.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color.fromRGBO(89, 109, 243, 1), color: Color.fromRGBO(73, 149, 234, 1),
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(40.w),
), ),
child: ElevatedButton( child: ElevatedButton(
onPressed: isLoading ? null : onPressed, onPressed: isLoading ? null : onPressed,
...@@ -28,17 +28,21 @@ class BtnLogin extends StatelessWidget { ...@@ -28,17 +28,21 @@ class BtnLogin extends StatelessWidget {
elevation: 0, elevation: 0,
), ),
child: isLoading child: isLoading
? const SizedBox( ? SizedBox(
width: 20, width: 40.w,
height: 20, height: 40.w,
child: CircularProgressIndicator( child: CircularProgressIndicator(
strokeWidth: 2, strokeWidth: 3.w,
color: Colors.white, color: Colors.white,
), ),
) )
: const Text( : Text(
"提交", "登录",
style: TextStyle(color: Colors.white), style: TextStyle(
color: Colors.white,
fontSize: 32.sp,
fontWeight: FontWeight.bold,
),
), ),
), ),
); );
......
...@@ -28,7 +28,7 @@ class _PasswordFieldState extends State<PasswordField> { ...@@ -28,7 +28,7 @@ class _PasswordFieldState extends State<PasswordField> {
return TextFormField( return TextFormField(
controller: widget.controller, controller: widget.controller,
obscureText: _obscureText, obscureText: _obscureText,
style: const TextStyle(color: Colors.white, fontSize: 14), style: TextStyle(color: Color(0xFF333333), fontSize: 28.sp),
validator: (val) { validator: (val) {
if (val == null || val.isEmpty) { if (val == null || val.isEmpty) {
return "密码不能为空"; return "密码不能为空";
...@@ -37,44 +37,44 @@ class _PasswordFieldState extends State<PasswordField> { ...@@ -37,44 +37,44 @@ class _PasswordFieldState extends State<PasswordField> {
}, },
decoration: InputDecoration( decoration: InputDecoration(
filled: true, filled: true,
hintText: "请输入密码", hintText: "password",
hintStyle: const TextStyle(color: Colors.white70, fontSize: 14), hintStyle: TextStyle(color: Color(0xFF999999), fontSize: 28.sp),
prefixIcon: const Icon(Icons.lock, color: Colors.white, size: 20), prefixIcon: Icon(Icons.lock, color: Color(0xFF999999), size: 40.w),
prefixIconConstraints: const BoxConstraints(minWidth: 40, minHeight: 40), prefixIconConstraints: BoxConstraints(minWidth: 80.w, minHeight: 80.w),
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon( icon: Icon(
_obscureText ? Icons.visibility_off : Icons.visibility, _obscureText ? Icons.visibility_off : Icons.visibility,
color: Colors.white, color: Color(0xFF999999),
size: 20, size: 40.w,
), ),
onPressed: _toggleVisibility, onPressed: _toggleVisibility,
), ),
suffixIconConstraints: const BoxConstraints(minWidth: 40, minHeight: 40), suffixIconConstraints: BoxConstraints(minWidth: 80.w, minHeight: 80.w),
contentPadding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12), contentPadding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 24.w),
helperText: " ", helperText: " ",
helperStyle: TextStyle(height: 1.1, fontSize: 12.sp), helperStyle: TextStyle(height: 1, fontSize: 24.sp),
errorStyle: TextStyle(color: Colors.red, fontSize: 12.sp, height: 1.1), errorStyle: TextStyle(color: Colors.red, fontSize: 24.sp, height: 1),
errorMaxLines: 1, errorMaxLines: 1,
fillColor: const Color(0xFF1A2B3C), fillColor: Colors.white,
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(25), borderRadius: BorderRadius.circular(24.w),
borderSide: const BorderSide(color: Colors.white30, width: 1), borderSide: BorderSide.none,
), ),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25), borderRadius: BorderRadius.circular(24.w),
borderSide: const BorderSide(color: Colors.white30, width: 1), borderSide: BorderSide(color: Color(0xFFF5F7FA), width: 1),
), ),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25), borderRadius: BorderRadius.circular(24.w),
borderSide: const BorderSide(color: Colors.white, width: 1.5), borderSide: BorderSide(color: Color(0xFFF5F7FA), width: 1),
), ),
errorBorder: OutlineInputBorder( errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25), borderRadius: BorderRadius.circular(24.w),
borderSide: const BorderSide(color: Colors.red, width: 1), borderSide: BorderSide(color: Colors.red, width: 1),
), ),
focusedErrorBorder: OutlineInputBorder( focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25), borderRadius: BorderRadius.circular(24.w),
borderSide: const BorderSide(color: Colors.red, width: 1.5), borderSide: BorderSide(color: Colors.red, width: 1.5),
), ),
), ),
); );
......
...@@ -24,42 +24,41 @@ class RememberPasswordRow extends StatelessWidget { ...@@ -24,42 +24,41 @@ class RememberPasswordRow extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Container( Container(
width: 32, width: 40.w,
height: 32, height: 40.w,
child: Transform.scale( child: Transform.scale(
scale: 0.7, scale: 0.8,
child: Checkbox( child: Checkbox(
value: value, value: value,
onChanged: onChanged, onChanged: onChanged,
activeColor: const Color.fromRGBO(89, 109, 243, 1), activeColor: Color(0xFF4A90E2),
checkColor: Colors.white, checkColor: Colors.white,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(25.w),
), ),
side: const BorderSide(color: Colors.white30), side: BorderSide(color: Color(0xFF4A90E2)),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
), ),
), ),
), ),
Container( SizedBox(width: 10.w),
margin: EdgeInsets.only(bottom: 2.h), Text(
child: Text(
'记住密码', '记住密码',
style: TextStyle(color: Colors.white, fontSize: 18.sp), style: TextStyle(
color: Color(0xFF0A0D14),
fontSize: 24.sp,
),
), ),
)
], ],
), ),
), ),
GestureDetector( GestureDetector(
onTap: onForgotPassword, onTap: onForgotPassword,
child: Text( child: Text(
'忘记密码', '忘记密码?',
style: TextStyle( style: TextStyle(
color: Color.fromRGBO(89, 109, 243, 1), color: Color(0xFF0A0D14),
fontSize: 18.sp, fontSize: 24.sp,
), ),
), ),
), ),
......
...@@ -13,7 +13,7 @@ class UsernameField extends StatelessWidget { ...@@ -13,7 +13,7 @@ class UsernameField extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return TextFormField( return TextFormField(
controller: controller, controller: controller,
style: const TextStyle(color: Colors.white, fontSize: 14), style: TextStyle(color: Color(0xFF333333), fontSize: 28.sp),
validator: (val) { validator: (val) {
if (val == null || val.isEmpty) { if (val == null || val.isEmpty) {
return "用户名不能为空哦"; return "用户名不能为空哦";
...@@ -22,35 +22,35 @@ class UsernameField extends StatelessWidget { ...@@ -22,35 +22,35 @@ class UsernameField extends StatelessWidget {
}, },
decoration: InputDecoration( decoration: InputDecoration(
filled: true, filled: true,
hintText: "请输入用户名", hintText: "admin",
hintStyle: const TextStyle(color: Colors.white70, fontSize: 14), hintStyle: TextStyle(color: Color(0xFF999999), fontSize: 28.sp),
prefixIcon: const Icon(Icons.person, color: Colors.white, size: 20), prefixIcon: Icon(Icons.person, color: Color(0xFF999999), size: 40.w),
prefixIconConstraints: const BoxConstraints(minWidth: 40, minHeight: 40), prefixIconConstraints: BoxConstraints(minWidth: 80.w, minHeight: 80.w),
contentPadding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12), contentPadding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 24.w),
helperText: " ", helperText: " ",
helperStyle: TextStyle(height: 1, fontSize: 12.sp), helperStyle: TextStyle(height: 1, fontSize: 24.sp),
errorStyle: TextStyle(color: Colors.red, fontSize: 12.sp, height: 1), errorStyle: TextStyle(color: Colors.red, fontSize: 24.sp, height: 1),
errorMaxLines: 1, errorMaxLines: 1,
fillColor: const Color(0xFF1A2B3C), fillColor: Colors.white,
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(25), borderRadius: BorderRadius.circular(24.w),
borderSide: const BorderSide(color: Colors.white30, width: 1), borderSide: BorderSide.none,
), ),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25), borderRadius: BorderRadius.circular(24.w),
borderSide: const BorderSide(color: Colors.white30, width: 1), borderSide: BorderSide(color: Color(0xFFF5F7FA), width: 1),
), ),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25), borderRadius: BorderRadius.circular(24.w),
borderSide: const BorderSide(color: Colors.white, width: 1.5), borderSide: BorderSide(color: Color(0xFFF5F7FA), width: 1),
), ),
errorBorder: OutlineInputBorder( errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25), borderRadius: BorderRadius.circular(24.w),
borderSide: const BorderSide(color: Colors.red, width: 1), borderSide: BorderSide(color: Colors.red, width: 1),
), ),
focusedErrorBorder: OutlineInputBorder( focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25), borderRadius: BorderRadius.circular(24.w),
borderSide: const BorderSide(color: Colors.red, width: 1.5), borderSide: BorderSide(color: Colors.red, width: 1),
), ),
), ),
); );
......
...@@ -62,29 +62,59 @@ class _LoginViewState extends State<LoginView> { ...@@ -62,29 +62,59 @@ class _LoginViewState extends State<LoginView> {
height: double.infinity, height: double.infinity,
padding: EdgeInsets.only(left: 50.w, right: 50.w), padding: EdgeInsets.only(left: 50.w, right: 50.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFF1A2B3C), color: Color(0xFFF5F7FA),
), ),
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
SizedBox(height: 150.h),
Container( Container(
margin: EdgeInsets.only(top: 150.h, bottom: 150.h), margin: EdgeInsets.only(bottom: 80.h),
child: Column( child: Column(
children: [ children: [
Image.asset( Container(
'lib/assets/znjd_logo.png', width: 160.w,
width: 100, height: 160.w,
height: 100, decoration: BoxDecoration(
), borderRadius: BorderRadius.circular(40.w),
const SizedBox(height: 10), gradient: LinearGradient(
Text("智能酒店管理系统", style: TextStyle(color: Colors.white, fontSize: 20.sp),), begin: Alignment.topCenter,
Text("Intelligent Hotel Management System", style: TextStyle(color: Colors.white, fontSize: 20.sp),), end: Alignment.bottomCenter,
colors: [
Color(0xFF00C6FF),
Color(0xFF0072FF),
], ],
), ),
), ),
child: ClipRRect(
Container( borderRadius: BorderRadius.circular(40.w),
child: Form( child: Image.asset(
'lib/assets/login/logo@2x.png',
fit: BoxFit.cover,
),
),
),
SizedBox(height: 40.h),
Text(
"智能酒店管理系统",
style: TextStyle(
color: Color(0xFF333333),
fontSize: 36.sp,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 10.h),
Text(
"Intelligent Hotel Management System",
style: TextStyle(
color: Color(0xFF999999),
fontSize: 24.sp,
),
),
],
),
),
Form(
key: _frmGlobalKey, key: _frmGlobalKey,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
...@@ -92,11 +122,11 @@ class _LoginViewState extends State<LoginView> { ...@@ -92,11 +122,11 @@ class _LoginViewState extends State<LoginView> {
UsernameField( UsernameField(
controller: _txtUserNameController, controller: _txtUserNameController,
), ),
const SizedBox(height: 10), SizedBox(height: 20.h),
PasswordField( PasswordField(
controller: _txtPwdController, controller: _txtPwdController,
), ),
// const SizedBox(height: 5), SizedBox(height: 30.h),
RememberPasswordRow( RememberPasswordRow(
value: _rememberPassword, value: _rememberPassword,
onChanged: (val) { onChanged: (val) {
...@@ -106,7 +136,7 @@ class _LoginViewState extends State<LoginView> { ...@@ -106,7 +136,7 @@ class _LoginViewState extends State<LoginView> {
}, },
onForgotPassword: _loginController.forgotPwd, onForgotPassword: _loginController.forgotPwd,
), ),
const SizedBox(height: 20), SizedBox(height: 10.h),
BlocConsumer<AuthBloc, AuthState>( BlocConsumer<AuthBloc, AuthState>(
listener: (context, state) { listener: (context, state) {
if (state is AuthFailure) { if (state is AuthFailure) {
...@@ -119,7 +149,6 @@ class _LoginViewState extends State<LoginView> { ...@@ -119,7 +149,6 @@ class _LoginViewState extends State<LoginView> {
textColor: Colors.white, textColor: Colors.white,
fontSize: 16.0); fontSize: 16.0);
} }
}, },
builder: (context, state) { builder: (context, state) {
return BtnLogin( return BtnLogin(
...@@ -134,8 +163,8 @@ class _LoginViewState extends State<LoginView> { ...@@ -134,8 +163,8 @@ class _LoginViewState extends State<LoginView> {
], ],
), ),
), ),
],
), ),
])
), ),
), ),
); );
......
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:smart_hotel_app/views/report/energy/controller.dart';
class EnergyStatsCardBlock extends StatelessWidget {
const EnergyStatsCardBlock({super.key});
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Row(
children: [
Expanded(
child: _buildCard(
'${ReportEnergyController.todayEnergy.toInt()}',
'今日(kWh)',
'${ReportEnergyController.todayEnergyChange.toInt()}%',
true,
),
),
SizedBox(width: 12.w),
Expanded(
child: _buildCard(
'${ReportEnergyController.monthEnergy.toInt()}',
'本月(kWh)',
'${ReportEnergyController.monthEnergyChange.toInt()}%',
true,
),
),
SizedBox(width: 12.w),
Expanded(
child: _buildCard(
${ReportEnergyController.monthBill.toInt()}',
'本月电费预估',
null,
null,
),
),
],
),
);
}
Widget _buildCard(String value, String label, String? change, bool? isDown) {
return Container(
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 12.w),
decoration: BoxDecoration(
color: const Color.fromRGBO(30, 41, 59, 1),
borderRadius: BorderRadius.circular(12.r),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
value,
style: TextStyle(
color: Colors.white,
fontSize: 24.sp,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 4.h),
Text(
label,
style: TextStyle(
color: const Color.fromRGBO(148, 163, 184, 1),
fontSize: 12.sp,
),
),
SizedBox(height: 4.h),
if (change != null)
Row(
children: [
Icon(
isDown! ? Icons.arrow_drop_down : Icons.arrow_drop_up,
color: isDown ? const Color.fromRGBO(34, 197, 94, 1) : const Color.fromRGBO(239, 68, 68, 1),
size: 16.sp,
),
Text(
change,
style: TextStyle(
color: isDown ? const Color.fromRGBO(34, 197, 94, 1) : const Color.fromRGBO(239, 68, 68, 1),
fontSize: 12.sp,
),
),
],
)
else
SizedBox(height: 20.h),
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:smart_hotel_app/views/report/energy/controller.dart';
class HourlyChartBlock extends StatelessWidget {
const HourlyChartBlock({super.key});
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 16.w),
padding: EdgeInsets.all(16.w),
decoration: BoxDecoration(
color: const Color.fromRGBO(30, 41, 59, 1),
borderRadius: BorderRadius.circular(12.r),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'今日逐时用电',
style: TextStyle(
color: Colors.white,
fontSize: 16.sp,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 16.h),
SizedBox(
height: 200.h,
child: BarChart(
BarChartData(
alignment: BarChartAlignment.spaceBetween,
maxY: 200,
barTouchData: BarTouchData(enabled: false),
titlesData: FlTitlesData(
show: true,
rightTitles: const AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
topTitles: const AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
getTitlesWidget: (value, meta) {
if (value % 4 == 0) {
return Text(
'${value.toInt()}',
style: TextStyle(
color: const Color.fromRGBO(148, 163, 184, 1),
fontSize: 10.sp,
),
);
}
return const SizedBox.shrink();
},
reservedSize: 20,
),
),
leftTitles: const AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
),
borderData: FlBorderData(show: false),
gridData: const FlGridData(show: false),
barGroups: _buildBarGroups(),
),
),
),
],
),
);
}
List<BarChartGroupData> _buildBarGroups() {
return ReportEnergyController.hourlyData.asMap().entries.map((entry) {
final index = entry.key;
final value = entry.value;
return BarChartGroupData(
x: index,
barRods: [
BarChartRodData(
toY: value,
color: index >= 8 && index <= 12
? const Color.fromRGBO(59, 130, 246, 1)
: const Color.fromRGBO(37, 99, 235, 1),
width: 10.w,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(4.r),
topRight: Radius.circular(4.r),
),
),
],
);
}).toList();
}
}
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:smart_hotel_app/views/report/energy/controller.dart';
class ZoneChartBlock extends StatelessWidget {
const ZoneChartBlock({super.key});
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 16.w),
padding: EdgeInsets.all(16.w),
decoration: BoxDecoration(
color: const Color.fromRGBO(30, 41, 59, 1),
borderRadius: BorderRadius.circular(12.r),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'分区用电占比',
style: TextStyle(
color: Colors.white,
fontSize: 16.sp,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 16.h),
...ReportEnergyController.zoneData.asMap().entries.map((entry) {
final index = entry.key;
final data = entry.value;
return Padding(
padding: EdgeInsets.only(bottom: index < ReportEnergyController.zoneData.length - 1 ? 16.h : 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
data.name,
style: TextStyle(
color: Colors.white,
fontSize: 14.sp,
),
),
Text(
'${data.percentage.toInt()}% (${data.energy.toInt()} kWh)',
style: TextStyle(
color: const Color.fromRGBO(148, 163, 184, 1),
fontSize: 14.sp,
),
),
],
),
SizedBox(height: 8.h),
Stack(
children: [
Container(
height: 12.h,
decoration: BoxDecoration(
color: const Color.fromRGBO(51, 65, 85, 1),
borderRadius: BorderRadius.circular(6.r),
),
),
FractionallySizedBox(
widthFactor: data.percentage / 100,
child: Container(
height: 12.h,
decoration: BoxDecoration(
color: index == 0
? const Color.fromRGBO(59, 130, 246, 1)
: const Color.fromRGBO(71, 85, 105, 1),
borderRadius: BorderRadius.circular(6.r),
),
),
),
],
),
],
),
);
}).toList(),
],
),
);
}
}
class ReportEnergyController {
static const double todayEnergy = 1284;
static const double todayEnergyChange = -8;
static const double monthEnergy = 38420;
static const double monthEnergyChange = -5;
static const double monthBill = 6982;
static const List<double> hourlyData = [
45, 38, 32, 28, 25, 30, 42, 78, 112, 145, 168, 175,
162, 148, 132, 115, 98, 82, 70, 58, 48, 42, 38, 35
];
static const List<ZoneData> zoneData = [
ZoneData(name: '客房区域', percentage: 68, energy: 873),
ZoneData(name: '公共区域', percentage: 18, energy: 231),
ZoneData(name: '餐饮区域', percentage: 10, energy: 128),
ZoneData(name: '其他', percentage: 4, energy: 52),
];
}
class ZoneData {
final String name;
final double percentage;
final double energy;
const ZoneData({
required this.name,
required this.percentage,
required this.energy,
});
}
\ No newline at end of file
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/report/energy/controller.dart';
import 'package:smart_hotel_app/views/report/energy/child/energy_stats_card_block.dart';
import 'package:smart_hotel_app/views/report/energy/child/hourly_chart_block.dart';
import 'package:smart_hotel_app/views/report/energy/child/zone_chart_block.dart';
@RoutePage()
class ReportEnergyDetailView extends StatefulWidget {
const ReportEnergyDetailView({super.key});
@override
State<ReportEnergyDetailView> createState() => _ReportEnergyDetailViewState();
}
class _ReportEnergyDetailViewState extends State<ReportEnergyDetailView> {
@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: [
SizedBox(height: 10.h),
const EnergyStatsCardBlock(),
SizedBox(height: 20.h),
const HourlyChartBlock(),
SizedBox(height: 20.h),
const ZoneChartBlock(),
SizedBox(height: 20.h),
],
),
),
);
}
}
\ No newline at end of file
...@@ -38,6 +38,7 @@ class _ReportMetricsBlockState extends State<ReportMetricsBlock> { ...@@ -38,6 +38,7 @@ class _ReportMetricsBlockState extends State<ReportMetricsBlock> {
changeColor: Color.fromRGBO(34, 197, 94, 1), changeColor: Color.fromRGBO(34, 197, 94, 1),
progress: powerUsage['progress'] as double, progress: powerUsage['progress'] as double,
progressColor: Color.fromRGBO(59, 130, 246, 1), progressColor: Color.fromRGBO(59, 130, 246, 1),
onTap: () => _controller.navigateToEnergyDetail(),
), ),
), ),
SizedBox(width: 16.w), SizedBox(width: 16.w),
...@@ -65,8 +66,11 @@ class _ReportMetricsBlockState extends State<ReportMetricsBlock> { ...@@ -65,8 +66,11 @@ class _ReportMetricsBlockState extends State<ReportMetricsBlock> {
required Color changeColor, required Color changeColor,
required double progress, required double progress,
required Color progressColor, required Color progressColor,
VoidCallback? onTap,
}) { }) {
return Container( return GestureDetector(
onTap: onTap,
child: Container(
padding: EdgeInsets.all(20.w), padding: EdgeInsets.all(20.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.r), borderRadius: BorderRadius.circular(20.r),
...@@ -144,6 +148,7 @@ class _ReportMetricsBlockState extends State<ReportMetricsBlock> { ...@@ -144,6 +148,7 @@ class _ReportMetricsBlockState extends State<ReportMetricsBlock> {
), ),
], ],
), ),
),
); );
} }
} }
...@@ -24,7 +24,9 @@ class _RoomStatusDistributionState extends State<RoomStatusDistribution> { ...@@ -24,7 +24,9 @@ class _RoomStatusDistributionState extends State<RoomStatusDistribution> {
final statuses = distributionData['statuses'] as List<Map<String, dynamic>>; final statuses = distributionData['statuses'] as List<Map<String, dynamic>>;
final totalRooms = distributionData['totalRooms'] as int; final totalRooms = distributionData['totalRooms'] as int;
return Container( return GestureDetector(
onTap: () => _controller.navigateToRoomDetail(),
child: Container(
width: double.infinity, width: double.infinity,
margin: EdgeInsets.symmetric(horizontal: 20.w), margin: EdgeInsets.symmetric(horizontal: 20.w),
padding: EdgeInsets.all(20.w), padding: EdgeInsets.all(20.w),
...@@ -127,6 +129,7 @@ class _RoomStatusDistributionState extends State<RoomStatusDistribution> { ...@@ -127,6 +129,7 @@ class _RoomStatusDistributionState extends State<RoomStatusDistribution> {
}).toList(), }).toList(),
], ],
), ),
),
); );
} }
} }
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 ReportIndexController { class ReportIndexController {
final BuildContext context; final BuildContext context;
...@@ -86,4 +88,12 @@ class ReportIndexController { ...@@ -86,4 +88,12 @@ class ReportIndexController {
], ],
}; };
} }
void navigateToEnergyDetail() {
context.pushRoute(const ReportEnergyDetailRoute());
}
void navigateToRoomDetail() {
context.pushRoute(const ReportRoomDetailRoute());
}
} }
\ No newline at end of file
class ReportRoomController {
}
\ No newline at end of file
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/report/room/controller.dart';
@RoutePage()
class ReportRoomDetailView extends StatefulWidget {
const ReportRoomDetailView({super.key});
@override
State<ReportRoomDetailView> createState() => _ReportRoomDetailViewState();
}
class _ReportRoomDetailViewState extends State<ReportRoomDetailView> {
@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: [
SizedBox(height: 10.h),
],
),
),
);
}
}
\ No newline at end of file
...@@ -72,6 +72,8 @@ flutter: ...@@ -72,6 +72,8 @@ flutter:
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
assets: assets:
- lib/assets/ - lib/assets/
- lib/assets/login/
- lib/assets/tab/
# - images/a_dot_ham.jpeg # - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment