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

.

parent 3978e40d
......@@ -23,5 +23,7 @@ class AppRouter extends $AppRouter {
AutoRoute(page: AbnormalDetailRoute.page),
AutoRoute(page:DeviceDetailRoute.page),
AutoRoute(page: ServiceRoomDetailRoute.page),
AutoRoute(page: ReportEnergyDetailRoute.page),
AutoRoute(page: ReportRoomDetailRoute.page),
];
}
......@@ -8,8 +8,8 @@
// coverage:ignore-file
// ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:auto_route/auto_route.dart' as _i11;
import 'package:flutter/material.dart' as _i12;
import 'package:auto_route/auto_route.dart' as _i13;
import 'package:flutter/material.dart' as _i14;
import 'package:smart_hotel_app/views/home/abnormal/abnormal_detail_view.dart'
as _i1;
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;
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/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/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/report/energy/energy_detail_view.dart'
as _i7;
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'
as _i10;
as _i12;
abstract class $AppRouter extends _i11.RootStackRouter {
abstract class $AppRouter extends _i13.RootStackRouter {
$AppRouter({super.navigatorKey});
@override
final Map<String, _i11.PageFactory> pagesMap = {
final Map<String, _i13.PageFactory> pagesMap = {
AbnormalDetailRoute.name: (routeData) {
return _i11.AutoRoutePage<dynamic>(
return _i13.AutoRoutePage<dynamic>(
routeData: routeData,
child: const _i1.AbnormalDetailView(),
);
},
DefaultLayoutRoute.name: (routeData) {
return _i11.AutoRoutePage<dynamic>(
return _i13.AutoRoutePage<dynamic>(
routeData: routeData,
child: const _i2.DefaultLayoutView(),
);
},
DeviceDetailRoute.name: (routeData) {
return _i11.AutoRoutePage<dynamic>(
return _i13.AutoRoutePage<dynamic>(
routeData: routeData,
child: const _i3.DeviceDetailView(),
);
},
HomeRoute.name: (routeData) {
return _i11.AutoRoutePage<dynamic>(
return _i13.AutoRoutePage<dynamic>(
routeData: routeData,
child: const _i4.HomeView(),
);
},
LoginRoute.name: (routeData) {
return _i11.AutoRoutePage<dynamic>(
return _i13.AutoRoutePage<dynamic>(
routeData: routeData,
child: const _i5.LoginView(),
);
},
ProfileRoute.name: (routeData) {
return _i11.AutoRoutePage<dynamic>(
return _i13.AutoRoutePage<dynamic>(
routeData: routeData,
child: const _i6.ProfileView(),
);
},
ReportEnergyDetailRoute.name: (routeData) {
return _i13.AutoRoutePage<dynamic>(
routeData: routeData,
child: const _i7.ReportEnergyDetailView(),
);
},
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,
child: const _i7.ReportIndexView(),
child: const _i9.ReportRoomDetailView(),
);
},
SearchRoute.name: (routeData) {
final args = routeData.argsAs<SearchRouteArgs>(
orElse: () => const SearchRouteArgs());
return _i11.AutoRoutePage<dynamic>(
return _i13.AutoRoutePage<dynamic>(
routeData: routeData,
child: _i8.SearchView(
child: _i10.SearchView(
key: args.key,
searchKey: args.searchKey,
),
);
},
ServiceIndexRoute.name: (routeData) {
return _i11.AutoRoutePage<dynamic>(
return _i13.AutoRoutePage<dynamic>(
routeData: routeData,
child: const _i9.ServiceIndexView(),
child: const _i11.ServiceIndexView(),
);
},
ServiceRoomDetailRoute.name: (routeData) {
final args = routeData.argsAs<ServiceRoomDetailRouteArgs>(
orElse: () => const ServiceRoomDetailRouteArgs());
return _i11.AutoRoutePage<dynamic>(
return _i13.AutoRoutePage<dynamic>(
routeData: routeData,
child: _i10.ServiceRoomDetailView(
child: _i12.ServiceRoomDetailView(
key: args.key,
roomNumber: args.roomNumber,
),
......@@ -104,8 +119,8 @@ abstract class $AppRouter extends _i11.RootStackRouter {
/// generated route for
/// [_i1.AbnormalDetailView]
class AbnormalDetailRoute extends _i11.PageRouteInfo<void> {
const AbnormalDetailRoute({List<_i11.PageRouteInfo>? children})
class AbnormalDetailRoute extends _i13.PageRouteInfo<void> {
const AbnormalDetailRoute({List<_i13.PageRouteInfo>? children})
: super(
AbnormalDetailRoute.name,
initialChildren: children,
......@@ -113,13 +128,13 @@ class AbnormalDetailRoute extends _i11.PageRouteInfo<void> {
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
/// [_i2.DefaultLayoutView]
class DefaultLayoutRoute extends _i11.PageRouteInfo<void> {
const DefaultLayoutRoute({List<_i11.PageRouteInfo>? children})
class DefaultLayoutRoute extends _i13.PageRouteInfo<void> {
const DefaultLayoutRoute({List<_i13.PageRouteInfo>? children})
: super(
DefaultLayoutRoute.name,
initialChildren: children,
......@@ -127,13 +142,13 @@ class DefaultLayoutRoute extends _i11.PageRouteInfo<void> {
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
/// [_i3.DeviceDetailView]
class DeviceDetailRoute extends _i11.PageRouteInfo<void> {
const DeviceDetailRoute({List<_i11.PageRouteInfo>? children})
class DeviceDetailRoute extends _i13.PageRouteInfo<void> {
const DeviceDetailRoute({List<_i13.PageRouteInfo>? children})
: super(
DeviceDetailRoute.name,
initialChildren: children,
......@@ -141,13 +156,13 @@ class DeviceDetailRoute extends _i11.PageRouteInfo<void> {
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
/// [_i4.HomeView]
class HomeRoute extends _i11.PageRouteInfo<void> {
const HomeRoute({List<_i11.PageRouteInfo>? children})
class HomeRoute extends _i13.PageRouteInfo<void> {
const HomeRoute({List<_i13.PageRouteInfo>? children})
: super(
HomeRoute.name,
initialChildren: children,
......@@ -155,13 +170,13 @@ class HomeRoute extends _i11.PageRouteInfo<void> {
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
/// [_i5.LoginView]
class LoginRoute extends _i11.PageRouteInfo<void> {
const LoginRoute({List<_i11.PageRouteInfo>? children})
class LoginRoute extends _i13.PageRouteInfo<void> {
const LoginRoute({List<_i13.PageRouteInfo>? children})
: super(
LoginRoute.name,
initialChildren: children,
......@@ -169,13 +184,13 @@ class LoginRoute extends _i11.PageRouteInfo<void> {
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
/// [_i6.ProfileView]
class ProfileRoute extends _i11.PageRouteInfo<void> {
const ProfileRoute({List<_i11.PageRouteInfo>? children})
class ProfileRoute extends _i13.PageRouteInfo<void> {
const ProfileRoute({List<_i13.PageRouteInfo>? children})
: super(
ProfileRoute.name,
initialChildren: children,
......@@ -183,13 +198,27 @@ class ProfileRoute extends _i11.PageRouteInfo<void> {
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
/// [_i7.ReportIndexView]
class ReportIndexRoute extends _i11.PageRouteInfo<void> {
const ReportIndexRoute({List<_i11.PageRouteInfo>? children})
/// [_i8.ReportIndexView]
class ReportIndexRoute extends _i13.PageRouteInfo<void> {
const ReportIndexRoute({List<_i13.PageRouteInfo>? children})
: super(
ReportIndexRoute.name,
initialChildren: children,
......@@ -197,16 +226,30 @@ class ReportIndexRoute extends _i11.PageRouteInfo<void> {
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
/// [_i8.SearchView]
class SearchRoute extends _i11.PageRouteInfo<SearchRouteArgs> {
/// [_i10.SearchView]
class SearchRoute extends _i13.PageRouteInfo<SearchRouteArgs> {
SearchRoute({
_i12.Key? key,
_i14.Key? key,
String? searchKey,
List<_i11.PageRouteInfo>? children,
List<_i13.PageRouteInfo>? children,
}) : super(
SearchRoute.name,
args: SearchRouteArgs(
......@@ -218,8 +261,8 @@ class SearchRoute extends _i11.PageRouteInfo<SearchRouteArgs> {
static const String name = 'SearchRoute';
static const _i11.PageInfo<SearchRouteArgs> page =
_i11.PageInfo<SearchRouteArgs>(name);
static const _i13.PageInfo<SearchRouteArgs> page =
_i13.PageInfo<SearchRouteArgs>(name);
}
class SearchRouteArgs {
......@@ -228,7 +271,7 @@ class SearchRouteArgs {
this.searchKey,
});
final _i12.Key? key;
final _i14.Key? key;
final String? searchKey;
......@@ -239,9 +282,9 @@ class SearchRouteArgs {
}
/// generated route for
/// [_i9.ServiceIndexView]
class ServiceIndexRoute extends _i11.PageRouteInfo<void> {
const ServiceIndexRoute({List<_i11.PageRouteInfo>? children})
/// [_i11.ServiceIndexView]
class ServiceIndexRoute extends _i13.PageRouteInfo<void> {
const ServiceIndexRoute({List<_i13.PageRouteInfo>? children})
: super(
ServiceIndexRoute.name,
initialChildren: children,
......@@ -249,17 +292,17 @@ class ServiceIndexRoute extends _i11.PageRouteInfo<void> {
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
/// [_i10.ServiceRoomDetailView]
/// [_i12.ServiceRoomDetailView]
class ServiceRoomDetailRoute
extends _i11.PageRouteInfo<ServiceRoomDetailRouteArgs> {
extends _i13.PageRouteInfo<ServiceRoomDetailRouteArgs> {
ServiceRoomDetailRoute({
_i12.Key? key,
_i14.Key? key,
String? roomNumber,
List<_i11.PageRouteInfo>? children,
List<_i13.PageRouteInfo>? children,
}) : super(
ServiceRoomDetailRoute.name,
args: ServiceRoomDetailRouteArgs(
......@@ -271,8 +314,8 @@ class ServiceRoomDetailRoute
static const String name = 'ServiceRoomDetailRoute';
static const _i11.PageInfo<ServiceRoomDetailRouteArgs> page =
_i11.PageInfo<ServiceRoomDetailRouteArgs>(name);
static const _i13.PageInfo<ServiceRoomDetailRouteArgs> page =
_i13.PageInfo<ServiceRoomDetailRouteArgs>(name);
}
class ServiceRoomDetailRouteArgs {
......@@ -281,7 +324,7 @@ class ServiceRoomDetailRouteArgs {
this.roomNumber,
});
final _i12.Key? key;
final _i14.Key? key;
final String? roomNumber;
......
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:smart_hotel_app/views/home/index/controller.dart';
class EquipmentListBlock extends StatefulWidget {
const EquipmentListBlock({super.key});
final HomeIndexController controller;
const EquipmentListBlock({super.key, required this.controller});
@override
State<EquipmentListBlock> createState() => _EquipmentListBlockState();
}
class _EquipmentListBlockState extends State<EquipmentListBlock> {
final List<Map<String, dynamic>> _equipmentList = [
{
'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) {
Widget _buildEquipmentItem(EquipmentItem item) {
return Container(
padding: EdgeInsets.symmetric(vertical: 8.h),
padding: EdgeInsets.symmetric(vertical: 16.h),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Color.fromRGBO(71, 85, 105, 0.3),
width: 1,
color: Color.fromRGBO(235, 235, 235, 1.0),
width: 1.w,
),
),
),
child: Row(
children: [
Container(
width: 40.w,
height: 40.h,
width: 64.w,
height: 66.h,
decoration: BoxDecoration(
color: Color.fromRGBO(71, 85, 105, 0.3),
borderRadius: BorderRadius.circular(8.r),
color: Color.fromRGBO(235, 244, 255, 1.0),
borderRadius: BorderRadius.circular(12.r),
),
child: Icon(
item['icon'] as IconData,
color: Color.fromRGBO(246, 158, 11, 1),
size: 20.sp,
item.icon,
color: Color.fromRGBO(66, 165, 245, 1.0),
size: 32.sp,
),
),
SizedBox(width: 12.w),
SizedBox(width: 16.w),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
item['title'] as String,
Transform.translate(
offset: Offset(0, 2.h),
child: Text(
item.title,
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w500,
color: Colors.white,
fontSize: 28.sp,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
SizedBox(height: 4.h),
Text(
item['subtitle'] as String,
item.subtitle,
style: TextStyle(
fontSize: 12.sp,
color: Color.fromRGBO(148, 163, 184, 1),
fontSize: 24.sp,
color: Color.fromRGBO(100, 116, 139, 1.0),
),
),
],
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h),
decoration: BoxDecoration(
color: (item['statusColor'] as Color).withOpacity(0.2),
borderRadius: BorderRadius.circular(4.r),
),
child: Text(
item['status'] as String,
Text(
item.status,
style: TextStyle(
fontSize: 12.sp,
color: item['statusColor'] as Color,
),
fontSize: 24.sp,
fontWeight: FontWeight.bold,
color: item.statusColor,
),
),
],
......@@ -167,9 +80,11 @@ class _EquipmentListBlockState extends State<EquipmentListBlock> {
@override
Widget build(BuildContext context) {
final equipmentList = widget.controller.getEquipmentList();
return Container(
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(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
......@@ -177,29 +92,38 @@ class _EquipmentListBlockState extends State<EquipmentListBlock> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('设备巡检',style: TextStyle(fontSize: 14.sp,fontWeight: FontWeight.bold,color: Colors.white),),
Text('查看全部',style: TextStyle(fontSize: 14.sp,fontWeight: FontWeight.bold,color: Colors.white),),
Text(
'设备巡检',
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),
Container(
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(
borderRadius: BorderRadius.circular(25.r),
color: Color.fromRGBO(30, 41, 59, 1),
border: BoxBorder.all(
color: Color.fromRGBO(246, 158, 11, 1.0),
width: 1.w,
),
borderRadius: BorderRadius.circular(20.r),
color: Colors.white,
),
child: Column(
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_screenutil/flutter_screenutil.dart';
import 'package:smart_hotel_app/views/home/index/controller.dart';
class TaskHeadBlock extends StatefulWidget {
const TaskHeadBlock({super.key});
final HomeIndexController controller;
const TaskHeadBlock({super.key, required this.controller});
@override
State<TaskHeadBlock> createState() => _TaskHeadBlockState();
......@@ -13,51 +16,28 @@ class _TaskHeadBlockState extends State<TaskHeadBlock> {
Widget build(BuildContext context) {
return Container(
width: double.infinity,
height: 140.h,
padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight,left: 20.w,right: 20.w),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.blueGrey,
width: 1.w,
),
),
// color: Colors.red,
),
// height: 140.h,
padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight),
child: Column(
children: [
Flex(
direction: Axis.horizontal,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('设备告警看板',style: TextStyle(fontSize: 28.sp,fontWeight: FontWeight.bold,color: Colors.white),),
Text('工程运维视角 今日xx条待处理',style: TextStyle(fontSize: 24.sp,color: Color.fromRGBO(61, 79, 106, 1.0)),),
],
),
Container(
width: 50.w,
height: 50.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r),
color: Colors.grey,
border: Border.all(
color: Colors.blueGrey,
width: 1.w,
Text(
'设备告警看板',
style: TextStyle(
fontSize: 28.sp,
fontWeight: FontWeight.bold,
color: Color.fromRGBO(51, 51, 51, 1.0),
),
),
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_screenutil/flutter_screenutil.dart';
import 'package:smart_hotel_app/views/home/index/controller.dart';
class TaskTotalBlock extends StatefulWidget {
const TaskTotalBlock({super.key});
final HomeIndexController controller;
const TaskTotalBlock({super.key, required this.controller});
@override
State<TaskTotalBlock> createState() => _TaskTotalBlockState();
......@@ -13,141 +16,119 @@ class _TaskTotalBlockState extends State<TaskTotalBlock> {
Widget build(BuildContext context) {
return Container(
width: double.infinity,
height: 180.h,
decoration: BoxDecoration(
// color: Colors.red,
border: Border(
bottom: BorderSide(
width: 1.w,
),
),
),
alignment: Alignment.center,
// height: 180.h,
child: Flex(
direction: Axis.horizontal,
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// 告警待处理
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 190.w,
// 高警待处理
Expanded(
child: Container(
margin: EdgeInsets.only(right: 10.w),
height: 120.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r),
borderRadius: BorderRadius.circular(16.r),
color: Colors.white,
border: Border.all(
color: Colors.blueGrey,
width: 1.w,
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text('1',style: TextStyle(fontSize: 28.sp,fontWeight: FontWeight.bold,color: Colors.green),),
Text('告警待处理',style: TextStyle(fontSize: 14.sp,fontWeight: FontWeight.bold,color: Colors.grey),),
],
Text(
'${widget.controller.getHighAlarmCount()}',
style: TextStyle(
fontSize: 48.sp,
fontWeight: FontWeight.bold,
color: Color.fromRGBO(255, 77, 79, 1.0),
),
),
Container(
width: 160.w,
height: 1.h,
margin: EdgeInsets.only(top: 5.h),
decoration: BoxDecoration(
color: Colors.white,
border: Border(bottom: BorderSide(
color: Colors.blueGrey,
width: 1.w,
)),
// SizedBox(height: 5.h),
Transform.translate(
offset: Offset(0, -8.h),
child: Text(
'高警待处理',
style: TextStyle(
fontSize: 24.sp,
color: Color.fromRGBO(100, 116, 139, 1.0),
),
),
),
],
),
),
),
// 中警待处理
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 190.w,
Expanded(
child: Container(
margin: EdgeInsets.symmetric(horizontal: 10.w),
height: 120.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r),
borderRadius: BorderRadius.circular(16.r),
color: Colors.white,
border: Border.all(
color: Colors.blueGrey,
width: 1.w,
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('12',style: TextStyle(fontSize: 28.sp,fontWeight: FontWeight.bold,color: Colors.green),),
Text('中警待处理',style: TextStyle(fontSize: 14.sp,fontWeight: FontWeight.bold,color: Colors.grey),),
],
Text(
'${widget.controller.getMediumAlarmCount()}',
style: TextStyle(
fontSize: 48.sp,
fontWeight: FontWeight.bold,
color: Color.fromRGBO(100, 116, 139, 1.0),
),
),
Container(
width: 160.w,
height: 1.h,
margin: EdgeInsets.only(top: 5.h),
decoration: BoxDecoration(
color: Colors.white,
border: Border(bottom: BorderSide(
color: Colors.blueGrey,
width: 1.w,
)),
// SizedBox(height: 8.h),
Transform.translate(
offset: Offset(0, -8.h),
child: Text(
'中警待处理',
style: TextStyle(
fontSize: 24.sp,
color: Color.fromRGBO(100, 116, 139, 1.0),
),
),
),
],
),
),
),
// 设备在线
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 190.w,
Expanded(
child: Container(
margin: EdgeInsets.only(left: 10.w),
height: 120.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r),
borderRadius: BorderRadius.circular(16.r),
color: Colors.white,
border: Border.all(
color: Colors.blueGrey,
width: 1.w,
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('88',style: TextStyle(fontSize: 28.sp,fontWeight: FontWeight.bold,color: Colors.green),),
Text('设备在线',style: TextStyle(fontSize: 14.sp,fontWeight: FontWeight.bold,color: Colors.grey),),
],
Text(
'${widget.controller.getOnlineDeviceCount()}',
style: TextStyle(
fontSize: 48.sp,
fontWeight: FontWeight.bold,
color: Color.fromRGBO(26, 188, 156, 1.0),
),
),
Container(
width: 160.w,
height: 1.h,
margin: EdgeInsets.only(top: 5.h),
decoration: BoxDecoration(
color: Colors.white,
border: Border(bottom: BorderSide(
color: Colors.blueGrey,
width: 1.w,
)),
// SizedBox(height: 8.h),
Transform.translate(
offset: Offset(0, -8.h),
child: Text(
'设备在线',
style: TextStyle(
fontSize: 24.sp,
color: Color.fromRGBO(100, 116, 139, 1.0),
),
),
),
],
),
),
),
],
),
);
......
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:smart_hotel_app/views/home/index/controller.dart';
class TemperatureBlock extends StatefulWidget {
const TemperatureBlock({super.key});
final HomeIndexController controller;
const TemperatureBlock({super.key, required this.controller});
@override
State<TemperatureBlock> createState() => _TemperatureBlockState();
......@@ -13,127 +16,157 @@ class _TemperatureBlockState extends State<TemperatureBlock> {
Widget build(BuildContext context) {
return Container(
width: double.infinity,
// height: 280.h,
margin: EdgeInsets.only(top: 10.h,left: 20.w,right: 20.w),
padding: EdgeInsets.all(20.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r),
color: Color.fromRGBO(30, 41, 59, 1),
border: Border(
left: BorderSide(
color: Color.fromRGBO(246, 158, 11, 1.0),
width: 10.w,
)),
borderRadius: BorderRadius.circular(20.r),
color: Colors.white,
),
child: Column(
children: [
// 描述信息
Container(
width: double.infinity,
// height: 100.h,
margin: EdgeInsets.only(bottom: 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,
margin: EdgeInsets.only(bottom: 16.h),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 50.w,
height: 50.h,
width: 66.w,
height: 68.h,
decoration: BoxDecoration(
color: Color.fromRGBO(71, 85, 105, 0.3),
borderRadius: BorderRadius.circular(8.r),
color: Color.fromRGBO(235, 244, 255, 1.0),
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(
child: Container(
width: 50.w,
padding: EdgeInsets.only(left: 10.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("温度异常告警",style: TextStyle(fontSize: 20.sp,color: Color.fromRGBO(246, 158, 11, 1.0),),),
Text("客房301 A-301 智能空开",style: TextStyle(fontSize: 15.sp,color: Colors.grey),),
Text(
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(
width: double.infinity,
height: 100.h,
padding: EdgeInsets.symmetric(vertical: 20.h),
decoration: BoxDecoration(
color: Color.fromRGBO(24, 33, 47, 1.0),
borderRadius: BorderRadius.circular(25.r),
border:BoxBorder.all(
color: Color.fromRGBO(246, 158, 11, 1.0),
width: 1.w,
),
color: Color.fromRGBO(235, 244, 255, 1.0),
borderRadius: BorderRadius.circular(16.r),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Container(
width: 100.w,
height: 80.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r),
color: Colors.white,
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text("85℃",style: TextStyle(fontSize: 20.sp,color: Color.fromRGBO(246, 158, 11, 1.0),),),
Text("当前温度",style: TextStyle(fontSize: 15.sp,color: Colors.grey),),
],
Text(
'${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(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text("22V",style: TextStyle(fontSize: 20.sp,color: Color.fromRGBO(246, 158, 11, 1.0),),),
Text("电压",style: TextStyle(fontSize: 15.sp,color: Colors.grey),),
],
Text(
'${widget.controller.getCurrentVoltage()}V',
style: TextStyle(
fontSize: 40.sp,
fontWeight: FontWeight.bold,
color: Color.fromRGBO(73, 149, 234, 1.0),
),
),
Container(
width: 100.w,
height: 80.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r),
color: Colors.white,
// 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),
),
),
),
],
),
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text("3.2A",style: TextStyle(fontSize: 20.sp,color: Color.fromRGBO(246, 158, 11, 1.0),),),
Text("电流",style: TextStyle(fontSize: 15.sp,color: Colors.grey),),
Text(
'${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> {
// 操作行
Container(
width: double.infinity,
// height: 100.h,
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,
margin: EdgeInsets.only(top: 14.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
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(
mainAxisSize: MainAxisSize.min,
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(
style: ElevatedButton.styleFrom(
backgroundColor: Color.fromRGBO(246, 158, 11, 1.0),
minimumSize: Size(100.w, 55.h),
padding: EdgeInsets.zero,
alignment: Alignment.center,
visualDensity: VisualDensity.compact,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
backgroundColor: Color.fromRGBO(73, 149, 234, 1.0),
minimumSize: Size(149.w, 60.h),
padding: EdgeInsets.symmetric(horizontal: 24.w),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.r),
borderRadius: BorderRadius.circular(16.r),
),
),
onPressed: () {
print("立即处理");
},
child: Text("立即处理",style: TextStyle(fontSize: 14.sp,color: Colors.white),),
),
// SizedBox(width: 8.w),
// ElevatedButton(
// style: ElevatedButton.styleFrom(
// backgroundColor: Color.fromRGBO(51, 65, 85, 1),
// 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),),
// ),
],
)
child: Text(
"立即处理",
style: TextStyle(
fontSize: 24.sp,
color: Colors.white,
fontWeight: FontWeight.w200,
),
),
),
],
),
),
],
),
);
......
......@@ -3,155 +3,154 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:smart_hotel_app/views/home/index/controller.dart';
class VoltageOperateBlock extends StatefulWidget {
const VoltageOperateBlock({super.key});
final HomeIndexController controller;
const VoltageOperateBlock({super.key, required this.controller});
@override
State<VoltageOperateBlock> createState() => _VoltageOperateBlockState();
}
class _VoltageOperateBlockState extends State<VoltageOperateBlock> {
late final HomeIndexController _controller;
@override
void initState() {
super.initState();
_controller = HomeIndexController(context);
}
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
// height: 280.h,
margin: EdgeInsets.only(top: 10.h,left: 20.w,right: 20.w),
// margin: EdgeInsets.symmetric(horizontal: 14.w, vertical: 24.h),
padding: EdgeInsets.all(20.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r),
color: Color.fromRGBO(30, 41, 59, 1),
border: BoxBorder.all(
color: Color.fromRGBO(246, 158, 11, 1.0),
width: 1.w,
),
borderRadius: BorderRadius.circular(20.r),
color: Colors.white,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 描述信息
Container(
width: double.infinity,
// height: 100.h,
margin: EdgeInsets.only(bottom: 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,
margin: EdgeInsets.only(bottom: 16.h),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 50.w,
height: 50.h,
width: 64.w,
height: 66.h,
decoration: BoxDecoration(
color: Color.fromRGBO(71, 85, 105, 0.3),
borderRadius: BorderRadius.circular(8.r),
color: Color.fromRGBO(235, 244, 255, 1.0),
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(
child: Container(
width: 50.w,
padding: EdgeInsets.only(left: 10.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("电压波动告警",style: TextStyle(fontSize: 20.sp,color: Color.fromRGBO(246, 158, 11, 1.0),),),
Text("客房301 A-301 智能空开",style: TextStyle(fontSize: 15.sp,color: Colors.grey),),
Text(
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(
width: double.infinity,
decoration: BoxDecoration(
color: Color.fromRGBO(24, 33, 47, 1.0),
borderRadius: BorderRadius.circular(25.r),
border:BoxBorder.all(
color: Color.fromRGBO(246, 158, 11, 1.0),
width: 1.w,
margin: EdgeInsets.only(left: 80.w,bottom: 10.h),
child: Text(
'电压${widget.controller.getVoltageValue()}V (正常≤${widget.controller.getNormalVoltage()}V)·已等待${widget.controller.getVoltageWaitTime()}',
style: TextStyle(
fontSize: 24.sp,
color: Color.fromRGBO(100, 116, 139, 1.0),
),
),
child: Text("电压220V(正常《235V) 已等待1h20m",style: TextStyle(fontSize: 15.sp,color: Colors.grey),)
),
// 操作行
Container(
width: double.infinity,
// height: 100.h,
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,
child: Row(
children: [
ElevatedButton(
Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Color.fromRGBO(246, 158, 11, 1.0),
minimumSize: Size(330.w, 55.h),
padding: EdgeInsets.zero,
alignment: Alignment.center,
visualDensity: VisualDensity.compact,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
backgroundColor: Color.fromRGBO(73, 149, 234, 1.0),
minimumSize: Size(0, 60.h),
padding: EdgeInsets.symmetric(vertical: 16.h),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.r),
borderRadius: BorderRadius.circular(16.r),
),
),
onPressed: () {
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),
ElevatedButton(
SizedBox(width: 16.w),
Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Color.fromRGBO(51, 65, 85, 1),
minimumSize: Size(330.w, 55.h),
padding: EdgeInsets.zero,
alignment: Alignment.center,
visualDensity: VisualDensity.compact,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
backgroundColor: Color.fromRGBO(229, 241, 255, 1.0),
minimumSize: Size(0, 60.h),
padding: EdgeInsets.symmetric(vertical: 16.h),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.r),
borderRadius: BorderRadius.circular(16.r),
),
),
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';
// import 'package:smart_hotel_app/routes/app_router.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 {
final BuildContext context;
HomeIndexController(this.context);
......@@ -10,4 +26,161 @@ class HomeIndexController {
void handleToAbnormalDetail() {
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> {
),
child: Container(
width: double.infinity,
color: Color.fromRGBO(15, 23, 42, 1),
child: const Column(
color: Color.fromRGBO(242, 243, 245, 1),
padding: EdgeInsets.symmetric(horizontal: 28.w),
child: Column(
children: [
TaskHeadBlock(),
TaskTotalBlock(),
TemperatureBlock(),
VoltageOperateBlock(),
EquipmentListBlock(),
TaskHeadBlock(controller: _controller),
SizedBox(height: 20.h),
TaskTotalBlock(controller: _controller),
SizedBox(height: 20.h),
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:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:smart_hotel_app/routes/app_router.gr.dart';
@RoutePage()
......@@ -29,17 +30,64 @@ class _DefaultLayoutViewState extends State<DefaultLayoutView> {
onTap: tabsRouter.setActiveIndex,
elevation: 0,
backgroundColor: Colors.white,
selectedItemColor: Colors.blue,
selectedItemColor: const Color(0xFF4995EA),
unselectedItemColor: const Color(0xFF666666),
type: BottomNavigationBarType.fixed,
selectedFontSize: 12,
unselectedFontSize: 12,
items: const [
BottomNavigationBarItem(icon: Icon(Icons.home), label: "告警"),
BottomNavigationBarItem(icon: Icon(Icons.new_label), label: "服务"),
BottomNavigationBarItem(icon: Icon(Icons.message), label: "看板"),
selectedFontSize: 24.sp,
unselectedFontSize: 24.sp,
items: [
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 {
Widget build(BuildContext context) {
return Container(
width: double.infinity,
height: 70.h,
height: 96.h,
decoration: BoxDecoration(
color: Color.fromRGBO(89, 109, 243, 1),
borderRadius: BorderRadius.circular(20),
color: Color.fromRGBO(73, 149, 234, 1),
borderRadius: BorderRadius.circular(40.w),
),
child: ElevatedButton(
onPressed: isLoading ? null : onPressed,
......@@ -28,17 +28,21 @@ class BtnLogin extends StatelessWidget {
elevation: 0,
),
child: isLoading
? const SizedBox(
width: 20,
height: 20,
? SizedBox(
width: 40.w,
height: 40.w,
child: CircularProgressIndicator(
strokeWidth: 2,
strokeWidth: 3.w,
color: Colors.white,
),
)
: const Text(
"提交",
style: TextStyle(color: Colors.white),
: Text(
"登录",
style: TextStyle(
color: Colors.white,
fontSize: 32.sp,
fontWeight: FontWeight.bold,
),
),
),
);
......
......@@ -28,7 +28,7 @@ class _PasswordFieldState extends State<PasswordField> {
return TextFormField(
controller: widget.controller,
obscureText: _obscureText,
style: const TextStyle(color: Colors.white, fontSize: 14),
style: TextStyle(color: Color(0xFF333333), fontSize: 28.sp),
validator: (val) {
if (val == null || val.isEmpty) {
return "密码不能为空";
......@@ -37,44 +37,44 @@ class _PasswordFieldState extends State<PasswordField> {
},
decoration: InputDecoration(
filled: true,
hintText: "请输入密码",
hintStyle: const TextStyle(color: Colors.white70, fontSize: 14),
prefixIcon: const Icon(Icons.lock, color: Colors.white, size: 20),
prefixIconConstraints: const BoxConstraints(minWidth: 40, minHeight: 40),
hintText: "password",
hintStyle: TextStyle(color: Color(0xFF999999), fontSize: 28.sp),
prefixIcon: Icon(Icons.lock, color: Color(0xFF999999), size: 40.w),
prefixIconConstraints: BoxConstraints(minWidth: 80.w, minHeight: 80.w),
suffixIcon: IconButton(
icon: Icon(
_obscureText ? Icons.visibility_off : Icons.visibility,
color: Colors.white,
size: 20,
color: Color(0xFF999999),
size: 40.w,
),
onPressed: _toggleVisibility,
),
suffixIconConstraints: const BoxConstraints(minWidth: 40, minHeight: 40),
contentPadding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
suffixIconConstraints: BoxConstraints(minWidth: 80.w, minHeight: 80.w),
contentPadding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 24.w),
helperText: " ",
helperStyle: TextStyle(height: 1.1, fontSize: 12.sp),
errorStyle: TextStyle(color: Colors.red, fontSize: 12.sp, height: 1.1),
helperStyle: TextStyle(height: 1, fontSize: 24.sp),
errorStyle: TextStyle(color: Colors.red, fontSize: 24.sp, height: 1),
errorMaxLines: 1,
fillColor: const Color(0xFF1A2B3C),
fillColor: Colors.white,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(25),
borderSide: const BorderSide(color: Colors.white30, width: 1),
borderRadius: BorderRadius.circular(24.w),
borderSide: BorderSide.none,
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25),
borderSide: const BorderSide(color: Colors.white30, width: 1),
borderRadius: BorderRadius.circular(24.w),
borderSide: BorderSide(color: Color(0xFFF5F7FA), width: 1),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25),
borderSide: const BorderSide(color: Colors.white, width: 1.5),
borderRadius: BorderRadius.circular(24.w),
borderSide: BorderSide(color: Color(0xFFF5F7FA), width: 1),
),
errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25),
borderSide: const BorderSide(color: Colors.red, width: 1),
borderRadius: BorderRadius.circular(24.w),
borderSide: BorderSide(color: Colors.red, width: 1),
),
focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25),
borderSide: const BorderSide(color: Colors.red, width: 1.5),
borderRadius: BorderRadius.circular(24.w),
borderSide: BorderSide(color: Colors.red, width: 1.5),
),
),
);
......
......@@ -24,42 +24,41 @@ class RememberPasswordRow extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 32,
height: 32,
width: 40.w,
height: 40.w,
child: Transform.scale(
scale: 0.7,
scale: 0.8,
child: Checkbox(
value: value,
onChanged: onChanged,
activeColor: const Color.fromRGBO(89, 109, 243, 1),
activeColor: Color(0xFF4A90E2),
checkColor: Colors.white,
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,
),
),
),
Container(
margin: EdgeInsets.only(bottom: 2.h),
child: Text(
SizedBox(width: 10.w),
Text(
'记住密码',
style: TextStyle(color: Colors.white, fontSize: 18.sp),
style: TextStyle(
color: Color(0xFF0A0D14),
fontSize: 24.sp,
),
),
)
],
),
),
GestureDetector(
onTap: onForgotPassword,
child: Text(
'忘记密码',
'忘记密码?',
style: TextStyle(
color: Color.fromRGBO(89, 109, 243, 1),
fontSize: 18.sp,
color: Color(0xFF0A0D14),
fontSize: 24.sp,
),
),
),
......
......@@ -13,7 +13,7 @@ class UsernameField extends StatelessWidget {
Widget build(BuildContext context) {
return TextFormField(
controller: controller,
style: const TextStyle(color: Colors.white, fontSize: 14),
style: TextStyle(color: Color(0xFF333333), fontSize: 28.sp),
validator: (val) {
if (val == null || val.isEmpty) {
return "用户名不能为空哦";
......@@ -22,35 +22,35 @@ class UsernameField extends StatelessWidget {
},
decoration: InputDecoration(
filled: true,
hintText: "请输入用户名",
hintStyle: const TextStyle(color: Colors.white70, fontSize: 14),
prefixIcon: const Icon(Icons.person, color: Colors.white, size: 20),
prefixIconConstraints: const BoxConstraints(minWidth: 40, minHeight: 40),
contentPadding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
hintText: "admin",
hintStyle: TextStyle(color: Color(0xFF999999), fontSize: 28.sp),
prefixIcon: Icon(Icons.person, color: Color(0xFF999999), size: 40.w),
prefixIconConstraints: BoxConstraints(minWidth: 80.w, minHeight: 80.w),
contentPadding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 24.w),
helperText: " ",
helperStyle: TextStyle(height: 1, fontSize: 12.sp),
errorStyle: TextStyle(color: Colors.red, fontSize: 12.sp, height: 1),
helperStyle: TextStyle(height: 1, fontSize: 24.sp),
errorStyle: TextStyle(color: Colors.red, fontSize: 24.sp, height: 1),
errorMaxLines: 1,
fillColor: const Color(0xFF1A2B3C),
fillColor: Colors.white,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(25),
borderSide: const BorderSide(color: Colors.white30, width: 1),
borderRadius: BorderRadius.circular(24.w),
borderSide: BorderSide.none,
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25),
borderSide: const BorderSide(color: Colors.white30, width: 1),
borderRadius: BorderRadius.circular(24.w),
borderSide: BorderSide(color: Color(0xFFF5F7FA), width: 1),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25),
borderSide: const BorderSide(color: Colors.white, width: 1.5),
borderRadius: BorderRadius.circular(24.w),
borderSide: BorderSide(color: Color(0xFFF5F7FA), width: 1),
),
errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25),
borderSide: const BorderSide(color: Colors.red, width: 1),
borderRadius: BorderRadius.circular(24.w),
borderSide: BorderSide(color: Colors.red, width: 1),
),
focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25),
borderSide: const BorderSide(color: Colors.red, width: 1.5),
borderRadius: BorderRadius.circular(24.w),
borderSide: BorderSide(color: Colors.red, width: 1),
),
),
);
......
......@@ -62,29 +62,59 @@ class _LoginViewState extends State<LoginView> {
height: double.infinity,
padding: EdgeInsets.only(left: 50.w, right: 50.w),
decoration: BoxDecoration(
color: Color(0xFF1A2B3C),
color: Color(0xFFF5F7FA),
),
child: SingleChildScrollView(
child: Column(
children: [
SizedBox(height: 150.h),
Container(
margin: EdgeInsets.only(top: 150.h, bottom: 150.h),
margin: EdgeInsets.only(bottom: 80.h),
child: Column(
children: [
Image.asset(
'lib/assets/znjd_logo.png',
width: 100,
height: 100,
),
const SizedBox(height: 10),
Text("智能酒店管理系统", style: TextStyle(color: Colors.white, fontSize: 20.sp),),
Text("Intelligent Hotel Management System", style: TextStyle(color: Colors.white, fontSize: 20.sp),),
Container(
width: 160.w,
height: 160.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40.w),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color(0xFF00C6FF),
Color(0xFF0072FF),
],
),
),
Container(
child: Form(
child: ClipRRect(
borderRadius: BorderRadius.circular(40.w),
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,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
......@@ -92,11 +122,11 @@ class _LoginViewState extends State<LoginView> {
UsernameField(
controller: _txtUserNameController,
),
const SizedBox(height: 10),
SizedBox(height: 20.h),
PasswordField(
controller: _txtPwdController,
),
// const SizedBox(height: 5),
SizedBox(height: 30.h),
RememberPasswordRow(
value: _rememberPassword,
onChanged: (val) {
......@@ -106,7 +136,7 @@ class _LoginViewState extends State<LoginView> {
},
onForgotPassword: _loginController.forgotPwd,
),
const SizedBox(height: 20),
SizedBox(height: 10.h),
BlocConsumer<AuthBloc, AuthState>(
listener: (context, state) {
if (state is AuthFailure) {
......@@ -119,7 +149,6 @@ class _LoginViewState extends State<LoginView> {
textColor: Colors.white,
fontSize: 16.0);
}
},
builder: (context, state) {
return BtnLogin(
......@@ -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> {
changeColor: Color.fromRGBO(34, 197, 94, 1),
progress: powerUsage['progress'] as double,
progressColor: Color.fromRGBO(59, 130, 246, 1),
onTap: () => _controller.navigateToEnergyDetail(),
),
),
SizedBox(width: 16.w),
......@@ -65,8 +66,11 @@ class _ReportMetricsBlockState extends State<ReportMetricsBlock> {
required Color changeColor,
required double progress,
required Color progressColor,
VoidCallback? onTap,
}) {
return Container(
return GestureDetector(
onTap: onTap,
child: Container(
padding: EdgeInsets.all(20.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.r),
......@@ -144,6 +148,7 @@ class _ReportMetricsBlockState extends State<ReportMetricsBlock> {
),
],
),
),
);
}
}
......@@ -24,7 +24,9 @@ class _RoomStatusDistributionState extends State<RoomStatusDistribution> {
final statuses = distributionData['statuses'] as List<Map<String, dynamic>>;
final totalRooms = distributionData['totalRooms'] as int;
return Container(
return GestureDetector(
onTap: () => _controller.navigateToRoomDetail(),
child: Container(
width: double.infinity,
margin: EdgeInsets.symmetric(horizontal: 20.w),
padding: EdgeInsets.all(20.w),
......@@ -127,6 +129,7 @@ class _RoomStatusDistributionState extends State<RoomStatusDistribution> {
}).toList(),
],
),
),
);
}
}
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:smart_hotel_app/routes/app_router.gr.dart';
class ReportIndexController {
final BuildContext context;
......@@ -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:
# To add assets to your application, add an assets section, like this:
assets:
- lib/assets/
- lib/assets/login/
- lib/assets/tab/
# - images/a_dot_ham.jpeg
# 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