Commit f3f8e77a authored by 张宏's avatar 张宏

.

parent d5f69202
## 任务分解及实现明细 ## 任务分解及实现明细
## 要求
1.view页面必须以_view结尾
## 其他 ## 其他
......
...@@ -19,6 +19,7 @@ class AppRouter extends $AppRouter { ...@@ -19,6 +19,7 @@ class AppRouter extends $AppRouter {
AutoRoute(page: ProfileRoute.page), AutoRoute(page: ProfileRoute.page),
], ],
), ),
AutoRoute(page: SearchRoute.page) AutoRoute(page: SearchRoute.page),
AutoRoute(page: AbnormalDetailRoute.page),
]; ];
} }
...@@ -8,63 +8,71 @@ ...@@ -8,63 +8,71 @@
// 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 _i8; import 'package:auto_route/auto_route.dart' as _i9;
import 'package:flutter/material.dart' as _i9; import 'package:flutter/material.dart' as _i10;
import 'package:smart_hotel_app/views/home/index/index_view.dart' as _i2; import 'package:smart_hotel_app/views/home/abnormal/abnormal_detail_view.dart'
import 'package:smart_hotel_app/views/layout/default_view.dart' as _i1; as _i1;
import 'package:smart_hotel_app/views/login/login_view.dart' as _i3; import 'package:smart_hotel_app/views/home/index/index_view.dart' as _i3;
import 'package:smart_hotel_app/views/message/index_view.dart' as _i4; import 'package:smart_hotel_app/views/layout/default_view.dart' as _i2;
import 'package:smart_hotel_app/views/news/index_view.dart' as _i5; import 'package:smart_hotel_app/views/login/login_view.dart' as _i4;
import 'package:smart_hotel_app/views/profile/index_view.dart' as _i6; import 'package:smart_hotel_app/views/message/index_view.dart' as _i5;
import 'package:smart_hotel_app/views/search/index_view.dart' as _i7; import 'package:smart_hotel_app/views/news/index_view.dart' as _i6;
import 'package:smart_hotel_app/views/profile/index_view.dart' as _i7;
abstract class $AppRouter extends _i8.RootStackRouter { import 'package:smart_hotel_app/views/search/index_view.dart' as _i8;
abstract class $AppRouter extends _i9.RootStackRouter {
$AppRouter({super.navigatorKey}); $AppRouter({super.navigatorKey});
@override @override
final Map<String, _i8.PageFactory> pagesMap = { final Map<String, _i9.PageFactory> pagesMap = {
AbnormalDetailRoute.name: (routeData) {
return _i9.AutoRoutePage<dynamic>(
routeData: routeData,
child: const _i1.AbnormalDetailView(),
);
},
DefaultLayoutRoute.name: (routeData) { DefaultLayoutRoute.name: (routeData) {
return _i8.AutoRoutePage<dynamic>( return _i9.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i1.DefaultLayoutView(), child: const _i2.DefaultLayoutView(),
); );
}, },
HomeRoute.name: (routeData) { HomeRoute.name: (routeData) {
return _i8.AutoRoutePage<dynamic>( return _i9.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i2.HomeView(), child: const _i3.HomeView(),
); );
}, },
LoginRoute.name: (routeData) { LoginRoute.name: (routeData) {
return _i8.AutoRoutePage<dynamic>( return _i9.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i3.LoginView(), child: const _i4.LoginView(),
); );
}, },
MessageRoute.name: (routeData) { MessageRoute.name: (routeData) {
return _i8.AutoRoutePage<dynamic>( return _i9.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i4.MessageView(), child: const _i5.MessageView(),
); );
}, },
NewsRoute.name: (routeData) { NewsRoute.name: (routeData) {
return _i8.AutoRoutePage<dynamic>( return _i9.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i5.NewsView(), child: const _i6.NewsView(),
); );
}, },
ProfileRoute.name: (routeData) { ProfileRoute.name: (routeData) {
return _i8.AutoRoutePage<dynamic>( return _i9.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i6.ProfileView(), child: const _i7.ProfileView(),
); );
}, },
SearchRoute.name: (routeData) { SearchRoute.name: (routeData) {
final args = routeData.argsAs<SearchRouteArgs>( final args = routeData.argsAs<SearchRouteArgs>(
orElse: () => const SearchRouteArgs()); orElse: () => const SearchRouteArgs());
return _i8.AutoRoutePage<dynamic>( return _i9.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: _i7.SearchView( child: _i8.SearchView(
key: args.key, key: args.key,
searchKey: args.searchKey, searchKey: args.searchKey,
), ),
...@@ -74,9 +82,23 @@ abstract class $AppRouter extends _i8.RootStackRouter { ...@@ -74,9 +82,23 @@ abstract class $AppRouter extends _i8.RootStackRouter {
} }
/// generated route for /// generated route for
/// [_i1.DefaultLayoutView] /// [_i1.AbnormalDetailView]
class DefaultLayoutRoute extends _i8.PageRouteInfo<void> { class AbnormalDetailRoute extends _i9.PageRouteInfo<void> {
const DefaultLayoutRoute({List<_i8.PageRouteInfo>? children}) const AbnormalDetailRoute({List<_i9.PageRouteInfo>? children})
: super(
AbnormalDetailRoute.name,
initialChildren: children,
);
static const String name = 'AbnormalDetailRoute';
static const _i9.PageInfo<void> page = _i9.PageInfo<void>(name);
}
/// generated route for
/// [_i2.DefaultLayoutView]
class DefaultLayoutRoute extends _i9.PageRouteInfo<void> {
const DefaultLayoutRoute({List<_i9.PageRouteInfo>? children})
: super( : super(
DefaultLayoutRoute.name, DefaultLayoutRoute.name,
initialChildren: children, initialChildren: children,
...@@ -84,13 +106,13 @@ class DefaultLayoutRoute extends _i8.PageRouteInfo<void> { ...@@ -84,13 +106,13 @@ class DefaultLayoutRoute extends _i8.PageRouteInfo<void> {
static const String name = 'DefaultLayoutRoute'; static const String name = 'DefaultLayoutRoute';
static const _i8.PageInfo<void> page = _i8.PageInfo<void>(name); static const _i9.PageInfo<void> page = _i9.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i2.HomeView] /// [_i3.HomeView]
class HomeRoute extends _i8.PageRouteInfo<void> { class HomeRoute extends _i9.PageRouteInfo<void> {
const HomeRoute({List<_i8.PageRouteInfo>? children}) const HomeRoute({List<_i9.PageRouteInfo>? children})
: super( : super(
HomeRoute.name, HomeRoute.name,
initialChildren: children, initialChildren: children,
...@@ -98,13 +120,13 @@ class HomeRoute extends _i8.PageRouteInfo<void> { ...@@ -98,13 +120,13 @@ class HomeRoute extends _i8.PageRouteInfo<void> {
static const String name = 'HomeRoute'; static const String name = 'HomeRoute';
static const _i8.PageInfo<void> page = _i8.PageInfo<void>(name); static const _i9.PageInfo<void> page = _i9.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i3.LoginView] /// [_i4.LoginView]
class LoginRoute extends _i8.PageRouteInfo<void> { class LoginRoute extends _i9.PageRouteInfo<void> {
const LoginRoute({List<_i8.PageRouteInfo>? children}) const LoginRoute({List<_i9.PageRouteInfo>? children})
: super( : super(
LoginRoute.name, LoginRoute.name,
initialChildren: children, initialChildren: children,
...@@ -112,13 +134,13 @@ class LoginRoute extends _i8.PageRouteInfo<void> { ...@@ -112,13 +134,13 @@ class LoginRoute extends _i8.PageRouteInfo<void> {
static const String name = 'LoginRoute'; static const String name = 'LoginRoute';
static const _i8.PageInfo<void> page = _i8.PageInfo<void>(name); static const _i9.PageInfo<void> page = _i9.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i4.MessageView] /// [_i5.MessageView]
class MessageRoute extends _i8.PageRouteInfo<void> { class MessageRoute extends _i9.PageRouteInfo<void> {
const MessageRoute({List<_i8.PageRouteInfo>? children}) const MessageRoute({List<_i9.PageRouteInfo>? children})
: super( : super(
MessageRoute.name, MessageRoute.name,
initialChildren: children, initialChildren: children,
...@@ -126,13 +148,13 @@ class MessageRoute extends _i8.PageRouteInfo<void> { ...@@ -126,13 +148,13 @@ class MessageRoute extends _i8.PageRouteInfo<void> {
static const String name = 'MessageRoute'; static const String name = 'MessageRoute';
static const _i8.PageInfo<void> page = _i8.PageInfo<void>(name); static const _i9.PageInfo<void> page = _i9.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i5.NewsView] /// [_i6.NewsView]
class NewsRoute extends _i8.PageRouteInfo<void> { class NewsRoute extends _i9.PageRouteInfo<void> {
const NewsRoute({List<_i8.PageRouteInfo>? children}) const NewsRoute({List<_i9.PageRouteInfo>? children})
: super( : super(
NewsRoute.name, NewsRoute.name,
initialChildren: children, initialChildren: children,
...@@ -140,13 +162,13 @@ class NewsRoute extends _i8.PageRouteInfo<void> { ...@@ -140,13 +162,13 @@ class NewsRoute extends _i8.PageRouteInfo<void> {
static const String name = 'NewsRoute'; static const String name = 'NewsRoute';
static const _i8.PageInfo<void> page = _i8.PageInfo<void>(name); static const _i9.PageInfo<void> page = _i9.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i6.ProfileView] /// [_i7.ProfileView]
class ProfileRoute extends _i8.PageRouteInfo<void> { class ProfileRoute extends _i9.PageRouteInfo<void> {
const ProfileRoute({List<_i8.PageRouteInfo>? children}) const ProfileRoute({List<_i9.PageRouteInfo>? children})
: super( : super(
ProfileRoute.name, ProfileRoute.name,
initialChildren: children, initialChildren: children,
...@@ -154,16 +176,16 @@ class ProfileRoute extends _i8.PageRouteInfo<void> { ...@@ -154,16 +176,16 @@ class ProfileRoute extends _i8.PageRouteInfo<void> {
static const String name = 'ProfileRoute'; static const String name = 'ProfileRoute';
static const _i8.PageInfo<void> page = _i8.PageInfo<void>(name); static const _i9.PageInfo<void> page = _i9.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i7.SearchView] /// [_i8.SearchView]
class SearchRoute extends _i8.PageRouteInfo<SearchRouteArgs> { class SearchRoute extends _i9.PageRouteInfo<SearchRouteArgs> {
SearchRoute({ SearchRoute({
_i9.Key? key, _i10.Key? key,
String? searchKey, String? searchKey,
List<_i8.PageRouteInfo>? children, List<_i9.PageRouteInfo>? children,
}) : super( }) : super(
SearchRoute.name, SearchRoute.name,
args: SearchRouteArgs( args: SearchRouteArgs(
...@@ -175,8 +197,8 @@ class SearchRoute extends _i8.PageRouteInfo<SearchRouteArgs> { ...@@ -175,8 +197,8 @@ class SearchRoute extends _i8.PageRouteInfo<SearchRouteArgs> {
static const String name = 'SearchRoute'; static const String name = 'SearchRoute';
static const _i8.PageInfo<SearchRouteArgs> page = static const _i9.PageInfo<SearchRouteArgs> page =
_i8.PageInfo<SearchRouteArgs>(name); _i9.PageInfo<SearchRouteArgs>(name);
} }
class SearchRouteArgs { class SearchRouteArgs {
...@@ -185,7 +207,7 @@ class SearchRouteArgs { ...@@ -185,7 +207,7 @@ class SearchRouteArgs {
this.searchKey, this.searchKey,
}); });
final _i9.Key? key; final _i10.Key? key;
final String? searchKey; final String? searchKey;
......
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:smart_hotel_app/views/home/abnormal/child/alarm_info_block.dart';
import 'package:smart_hotel_app/views/home/abnormal/child/temperature_block.dart';
import 'package:smart_hotel_app/views/home/abnormal/child/temperature_char_block.dart';
@RoutePage()
class AbnormalDetailView extends StatefulWidget {
const AbnormalDetailView({super.key});
@override
State<AbnormalDetailView> createState() => _AbnormalDetailViewState();
}
class _AbnormalDetailViewState extends State<AbnormalDetailView> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color.fromRGBO(15, 23, 42, 1),
body: SingleChildScrollView(
child: Column(
children: [
TemperatureBlock(),
TemperatureCharBlock(),
AlarmInfoBlock(),
SizedBox(height: 120.h),
],
),
),
bottomNavigationBar: _buildBottomButtons(),
);
}
Widget _buildBottomButtons() {
return Container(
width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 15.h),
decoration: BoxDecoration(
color: Color.fromRGBO(15, 23, 42, 1),
border: Border(
top: BorderSide(
color: Color.fromRGBO(30, 41, 59, 1),
width: 1.w,
),
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
children: [
Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Color.fromRGBO(246, 158, 11, 1.0),
minimumSize: Size(double.infinity, 55.h),
padding: EdgeInsets.zero,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.r),
),
),
onPressed: () {
print("确认处理");
},
child: Text(
"确认处理",
style: TextStyle(fontSize: 16.sp, color: Colors.white),
),
),
),
SizedBox(width: 12.w),
Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Color.fromRGBO(51, 65, 85, 1),
minimumSize: Size(double.infinity, 55.h),
padding: EdgeInsets.zero,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.r),
),
),
onPressed: () {
print("转派工单");
},
child: Text(
"转派工单",
style: TextStyle(fontSize: 16.sp, color: Colors.white),
),
),
),
],
),
SizedBox(height: 10.h),
Container(
width: double.infinity,
height: 55.h,
decoration: BoxDecoration(
color: Color.fromRGBO(30, 41, 59, 1),
borderRadius: BorderRadius.circular(15.r),
),
child: TextButton(
onPressed: () {
print("查看关联设备");
},
child: Text(
"查看关联设备 →",
style: TextStyle(
fontSize: 16.sp,
color: Colors.grey,
),
),
),
),
],
),
);
}
}
\ No newline at end of file
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class AlarmInfoBlock extends StatelessWidget {
const AlarmInfoBlock({super.key});
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
margin: EdgeInsets.only(top: 10.h, left: 20.w, right: 20.w),
padding: EdgeInsets.all(20.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r),
color: Color.fromRGBO(30, 41, 59, 1),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'告警信息',
style: TextStyle(
fontSize: 18.sp,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 15.h),
_buildInfoRow('触发时间', '2026-05-09 14:23:18'),
SizedBox(height: 12.h),
_buildInfoRow(
'告警级别',
'高警 (Level 3)',
valueColor: Color.fromRGBO(246, 158, 11, 1.0),
),
SizedBox(height: 12.h),
_buildInfoRow('阈值设置', '温度 > 80℃ 触发'),
SizedBox(height: 12.h),
_buildInfoRow('持续时间', '2小时37分钟'),
SizedBox(height: 12.h),
_buildInfoRow('峰值记录', '89.2℃ (15:02)'),
SizedBox(height: 12.h),
_buildInfoRow(
'关联联动',
'自动断电保护 →',
valueColor: Color.fromRGBO(59, 130, 246, 1.0),
),
],
),
);
}
Widget _buildInfoRow(String label, String value, {Color? valueColor}) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
label,
style: TextStyle(
fontSize: 15.sp,
color: Colors.grey,
),
),
Text(
value,
style: TextStyle(
fontSize: 15.sp,
color: valueColor ?? Colors.white,
),
),
],
);
}
}
\ No newline at end of file
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class TemperatureBlock extends StatefulWidget {
const TemperatureBlock({super.key});
@override
State<TemperatureBlock> createState() => _TemperatureBlockState();
}
class _TemperatureBlockState extends State<TemperatureBlock> {
@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),
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,
)),
),
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,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 50.w,
height: 50.h,
decoration: BoxDecoration(
color: Color.fromRGBO(71, 85, 105, 0.3),
borderRadius: BorderRadius.circular(8.r),
),
child: Icon(Icons.thermostat,color: Color.fromRGBO(246, 158, 11, 1),size: 20.sp,),
),
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("置顶",style: TextStyle(fontSize: 15.sp,color: Color.fromRGBO(246, 158, 11, 1.0)),)
],
)
),
// 数据行
Container(
width: double.infinity,
height: 100.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,
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Container(
width: 100.w,
height: 80.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r),
color: Colors.white,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
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),),
],
),
),
Container(
width: 100.w,
height: 80.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r),
color: Colors.white,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
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),),
],
),
),
Container(
width: 100.w,
height: 80.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r),
color: Colors.white,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
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),),
],
),
)
],
),
),
// 操作行
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,
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: [
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,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.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),),
),
],
)
],
),
),
],
),
);
}
}
\ No newline at end of file
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:fl_chart/fl_chart.dart';
class TemperatureCharBlock extends StatelessWidget {
const TemperatureCharBlock({super.key});
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
margin: EdgeInsets.only(top: 10.h, left: 20.w, right: 20.w),
padding: EdgeInsets.all(20.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.r),
color: Color.fromRGBO(30, 41, 59, 1),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'24小时温度趋势',
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
Text(
'5月9日',
style: TextStyle(
fontSize: 14.sp,
color: Colors.grey,
),
),
],
),
SizedBox(height: 20.h),
Container(
height: 200.h,
child: LineChart(
LineChartData(
gridData: FlGridData(show: false),
titlesData: FlTitlesData(
rightTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
topTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
interval: 3,
getTitlesWidget: (value, meta) {
String text = '';
switch (value.toInt()) {
case 0:
text = '00:00';
break;
case 3:
text = '03:00';
break;
case 6:
text = '06:00';
break;
case 9:
text = '09:00';
break;
case 12:
text = '12:00';
break;
case 15:
text = '15:00';
break;
case 18:
text = '18:00';
break;
case 21:
text = '21:00';
break;
case 24:
text = '现在';
break;
}
return Text(
text,
style: TextStyle(
color: Colors.grey,
fontSize: 10.sp,
),
);
},
reservedSize: 30,
),
),
leftTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
),
borderData: FlBorderData(show: false),
minX: 0,
maxX: 24,
minY: 0,
maxY: 100,
lineBarsData: [
LineChartBarData(
spots: [
FlSpot(0, 75),
FlSpot(4, 76),
FlSpot(8, 78),
FlSpot(12, 82),
FlSpot(16, 86),
FlSpot(18, 89),
FlSpot(20, 87),
FlSpot(22, 85),
FlSpot(24, 70),
],
isCurved: true,
color: Color.fromRGBO(246, 158, 11, 1.0),
barWidth: 3,
isStrokeCapRound: true,
dotData: FlDotData(show: false),
belowBarData: BarAreaData(
show: true,
gradient: LinearGradient(
colors: [
Color.fromRGBO(246, 158, 11, 0.5),
Color.fromRGBO(246, 158, 11, 0.1),
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
),
],
),
),
),
],
),
);
}
}
\ No newline at end of file
class HomeAbnormalController {
}
\ No newline at end of file
...@@ -176,24 +176,24 @@ class _TemperatureBlockState extends State<TemperatureBlock> { ...@@ -176,24 +176,24 @@ class _TemperatureBlockState extends State<TemperatureBlock> {
}, },
child: Text("立即处理",style: TextStyle(fontSize: 14.sp,color: Colors.white),), child: Text("立即处理",style: TextStyle(fontSize: 14.sp,color: Colors.white),),
), ),
SizedBox(width: 8.w), // SizedBox(width: 8.w),
ElevatedButton( // ElevatedButton(
style: ElevatedButton.styleFrom( // style: ElevatedButton.styleFrom(
backgroundColor: Color.fromRGBO(51, 65, 85, 1), // backgroundColor: Color.fromRGBO(51, 65, 85, 1),
minimumSize: Size(80.w, 55.h), // minimumSize: Size(80.w, 55.h),
padding: EdgeInsets.zero, // padding: EdgeInsets.zero,
alignment: Alignment.center, // alignment: Alignment.center,
visualDensity: VisualDensity.compact, // visualDensity: VisualDensity.compact,
tapTargetSize: MaterialTapTargetSize.shrinkWrap, // tapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder( // shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.r), // borderRadius: BorderRadius.circular(10.r),
), // ),
), // ),
onPressed: () { // onPressed: () {
print("派工"); // print("派工");
}, // },
child: Text("派工",style: TextStyle(fontSize: 14.sp,color: Colors.white),), // child: Text("派工",style: TextStyle(fontSize: 14.sp,color: Colors.white),),
), // ),
], ],
) )
], ],
......
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 VoltageOperateBlock extends StatefulWidget { class VoltageOperateBlock extends StatefulWidget {
const VoltageOperateBlock({super.key}); const VoltageOperateBlock({super.key});
...@@ -9,6 +10,7 @@ class VoltageOperateBlock extends StatefulWidget { ...@@ -9,6 +10,7 @@ class VoltageOperateBlock extends StatefulWidget {
} }
class _VoltageOperateBlockState extends State<VoltageOperateBlock> { class _VoltageOperateBlockState extends State<VoltageOperateBlock> {
final HomeIndexController _controller = HomeIndexController();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -131,7 +133,7 @@ class _VoltageOperateBlockState extends State<VoltageOperateBlock> { ...@@ -131,7 +133,7 @@ class _VoltageOperateBlockState extends State<VoltageOperateBlock> {
), ),
), ),
onPressed: () { onPressed: () {
print("查看详情"); _controller.handleToAbnormalDetail(context);
}, },
child: Text("查看详情",style: TextStyle(fontSize: 14.sp,color: Colors.white),), child: Text("查看详情",style: TextStyle(fontSize: 14.sp,color: Colors.white),),
), ),
......
// 处理index相关逻辑 import 'package:auto_route/auto_route.dart';
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 HomeIndexController { class HomeIndexController {
// final AppRouter _appRouter = AppRouter();
HomeIndexController();
void handleToAbnormalDetail(BuildContext context) {
context.router.push(const AbnormalDetailRoute());
}
} }
\ No newline at end of file
...@@ -9,6 +9,7 @@ import 'package:smart_hotel_app/views/home/index/child/task_head_block.dart'; ...@@ -9,6 +9,7 @@ import 'package:smart_hotel_app/views/home/index/child/task_head_block.dart';
import 'package:smart_hotel_app/views/home/index/child/task_total_block.dart'; import 'package:smart_hotel_app/views/home/index/child/task_total_block.dart';
import 'package:smart_hotel_app/views/home/index/child/temperature_block.dart'; import 'package:smart_hotel_app/views/home/index/child/temperature_block.dart';
import 'package:smart_hotel_app/views/home/index/child/voltage_operate_block.dart'; import 'package:smart_hotel_app/views/home/index/child/voltage_operate_block.dart';
import 'package:smart_hotel_app/views/home/index/controller.dart';
@RoutePage() @RoutePage()
class HomeView extends StatefulWidget { class HomeView extends StatefulWidget {
...@@ -19,6 +20,14 @@ class HomeView extends StatefulWidget { ...@@ -19,6 +20,14 @@ class HomeView extends StatefulWidget {
} }
class _HomeViewState extends State<HomeView> { class _HomeViewState extends State<HomeView> {
late final HomeIndexController _controller;
@override
void initState() {
super.initState();
_controller = HomeIndexController();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return LayoutBuilder( return LayoutBuilder(
......
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