Commit 95546f15 authored by 张宏's avatar 张宏

设备拓扑及相关样式调整

parent 3c72b94e
...@@ -2,6 +2,7 @@ import 'package:auto_route/auto_route.dart'; ...@@ -2,6 +2,7 @@ import 'package:auto_route/auto_route.dart';
import 'package:smart_hotel_app/routes/app_router.gr.dart'; import 'package:smart_hotel_app/routes/app_router.gr.dart';
import 'package:smart_hotel_app/views/report/rule/rule_management_view.dart'; import 'package:smart_hotel_app/views/report/rule/rule_management_view.dart';
import 'package:smart_hotel_app/views/report/device/device_list_view.dart'; import 'package:smart_hotel_app/views/report/device/device_list_view.dart';
import 'package:smart_hotel_app/views/home/inspection_topology/inspection_topology_view.dart';
@AutoRouterConfig(replaceInRouteName: 'View,Route') @AutoRouterConfig(replaceInRouteName: 'View,Route')
class AppRouter extends $AppRouter { class AppRouter extends $AppRouter {
...@@ -34,5 +35,6 @@ class AppRouter extends $AppRouter { ...@@ -34,5 +35,6 @@ class AppRouter extends $AppRouter {
AutoRoute(page: AbnormalListRoute.page), AutoRoute(page: AbnormalListRoute.page),
AutoRoute(page: ReportRuleManagementRoute.page), AutoRoute(page: ReportRuleManagementRoute.page),
AutoRoute(page: ReportDeviceListRoute.page), AutoRoute(page: ReportDeviceListRoute.page),
AutoRoute(page: InspectionTopologyRoute.page),
]; ];
} }
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
// coverage:ignore-file // coverage:ignore-file
// ignore_for_file: no_leading_underscores_for_library_prefixes // ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:auto_route/auto_route.dart' as _i20; import 'package:auto_route/auto_route.dart' as _i21;
import 'package:flutter/material.dart' as _i21; import 'package:flutter/material.dart' as _i22;
import 'package:smart_hotel_app/views/home/abnormal/abnormal_detail_view.dart' import 'package:smart_hotel_app/views/home/abnormal/abnormal_detail_view.dart'
as _i1; as _i1;
import 'package:smart_hotel_app/views/home/abnormal_list/index_view.dart' import 'package:smart_hotel_app/views/home/abnormal_list/index_view.dart'
...@@ -23,62 +23,64 @@ import 'package:smart_hotel_app/views/home/inspection_device/inspection_device_v ...@@ -23,62 +23,64 @@ import 'package:smart_hotel_app/views/home/inspection_device/inspection_device_v
as _i7; as _i7;
import 'package:smart_hotel_app/views/home/inspection_history/inspection_history_view.dart' import 'package:smart_hotel_app/views/home/inspection_history/inspection_history_view.dart'
as _i8; as _i8;
import 'package:smart_hotel_app/views/home/inspection_topology/inspection_topology_view.dart'
as _i9;
import 'package:smart_hotel_app/views/layout/default_view.dart' as _i3; import 'package:smart_hotel_app/views/layout/default_view.dart' as _i3;
import 'package:smart_hotel_app/views/login/login_view.dart' as _i9; import 'package:smart_hotel_app/views/login/login_view.dart' as _i10;
import 'package:smart_hotel_app/views/profile/index/index_view.dart' as _i10; import 'package:smart_hotel_app/views/profile/index/index_view.dart' as _i11;
import 'package:smart_hotel_app/views/report/device/device_list_view.dart' import 'package:smart_hotel_app/views/report/device/device_list_view.dart'
as _i11;
import 'package:smart_hotel_app/views/report/energy/energy_detail_view.dart'
as _i12; as _i12;
import 'package:smart_hotel_app/views/report/index/index_view.dart' as _i13; import 'package:smart_hotel_app/views/report/energy/energy_detail_view.dart'
as _i13;
import 'package:smart_hotel_app/views/report/index/index_view.dart' as _i14;
import 'package:smart_hotel_app/views/report/room/room_detail_view.dart' import 'package:smart_hotel_app/views/report/room/room_detail_view.dart'
as _i14;
import 'package:smart_hotel_app/views/report/rule/rule_management_view.dart'
as _i15; as _i15;
import 'package:smart_hotel_app/views/search/index_view.dart' as _i16; import 'package:smart_hotel_app/views/report/rule/rule_management_view.dart'
as _i16;
import 'package:smart_hotel_app/views/search/index_view.dart' as _i17;
import 'package:smart_hotel_app/views/service/device/device_detail_view.dart' import 'package:smart_hotel_app/views/service/device/device_detail_view.dart'
as _i17; as _i18;
import 'package:smart_hotel_app/views/service/index/index_view.dart' as _i18; import 'package:smart_hotel_app/views/service/index/index_view.dart' as _i19;
import 'package:smart_hotel_app/views/service/room/room_detail_view.dart' import 'package:smart_hotel_app/views/service/room/room_detail_view.dart'
as _i19; as _i20;
abstract class $AppRouter extends _i20.RootStackRouter { abstract class $AppRouter extends _i21.RootStackRouter {
$AppRouter({super.navigatorKey}); $AppRouter({super.navigatorKey});
@override @override
final Map<String, _i20.PageFactory> pagesMap = { final Map<String, _i21.PageFactory> pagesMap = {
AbnormalDetailRoute.name: (routeData) { AbnormalDetailRoute.name: (routeData) {
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i1.AbnormalDetailView(), child: const _i1.AbnormalDetailView(),
); );
}, },
AbnormalListRoute.name: (routeData) { AbnormalListRoute.name: (routeData) {
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i2.AbnormalListView(), child: const _i2.AbnormalListView(),
); );
}, },
DefaultLayoutRoute.name: (routeData) { DefaultLayoutRoute.name: (routeData) {
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i3.DefaultLayoutView(), child: const _i3.DefaultLayoutView(),
); );
}, },
DeviceDetailRoute.name: (routeData) { DeviceDetailRoute.name: (routeData) {
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i4.DeviceDetailView(), child: const _i4.DeviceDetailView(),
); );
}, },
HomeRoute.name: (routeData) { HomeRoute.name: (routeData) {
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i5.HomeView(), child: const _i5.HomeView(),
); );
}, },
InspectionDetailRoute.name: (routeData) { InspectionDetailRoute.name: (routeData) {
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i6.InspectionDetailView(), child: const _i6.InspectionDetailView(),
); );
...@@ -88,7 +90,7 @@ abstract class $AppRouter extends _i20.RootStackRouter { ...@@ -88,7 +90,7 @@ abstract class $AppRouter extends _i20.RootStackRouter {
final args = routeData.argsAs<InspectionDeviceRouteArgs>( final args = routeData.argsAs<InspectionDeviceRouteArgs>(
orElse: () => InspectionDeviceRouteArgs( orElse: () => InspectionDeviceRouteArgs(
deviceId: pathParams.getString('deviceId'))); deviceId: pathParams.getString('deviceId')));
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: _i7.InspectionDeviceView( child: _i7.InspectionDeviceView(
key: args.key, key: args.key,
...@@ -101,7 +103,7 @@ abstract class $AppRouter extends _i20.RootStackRouter { ...@@ -101,7 +103,7 @@ abstract class $AppRouter extends _i20.RootStackRouter {
final args = routeData.argsAs<InspectionHistoryRouteArgs>( final args = routeData.argsAs<InspectionHistoryRouteArgs>(
orElse: () => InspectionHistoryRouteArgs( orElse: () => InspectionHistoryRouteArgs(
deviceId: pathParams.getString('deviceId'))); deviceId: pathParams.getString('deviceId')));
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: _i8.InspectionHistoryView( child: _i8.InspectionHistoryView(
key: args.key, key: args.key,
...@@ -109,79 +111,85 @@ abstract class $AppRouter extends _i20.RootStackRouter { ...@@ -109,79 +111,85 @@ abstract class $AppRouter extends _i20.RootStackRouter {
), ),
); );
}, },
InspectionTopologyRoute.name: (routeData) {
return _i21.AutoRoutePage<dynamic>(
routeData: routeData,
child: const _i9.InspectionTopologyView(),
);
},
LoginRoute.name: (routeData) { LoginRoute.name: (routeData) {
final args = routeData.argsAs<LoginRouteArgs>( final args = routeData.argsAs<LoginRouteArgs>(
orElse: () => const LoginRouteArgs()); orElse: () => const LoginRouteArgs());
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: _i9.LoginView(key: args.key), child: _i10.LoginView(key: args.key),
); );
}, },
ProfileRoute.name: (routeData) { ProfileRoute.name: (routeData) {
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i10.ProfileView(), child: const _i11.ProfileView(),
); );
}, },
ReportDeviceListRoute.name: (routeData) { ReportDeviceListRoute.name: (routeData) {
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i11.ReportDeviceListView(), child: const _i12.ReportDeviceListView(),
); );
}, },
ReportEnergyDetailRoute.name: (routeData) { ReportEnergyDetailRoute.name: (routeData) {
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i12.ReportEnergyDetailView(), child: const _i13.ReportEnergyDetailView(),
); );
}, },
ReportIndexRoute.name: (routeData) { ReportIndexRoute.name: (routeData) {
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i13.ReportIndexView(), child: const _i14.ReportIndexView(),
); );
}, },
ReportRoomDetailRoute.name: (routeData) { ReportRoomDetailRoute.name: (routeData) {
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i14.ReportRoomDetailView(), child: const _i15.ReportRoomDetailView(),
); );
}, },
ReportRuleManagementRoute.name: (routeData) { ReportRuleManagementRoute.name: (routeData) {
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i15.ReportRuleManagementView(), child: const _i16.ReportRuleManagementView(),
); );
}, },
SearchRoute.name: (routeData) { SearchRoute.name: (routeData) {
final args = routeData.argsAs<SearchRouteArgs>( final args = routeData.argsAs<SearchRouteArgs>(
orElse: () => const SearchRouteArgs()); orElse: () => const SearchRouteArgs());
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: _i16.SearchView( child: _i17.SearchView(
key: args.key, key: args.key,
searchKey: args.searchKey, searchKey: args.searchKey,
), ),
); );
}, },
ServiceDeviceDetailRoute.name: (routeData) { ServiceDeviceDetailRoute.name: (routeData) {
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i17.ServiceDeviceDetailView(), child: const _i18.ServiceDeviceDetailView(),
); );
}, },
ServiceIndexRoute.name: (routeData) { ServiceIndexRoute.name: (routeData) {
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: const _i18.ServiceIndexView(), child: const _i19.ServiceIndexView(),
); );
}, },
ServiceRoomDetailRoute.name: (routeData) { ServiceRoomDetailRoute.name: (routeData) {
final args = routeData.argsAs<ServiceRoomDetailRouteArgs>( final args = routeData.argsAs<ServiceRoomDetailRouteArgs>(
orElse: () => const ServiceRoomDetailRouteArgs()); orElse: () => const ServiceRoomDetailRouteArgs());
return _i20.AutoRoutePage<dynamic>( return _i21.AutoRoutePage<dynamic>(
routeData: routeData, routeData: routeData,
child: _i19.ServiceRoomDetailView( child: _i20.ServiceRoomDetailView(
key: args.key, key: args.key,
roomNumber: args.roomNumber, roomNumber: args.roomNumber,
), ),
...@@ -192,8 +200,8 @@ abstract class $AppRouter extends _i20.RootStackRouter { ...@@ -192,8 +200,8 @@ abstract class $AppRouter extends _i20.RootStackRouter {
/// generated route for /// generated route for
/// [_i1.AbnormalDetailView] /// [_i1.AbnormalDetailView]
class AbnormalDetailRoute extends _i20.PageRouteInfo<void> { class AbnormalDetailRoute extends _i21.PageRouteInfo<void> {
const AbnormalDetailRoute({List<_i20.PageRouteInfo>? children}) const AbnormalDetailRoute({List<_i21.PageRouteInfo>? children})
: super( : super(
AbnormalDetailRoute.name, AbnormalDetailRoute.name,
initialChildren: children, initialChildren: children,
...@@ -201,13 +209,13 @@ class AbnormalDetailRoute extends _i20.PageRouteInfo<void> { ...@@ -201,13 +209,13 @@ class AbnormalDetailRoute extends _i20.PageRouteInfo<void> {
static const String name = 'AbnormalDetailRoute'; static const String name = 'AbnormalDetailRoute';
static const _i20.PageInfo<void> page = _i20.PageInfo<void>(name); static const _i21.PageInfo<void> page = _i21.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i2.AbnormalListView] /// [_i2.AbnormalListView]
class AbnormalListRoute extends _i20.PageRouteInfo<void> { class AbnormalListRoute extends _i21.PageRouteInfo<void> {
const AbnormalListRoute({List<_i20.PageRouteInfo>? children}) const AbnormalListRoute({List<_i21.PageRouteInfo>? children})
: super( : super(
AbnormalListRoute.name, AbnormalListRoute.name,
initialChildren: children, initialChildren: children,
...@@ -215,13 +223,13 @@ class AbnormalListRoute extends _i20.PageRouteInfo<void> { ...@@ -215,13 +223,13 @@ class AbnormalListRoute extends _i20.PageRouteInfo<void> {
static const String name = 'AbnormalListRoute'; static const String name = 'AbnormalListRoute';
static const _i20.PageInfo<void> page = _i20.PageInfo<void>(name); static const _i21.PageInfo<void> page = _i21.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i3.DefaultLayoutView] /// [_i3.DefaultLayoutView]
class DefaultLayoutRoute extends _i20.PageRouteInfo<void> { class DefaultLayoutRoute extends _i21.PageRouteInfo<void> {
const DefaultLayoutRoute({List<_i20.PageRouteInfo>? children}) const DefaultLayoutRoute({List<_i21.PageRouteInfo>? children})
: super( : super(
DefaultLayoutRoute.name, DefaultLayoutRoute.name,
initialChildren: children, initialChildren: children,
...@@ -229,13 +237,13 @@ class DefaultLayoutRoute extends _i20.PageRouteInfo<void> { ...@@ -229,13 +237,13 @@ class DefaultLayoutRoute extends _i20.PageRouteInfo<void> {
static const String name = 'DefaultLayoutRoute'; static const String name = 'DefaultLayoutRoute';
static const _i20.PageInfo<void> page = _i20.PageInfo<void>(name); static const _i21.PageInfo<void> page = _i21.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i4.DeviceDetailView] /// [_i4.DeviceDetailView]
class DeviceDetailRoute extends _i20.PageRouteInfo<void> { class DeviceDetailRoute extends _i21.PageRouteInfo<void> {
const DeviceDetailRoute({List<_i20.PageRouteInfo>? children}) const DeviceDetailRoute({List<_i21.PageRouteInfo>? children})
: super( : super(
DeviceDetailRoute.name, DeviceDetailRoute.name,
initialChildren: children, initialChildren: children,
...@@ -243,13 +251,13 @@ class DeviceDetailRoute extends _i20.PageRouteInfo<void> { ...@@ -243,13 +251,13 @@ class DeviceDetailRoute extends _i20.PageRouteInfo<void> {
static const String name = 'DeviceDetailRoute'; static const String name = 'DeviceDetailRoute';
static const _i20.PageInfo<void> page = _i20.PageInfo<void>(name); static const _i21.PageInfo<void> page = _i21.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i5.HomeView] /// [_i5.HomeView]
class HomeRoute extends _i20.PageRouteInfo<void> { class HomeRoute extends _i21.PageRouteInfo<void> {
const HomeRoute({List<_i20.PageRouteInfo>? children}) const HomeRoute({List<_i21.PageRouteInfo>? children})
: super( : super(
HomeRoute.name, HomeRoute.name,
initialChildren: children, initialChildren: children,
...@@ -257,13 +265,13 @@ class HomeRoute extends _i20.PageRouteInfo<void> { ...@@ -257,13 +265,13 @@ class HomeRoute extends _i20.PageRouteInfo<void> {
static const String name = 'HomeRoute'; static const String name = 'HomeRoute';
static const _i20.PageInfo<void> page = _i20.PageInfo<void>(name); static const _i21.PageInfo<void> page = _i21.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i6.InspectionDetailView] /// [_i6.InspectionDetailView]
class InspectionDetailRoute extends _i20.PageRouteInfo<void> { class InspectionDetailRoute extends _i21.PageRouteInfo<void> {
const InspectionDetailRoute({List<_i20.PageRouteInfo>? children}) const InspectionDetailRoute({List<_i21.PageRouteInfo>? children})
: super( : super(
InspectionDetailRoute.name, InspectionDetailRoute.name,
initialChildren: children, initialChildren: children,
...@@ -271,17 +279,17 @@ class InspectionDetailRoute extends _i20.PageRouteInfo<void> { ...@@ -271,17 +279,17 @@ class InspectionDetailRoute extends _i20.PageRouteInfo<void> {
static const String name = 'InspectionDetailRoute'; static const String name = 'InspectionDetailRoute';
static const _i20.PageInfo<void> page = _i20.PageInfo<void>(name); static const _i21.PageInfo<void> page = _i21.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i7.InspectionDeviceView] /// [_i7.InspectionDeviceView]
class InspectionDeviceRoute class InspectionDeviceRoute
extends _i20.PageRouteInfo<InspectionDeviceRouteArgs> { extends _i21.PageRouteInfo<InspectionDeviceRouteArgs> {
InspectionDeviceRoute({ InspectionDeviceRoute({
_i21.Key? key, _i22.Key? key,
required String deviceId, required String deviceId,
List<_i20.PageRouteInfo>? children, List<_i21.PageRouteInfo>? children,
}) : super( }) : super(
InspectionDeviceRoute.name, InspectionDeviceRoute.name,
args: InspectionDeviceRouteArgs( args: InspectionDeviceRouteArgs(
...@@ -294,8 +302,8 @@ class InspectionDeviceRoute ...@@ -294,8 +302,8 @@ class InspectionDeviceRoute
static const String name = 'InspectionDeviceRoute'; static const String name = 'InspectionDeviceRoute';
static const _i20.PageInfo<InspectionDeviceRouteArgs> page = static const _i21.PageInfo<InspectionDeviceRouteArgs> page =
_i20.PageInfo<InspectionDeviceRouteArgs>(name); _i21.PageInfo<InspectionDeviceRouteArgs>(name);
} }
class InspectionDeviceRouteArgs { class InspectionDeviceRouteArgs {
...@@ -304,7 +312,7 @@ class InspectionDeviceRouteArgs { ...@@ -304,7 +312,7 @@ class InspectionDeviceRouteArgs {
required this.deviceId, required this.deviceId,
}); });
final _i21.Key? key; final _i22.Key? key;
final String deviceId; final String deviceId;
...@@ -317,11 +325,11 @@ class InspectionDeviceRouteArgs { ...@@ -317,11 +325,11 @@ class InspectionDeviceRouteArgs {
/// generated route for /// generated route for
/// [_i8.InspectionHistoryView] /// [_i8.InspectionHistoryView]
class InspectionHistoryRoute class InspectionHistoryRoute
extends _i20.PageRouteInfo<InspectionHistoryRouteArgs> { extends _i21.PageRouteInfo<InspectionHistoryRouteArgs> {
InspectionHistoryRoute({ InspectionHistoryRoute({
_i21.Key? key, _i22.Key? key,
required String deviceId, required String deviceId,
List<_i20.PageRouteInfo>? children, List<_i21.PageRouteInfo>? children,
}) : super( }) : super(
InspectionHistoryRoute.name, InspectionHistoryRoute.name,
args: InspectionHistoryRouteArgs( args: InspectionHistoryRouteArgs(
...@@ -334,8 +342,8 @@ class InspectionHistoryRoute ...@@ -334,8 +342,8 @@ class InspectionHistoryRoute
static const String name = 'InspectionHistoryRoute'; static const String name = 'InspectionHistoryRoute';
static const _i20.PageInfo<InspectionHistoryRouteArgs> page = static const _i21.PageInfo<InspectionHistoryRouteArgs> page =
_i20.PageInfo<InspectionHistoryRouteArgs>(name); _i21.PageInfo<InspectionHistoryRouteArgs>(name);
} }
class InspectionHistoryRouteArgs { class InspectionHistoryRouteArgs {
...@@ -344,7 +352,7 @@ class InspectionHistoryRouteArgs { ...@@ -344,7 +352,7 @@ class InspectionHistoryRouteArgs {
required this.deviceId, required this.deviceId,
}); });
final _i21.Key? key; final _i22.Key? key;
final String deviceId; final String deviceId;
...@@ -355,11 +363,25 @@ class InspectionHistoryRouteArgs { ...@@ -355,11 +363,25 @@ class InspectionHistoryRouteArgs {
} }
/// generated route for /// generated route for
/// [_i9.LoginView] /// [_i9.InspectionTopologyView]
class LoginRoute extends _i20.PageRouteInfo<LoginRouteArgs> { class InspectionTopologyRoute extends _i21.PageRouteInfo<void> {
const InspectionTopologyRoute({List<_i21.PageRouteInfo>? children})
: super(
InspectionTopologyRoute.name,
initialChildren: children,
);
static const String name = 'InspectionTopologyRoute';
static const _i21.PageInfo<void> page = _i21.PageInfo<void>(name);
}
/// generated route for
/// [_i10.LoginView]
class LoginRoute extends _i21.PageRouteInfo<LoginRouteArgs> {
LoginRoute({ LoginRoute({
_i21.Key? key, _i22.Key? key,
List<_i20.PageRouteInfo>? children, List<_i21.PageRouteInfo>? children,
}) : super( }) : super(
LoginRoute.name, LoginRoute.name,
args: LoginRouteArgs(key: key), args: LoginRouteArgs(key: key),
...@@ -368,14 +390,14 @@ class LoginRoute extends _i20.PageRouteInfo<LoginRouteArgs> { ...@@ -368,14 +390,14 @@ class LoginRoute extends _i20.PageRouteInfo<LoginRouteArgs> {
static const String name = 'LoginRoute'; static const String name = 'LoginRoute';
static const _i20.PageInfo<LoginRouteArgs> page = static const _i21.PageInfo<LoginRouteArgs> page =
_i20.PageInfo<LoginRouteArgs>(name); _i21.PageInfo<LoginRouteArgs>(name);
} }
class LoginRouteArgs { class LoginRouteArgs {
const LoginRouteArgs({this.key}); const LoginRouteArgs({this.key});
final _i21.Key? key; final _i22.Key? key;
@override @override
String toString() { String toString() {
...@@ -384,9 +406,9 @@ class LoginRouteArgs { ...@@ -384,9 +406,9 @@ class LoginRouteArgs {
} }
/// generated route for /// generated route for
/// [_i10.ProfileView] /// [_i11.ProfileView]
class ProfileRoute extends _i20.PageRouteInfo<void> { class ProfileRoute extends _i21.PageRouteInfo<void> {
const ProfileRoute({List<_i20.PageRouteInfo>? children}) const ProfileRoute({List<_i21.PageRouteInfo>? children})
: super( : super(
ProfileRoute.name, ProfileRoute.name,
initialChildren: children, initialChildren: children,
...@@ -394,13 +416,13 @@ class ProfileRoute extends _i20.PageRouteInfo<void> { ...@@ -394,13 +416,13 @@ class ProfileRoute extends _i20.PageRouteInfo<void> {
static const String name = 'ProfileRoute'; static const String name = 'ProfileRoute';
static const _i20.PageInfo<void> page = _i20.PageInfo<void>(name); static const _i21.PageInfo<void> page = _i21.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i11.ReportDeviceListView] /// [_i12.ReportDeviceListView]
class ReportDeviceListRoute extends _i20.PageRouteInfo<void> { class ReportDeviceListRoute extends _i21.PageRouteInfo<void> {
const ReportDeviceListRoute({List<_i20.PageRouteInfo>? children}) const ReportDeviceListRoute({List<_i21.PageRouteInfo>? children})
: super( : super(
ReportDeviceListRoute.name, ReportDeviceListRoute.name,
initialChildren: children, initialChildren: children,
...@@ -408,13 +430,13 @@ class ReportDeviceListRoute extends _i20.PageRouteInfo<void> { ...@@ -408,13 +430,13 @@ class ReportDeviceListRoute extends _i20.PageRouteInfo<void> {
static const String name = 'ReportDeviceListRoute'; static const String name = 'ReportDeviceListRoute';
static const _i20.PageInfo<void> page = _i20.PageInfo<void>(name); static const _i21.PageInfo<void> page = _i21.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i12.ReportEnergyDetailView] /// [_i13.ReportEnergyDetailView]
class ReportEnergyDetailRoute extends _i20.PageRouteInfo<void> { class ReportEnergyDetailRoute extends _i21.PageRouteInfo<void> {
const ReportEnergyDetailRoute({List<_i20.PageRouteInfo>? children}) const ReportEnergyDetailRoute({List<_i21.PageRouteInfo>? children})
: super( : super(
ReportEnergyDetailRoute.name, ReportEnergyDetailRoute.name,
initialChildren: children, initialChildren: children,
...@@ -422,13 +444,13 @@ class ReportEnergyDetailRoute extends _i20.PageRouteInfo<void> { ...@@ -422,13 +444,13 @@ class ReportEnergyDetailRoute extends _i20.PageRouteInfo<void> {
static const String name = 'ReportEnergyDetailRoute'; static const String name = 'ReportEnergyDetailRoute';
static const _i20.PageInfo<void> page = _i20.PageInfo<void>(name); static const _i21.PageInfo<void> page = _i21.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i13.ReportIndexView] /// [_i14.ReportIndexView]
class ReportIndexRoute extends _i20.PageRouteInfo<void> { class ReportIndexRoute extends _i21.PageRouteInfo<void> {
const ReportIndexRoute({List<_i20.PageRouteInfo>? children}) const ReportIndexRoute({List<_i21.PageRouteInfo>? children})
: super( : super(
ReportIndexRoute.name, ReportIndexRoute.name,
initialChildren: children, initialChildren: children,
...@@ -436,13 +458,13 @@ class ReportIndexRoute extends _i20.PageRouteInfo<void> { ...@@ -436,13 +458,13 @@ class ReportIndexRoute extends _i20.PageRouteInfo<void> {
static const String name = 'ReportIndexRoute'; static const String name = 'ReportIndexRoute';
static const _i20.PageInfo<void> page = _i20.PageInfo<void>(name); static const _i21.PageInfo<void> page = _i21.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i14.ReportRoomDetailView] /// [_i15.ReportRoomDetailView]
class ReportRoomDetailRoute extends _i20.PageRouteInfo<void> { class ReportRoomDetailRoute extends _i21.PageRouteInfo<void> {
const ReportRoomDetailRoute({List<_i20.PageRouteInfo>? children}) const ReportRoomDetailRoute({List<_i21.PageRouteInfo>? children})
: super( : super(
ReportRoomDetailRoute.name, ReportRoomDetailRoute.name,
initialChildren: children, initialChildren: children,
...@@ -450,13 +472,13 @@ class ReportRoomDetailRoute extends _i20.PageRouteInfo<void> { ...@@ -450,13 +472,13 @@ class ReportRoomDetailRoute extends _i20.PageRouteInfo<void> {
static const String name = 'ReportRoomDetailRoute'; static const String name = 'ReportRoomDetailRoute';
static const _i20.PageInfo<void> page = _i20.PageInfo<void>(name); static const _i21.PageInfo<void> page = _i21.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i15.ReportRuleManagementView] /// [_i16.ReportRuleManagementView]
class ReportRuleManagementRoute extends _i20.PageRouteInfo<void> { class ReportRuleManagementRoute extends _i21.PageRouteInfo<void> {
const ReportRuleManagementRoute({List<_i20.PageRouteInfo>? children}) const ReportRuleManagementRoute({List<_i21.PageRouteInfo>? children})
: super( : super(
ReportRuleManagementRoute.name, ReportRuleManagementRoute.name,
initialChildren: children, initialChildren: children,
...@@ -464,16 +486,16 @@ class ReportRuleManagementRoute extends _i20.PageRouteInfo<void> { ...@@ -464,16 +486,16 @@ class ReportRuleManagementRoute extends _i20.PageRouteInfo<void> {
static const String name = 'ReportRuleManagementRoute'; static const String name = 'ReportRuleManagementRoute';
static const _i20.PageInfo<void> page = _i20.PageInfo<void>(name); static const _i21.PageInfo<void> page = _i21.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i16.SearchView] /// [_i17.SearchView]
class SearchRoute extends _i20.PageRouteInfo<SearchRouteArgs> { class SearchRoute extends _i21.PageRouteInfo<SearchRouteArgs> {
SearchRoute({ SearchRoute({
_i21.Key? key, _i22.Key? key,
String? searchKey, String? searchKey,
List<_i20.PageRouteInfo>? children, List<_i21.PageRouteInfo>? children,
}) : super( }) : super(
SearchRoute.name, SearchRoute.name,
args: SearchRouteArgs( args: SearchRouteArgs(
...@@ -485,8 +507,8 @@ class SearchRoute extends _i20.PageRouteInfo<SearchRouteArgs> { ...@@ -485,8 +507,8 @@ class SearchRoute extends _i20.PageRouteInfo<SearchRouteArgs> {
static const String name = 'SearchRoute'; static const String name = 'SearchRoute';
static const _i20.PageInfo<SearchRouteArgs> page = static const _i21.PageInfo<SearchRouteArgs> page =
_i20.PageInfo<SearchRouteArgs>(name); _i21.PageInfo<SearchRouteArgs>(name);
} }
class SearchRouteArgs { class SearchRouteArgs {
...@@ -495,7 +517,7 @@ class SearchRouteArgs { ...@@ -495,7 +517,7 @@ class SearchRouteArgs {
this.searchKey, this.searchKey,
}); });
final _i21.Key? key; final _i22.Key? key;
final String? searchKey; final String? searchKey;
...@@ -506,9 +528,9 @@ class SearchRouteArgs { ...@@ -506,9 +528,9 @@ class SearchRouteArgs {
} }
/// generated route for /// generated route for
/// [_i17.ServiceDeviceDetailView] /// [_i18.ServiceDeviceDetailView]
class ServiceDeviceDetailRoute extends _i20.PageRouteInfo<void> { class ServiceDeviceDetailRoute extends _i21.PageRouteInfo<void> {
const ServiceDeviceDetailRoute({List<_i20.PageRouteInfo>? children}) const ServiceDeviceDetailRoute({List<_i21.PageRouteInfo>? children})
: super( : super(
ServiceDeviceDetailRoute.name, ServiceDeviceDetailRoute.name,
initialChildren: children, initialChildren: children,
...@@ -516,13 +538,13 @@ class ServiceDeviceDetailRoute extends _i20.PageRouteInfo<void> { ...@@ -516,13 +538,13 @@ class ServiceDeviceDetailRoute extends _i20.PageRouteInfo<void> {
static const String name = 'ServiceDeviceDetailRoute'; static const String name = 'ServiceDeviceDetailRoute';
static const _i20.PageInfo<void> page = _i20.PageInfo<void>(name); static const _i21.PageInfo<void> page = _i21.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i18.ServiceIndexView] /// [_i19.ServiceIndexView]
class ServiceIndexRoute extends _i20.PageRouteInfo<void> { class ServiceIndexRoute extends _i21.PageRouteInfo<void> {
const ServiceIndexRoute({List<_i20.PageRouteInfo>? children}) const ServiceIndexRoute({List<_i21.PageRouteInfo>? children})
: super( : super(
ServiceIndexRoute.name, ServiceIndexRoute.name,
initialChildren: children, initialChildren: children,
...@@ -530,17 +552,17 @@ class ServiceIndexRoute extends _i20.PageRouteInfo<void> { ...@@ -530,17 +552,17 @@ class ServiceIndexRoute extends _i20.PageRouteInfo<void> {
static const String name = 'ServiceIndexRoute'; static const String name = 'ServiceIndexRoute';
static const _i20.PageInfo<void> page = _i20.PageInfo<void>(name); static const _i21.PageInfo<void> page = _i21.PageInfo<void>(name);
} }
/// generated route for /// generated route for
/// [_i19.ServiceRoomDetailView] /// [_i20.ServiceRoomDetailView]
class ServiceRoomDetailRoute class ServiceRoomDetailRoute
extends _i20.PageRouteInfo<ServiceRoomDetailRouteArgs> { extends _i21.PageRouteInfo<ServiceRoomDetailRouteArgs> {
ServiceRoomDetailRoute({ ServiceRoomDetailRoute({
_i21.Key? key, _i22.Key? key,
String? roomNumber, String? roomNumber,
List<_i20.PageRouteInfo>? children, List<_i21.PageRouteInfo>? children,
}) : super( }) : super(
ServiceRoomDetailRoute.name, ServiceRoomDetailRoute.name,
args: ServiceRoomDetailRouteArgs( args: ServiceRoomDetailRouteArgs(
...@@ -552,8 +574,8 @@ class ServiceRoomDetailRoute ...@@ -552,8 +574,8 @@ class ServiceRoomDetailRoute
static const String name = 'ServiceRoomDetailRoute'; static const String name = 'ServiceRoomDetailRoute';
static const _i20.PageInfo<ServiceRoomDetailRouteArgs> page = static const _i21.PageInfo<ServiceRoomDetailRouteArgs> page =
_i20.PageInfo<ServiceRoomDetailRouteArgs>(name); _i21.PageInfo<ServiceRoomDetailRouteArgs>(name);
} }
class ServiceRoomDetailRouteArgs { class ServiceRoomDetailRouteArgs {
...@@ -562,7 +584,7 @@ class ServiceRoomDetailRouteArgs { ...@@ -562,7 +584,7 @@ class ServiceRoomDetailRouteArgs {
this.roomNumber, this.roomNumber,
}); });
final _i21.Key? key; final _i22.Key? key;
final String? roomNumber; final String? roomNumber;
......
...@@ -2,6 +2,7 @@ import 'package:auto_route/auto_route.dart'; ...@@ -2,6 +2,7 @@ import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:smart_hotel_app/routes/app_router.gr.dart';
import 'cubit/inspection_device_cubit.dart'; import 'cubit/inspection_device_cubit.dart';
import 'cubit/inspection_device_state.dart'; import 'cubit/inspection_device_state.dart';
import 'widget/device_overview_card.dart'; import 'widget/device_overview_card.dart';
...@@ -31,24 +32,29 @@ class InspectionDeviceView extends StatelessWidget { ...@@ -31,24 +32,29 @@ class InspectionDeviceView extends StatelessWidget {
context.popRoute(); context.popRoute();
}, },
), ),
title: Row( title: GestureDetector(
mainAxisAlignment: MainAxisAlignment.center, onTap: () {
children: [ context.pushRoute(const InspectionTopologyRoute());
Text( },
'设备拓扑图', child: Row(
style: TextStyle( mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
'设备拓扑图',
style: TextStyle(
color: const Color.fromRGBO(100, 116, 139, 1),
fontSize: 32.sp,
fontWeight: FontWeight.w200,
),
),
Icon(
Icons.arrow_forward,
color: const Color.fromRGBO(100, 116, 139, 1), color: const Color.fromRGBO(100, 116, 139, 1),
fontSize: 32.sp,
fontWeight: FontWeight.w200,
), ),
), ],
// Icon( ),
// Icons.arrow_forward,
// color: const Color.fromRGBO(100, 116, 139, 1),
// ),
],
), ),
centerTitle: true, centerTitle: false,
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
padding: EdgeInsets.symmetric(horizontal: 28.w, vertical: 20.h), padding: EdgeInsets.symmetric(horizontal: 28.w, vertical: 20.h),
......
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'inspection_topology_state.dart';
class InspectionTopologyCubit extends Cubit<InspectionTopologyState> {
InspectionTopologyCubit()
: super(const InspectionTopologyState(
deviceName: '',
deviceModel: '',
topologyNodes: [],
)) {
_loadTopologyData();
}
void selectNode(TopologyNode? node) {
emit(state.copyWith(selectedNode: node));
}
void _loadTopologyData() {
final rootNode = TopologyNode(
id: '1',
name: '智能空开',
status: 'online',
x: 0.5,
y: 0.15,
children: [
TopologyNode(
id: '2',
name: '串口分配器',
status: 'online',
x: 0.25,
y: 0.45,
children: [
TopologyNode(
id: '5',
name: '环境采集',
status: 'online',
x: 0.15,
y: 0.75,
children: [],
),
TopologyNode(
id: '6',
name: '人体存在',
status: 'online',
x: 0.35,
y: 0.75,
children: [],
),
],
),
TopologyNode(
id: '3',
name: '网关',
status: 'online',
x: 0.5,
y: 0.45,
children: [
TopologyNode(
id: '7',
name: '环境采集',
status: 'online',
x: 0.45,
y: 0.75,
children: [],
),
TopologyNode(
id: '8',
name: '人体存在',
status: 'online',
x: 0.55,
y: 0.75,
children: [],
),
],
),
TopologyNode(
id: '4',
name: 'WIFI',
status: 'online',
x: 0.75,
y: 0.45,
children: [
TopologyNode(
id: '9',
name: '环境采集',
status: 'online',
x: 0.65,
y: 0.75,
children: [],
),
TopologyNode(
id: '10',
name: '人体存在',
status: 'online',
x: 0.85,
y: 0.75,
children: [],
),
],
),
],
);
emit(InspectionTopologyState(
deviceName: '客房305 智能空开',
deviceModel: 'A-301智能空开·客房301',
topologyNodes: [rootNode],
deviceCount: 10,
connectionCount: 11,
));
}
}
import 'package:flutter/material.dart';
import 'package:equatable/equatable.dart';
class InspectionTopologyState extends Equatable {
final String deviceName;
final String deviceModel;
final List<TopologyNode> topologyNodes;
final int deviceCount;
final int connectionCount;
final TopologyNode? selectedNode;
const InspectionTopologyState({
required this.deviceName,
required this.deviceModel,
required this.topologyNodes,
this.deviceCount = 10,
this.connectionCount = 11,
this.selectedNode,
});
InspectionTopologyState copyWith({
String? deviceName,
String? deviceModel,
List<TopologyNode>? topologyNodes,
int? deviceCount,
int? connectionCount,
TopologyNode? selectedNode,
}) {
return InspectionTopologyState(
deviceName: deviceName ?? this.deviceName,
deviceModel: deviceModel ?? this.deviceModel,
topologyNodes: topologyNodes ?? this.topologyNodes,
deviceCount: deviceCount ?? this.deviceCount,
connectionCount: connectionCount ?? this.connectionCount,
selectedNode: selectedNode,
);
}
@override
List<Object?> get props => [deviceName, deviceModel, topologyNodes, deviceCount, connectionCount, selectedNode];
}
class TopologyNode extends Equatable {
final String id;
final String name;
final String status;
final List<TopologyNode> children;
final double x;
final double y;
const TopologyNode({
required this.id,
required this.name,
required this.status,
required this.children,
required this.x,
required this.y,
});
@override
List<Object?> get props => [id, name, status, children, x, y];
}
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'cubit/inspection_topology_cubit.dart';
import 'cubit/inspection_topology_state.dart';
import 'widget/device_header_widget.dart';
import 'widget/status_legend_widget.dart';
import 'widget/network_topology_widget.dart';
import 'widget/device_detail_dialog.dart';
@RoutePage()
class InspectionTopologyView extends StatelessWidget {
const InspectionTopologyView({super.key});
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (_) => InspectionTopologyCubit(),
child: const InspectionTopologyPage(),
);
}
}
class InspectionTopologyPage extends StatelessWidget {
const InspectionTopologyPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color.fromRGBO(242, 243, 245, 1),
appBar: AppBar(
backgroundColor: Colors.white,
elevation: 0,
leading: IconButton(
icon: const Icon(Icons.arrow_back_ios,
color: Color.fromRGBO(100, 116, 139, 1)),
onPressed: () {
context.popRoute();
},
),
title: Text(
'设备拓扑',
style: TextStyle(
color: const Color.fromRGBO(15, 23, 42, 1),
fontSize: 32.sp,
fontWeight: FontWeight.w600,
),
),
centerTitle: true,
),
body: BlocBuilder<InspectionTopologyCubit, InspectionTopologyState>(
builder: (context, state) {
return Stack(
children: [
SingleChildScrollView(
padding: EdgeInsets.symmetric(horizontal: 28.w, vertical: 24.h),
child: Column(
children: [
SizedBox(height: 10.h),
StatusLegendWidget(),
SizedBox(height: 20.h),
DeviceHeaderWidget(
deviceName: state.deviceName,
deviceModel: state.deviceModel,
),
NetworkTopologyWidget(
topologyNodes: state.topologyNodes,
deviceCount: state.deviceCount,
connectionCount: state.connectionCount,
onNodeTap: (node) =>
context.read<InspectionTopologyCubit>().selectNode(node),
),
],
),
),
if (state.selectedNode != null)
DeviceDetailDialog(
node: state.selectedNode!,
onClose: () =>
context.read<InspectionTopologyCubit>().selectNode(null),
),
],
);
},
),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../cubit/inspection_topology_state.dart';
class DeviceDetailDialog extends StatelessWidget {
final TopologyNode node;
final VoidCallback onClose;
const DeviceDetailDialog({
super.key,
required this.node,
required this.onClose,
});
@override
Widget build(BuildContext context) {
return Container(
color: Colors.transparent,
child: Stack(
children: [
Positioned.fill(
child: GestureDetector(
onTap: onClose,
child: Container(
color: Colors.black.withOpacity(0.5),
),
),
),
Positioned(
left: 0,
right: 0,
bottom: 0,
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(48.r),
topRight: Radius.circular(48.r),
),
),
child: SafeArea(
top: false,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
margin: EdgeInsets.only(top: 20.h),
width: 120.w,
height: 8.h,
decoration: BoxDecoration(
color: const Color.fromRGBO(203, 213, 225, 1),
borderRadius: BorderRadius.circular(4.r),
),
),
Padding(
padding: EdgeInsets.all(48.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
width: 80.w,
height: 80.h,
decoration: BoxDecoration(
color: const Color.fromRGBO(239, 246, 255, 1),
borderRadius: BorderRadius.circular(20.r),
),
child: Icon(
_getDeviceIcon(node.name),
size: 80.sp,
color: const Color.fromRGBO(59, 130, 246, 1),
),
),
SizedBox(width: 32.w),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_getDeviceFullName(node.name),
style: TextStyle(
fontSize: 28.sp,
fontWeight: FontWeight.w600,
color: const Color.fromRGBO(15, 23, 42, 1),
),
),
SizedBox(height: 12.h),
Text(
'传感器',
style: TextStyle(
fontSize: 24.sp,
color: const Color.fromRGBO(148, 163, 184, 1),
),
),
],
),
),
Container(
padding: EdgeInsets.symmetric(
horizontal: 24.w,
vertical: 12.h,
),
decoration: BoxDecoration(
color: const Color.fromRGBO(209, 250, 229, 1),
borderRadius: BorderRadius.circular(40.r),
),
child: Text(
'正常',
style: TextStyle(
fontSize: 24.sp,
fontWeight: FontWeight.w500,
color: const Color.fromRGBO(16, 185, 129, 1),
),
),
),
],
),
SizedBox(height: 48.h),
Container(
width: double.infinity,
padding: EdgeInsets.symmetric(
horizontal: 32.w,
vertical: 32.h,
),
decoration: BoxDecoration(
color: const Color.fromRGBO(241, 245, 249, 1),
borderRadius: BorderRadius.circular(32.r),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'设备ID',
style: TextStyle(
fontSize: 24.sp,
color: const Color.fromRGBO(148, 163, 184, 1),
),
),
Text(
'dev-${node.id.padLeft(3, '0')}',
style: TextStyle(
fontSize: 24.sp,
fontWeight: FontWeight.w500,
color: const Color.fromRGBO(15, 23, 42, 1),
),
),
],
),
SizedBox(height: 32.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'连接方式',
style: TextStyle(
fontSize: 24.sp,
color: const Color.fromRGBO(148, 163, 184, 1),
),
),
Text(
'自动检测',
style: TextStyle(
fontSize: 24.sp,
fontWeight: FontWeight.w500,
color: const Color.fromRGBO(15, 23, 42, 1),
),
),
],
),
],
),
),
SizedBox(height: 48.h),
SizedBox(
width: double.infinity,
height: 104.h,
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: const Color.fromRGBO(59, 130, 246, 1),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40.r),
),
),
child: Text(
'查看详情',
style: TextStyle(
fontSize: 40.sp,
color: Colors.white,
fontWeight: FontWeight.w500,
),
),
),
),
],
),
),
],
),
),
),
),
],
),
);
}
IconData _getDeviceIcon(String name) {
if (name.contains('环境') || name.contains('温湿')) {
return Icons.thermostat;
} else if (name.contains('人体')) {
return Icons.person_search;
} else if (name.contains('空开')) {
return Icons.power;
} else if (name.contains('网关')) {
return Icons.router;
} else if (name.contains('WIFI')) {
return Icons.wifi;
} else if (name.contains('串口')) {
return Icons.usb;
}
return Icons.devices;
}
String _getDeviceFullName(String name) {
if (name == '环境采集') {
return '温湿度传感器';
}
return name;
}
}
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class DeviceHeaderWidget extends StatelessWidget {
final String deviceName;
final String deviceModel;
const DeviceHeaderWidget({
super.key,
required this.deviceName,
required this.deviceModel,
});
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 32.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24.r),
topRight: Radius.circular(24.r),
),
),
child: Row(
children: [
Container(
width: 64.w,
height: 64.h,
decoration: BoxDecoration(
color: const Color.fromRGBO(219, 234, 254, 1),
borderRadius: BorderRadius.circular(20.r),
),
child: Icon(
Icons.power,
size: 50.sp,
color: const Color.fromRGBO(59, 130, 246, 1),
),
),
SizedBox(width: 24.w),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
deviceName,
style: TextStyle(
fontSize: 28.sp,
fontWeight: FontWeight.w600,
color: const Color.fromRGBO(15, 23, 42, 1),
),
),
SizedBox(height: 12.h),
Text(
deviceModel,
style: TextStyle(
fontSize: 24.sp,
color: const Color.fromRGBO(100, 116, 139, 1),
),
),
],
),
),
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../cubit/inspection_topology_state.dart';
class NetworkTopologyWidget extends StatelessWidget {
final List<TopologyNode> topologyNodes;
final int deviceCount;
final int connectionCount;
final Function(TopologyNode) onNodeTap;
const NetworkTopologyWidget({
super.key,
required this.topologyNodes,
required this.deviceCount,
required this.connectionCount,
required this.onNodeTap,
});
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 32.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(24.r),
bottomRight: Radius.circular(24.r),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'网络拓扑',
style: TextStyle(
fontSize: 28.sp,
fontWeight: FontWeight.w600,
color: const Color.fromRGBO(15, 23, 42, 1),
),
),
Text(
'共$deviceCount个设备,$connectionCount条连接',
style: TextStyle(
fontSize: 24.sp,
color: const Color.fromRGBO(148, 163, 184, 1),
),
),
],
),
SizedBox(height: 32.h),
SizedBox(
width: double.infinity,
height: 800.h,
child: ClipRRect(
borderRadius: BorderRadius.circular(32.r),
child: Stack(
children: [
Container(
width: double.infinity,
height: double.infinity,
color: const Color.fromRGBO(241, 245, 249, 1),
),
if (topologyNodes.isNotEmpty)
CustomPaint(
size: Size.infinite,
painter: TopologyPainter(nodes: topologyNodes),
),
if (topologyNodes.isNotEmpty)
LayoutBuilder(
builder: (context, constraints) {
final List<Widget> clickableNodes = [];
_collectNodes(
topologyNodes[0],
clickableNodes,
constraints.maxWidth,
constraints.maxHeight,
);
return Stack(children: clickableNodes);
},
),
],
),
),
),
],
),
);
}
void _collectNodes(
TopologyNode node,
List<Widget> nodes,
double maxWidth,
double maxHeight,
) {
final centerX = maxWidth * node.x;
final centerY = maxHeight * node.y;
final nodeWidth = 150.w;
// final nodeHeight = node.name.length > 4 ? 160.h : 100.h;
final nodeHeight = 80.h;
nodes.add(
Positioned(
left: centerX - nodeWidth / 2,
top: centerY - nodeHeight / 2,
width: nodeWidth,
height: nodeHeight,
child: GestureDetector(
onTap: () => onNodeTap(node),
child: Container(
decoration: BoxDecoration(
color: const Color.fromRGBO(239, 246, 255, 1),
border: Border.all(
color: const Color.fromRGBO(59, 130, 246, 1),
width: 1.w,
),
borderRadius: BorderRadius.circular(60.r),
),
child: Center(
child: Text(
node.name,
style: TextStyle(
color: const Color.fromRGBO(71, 85, 105, 1),
fontSize: 24.sp,
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.center,
),
),
),
),
),
);
for (var child in node.children) {
_collectNodes(child, nodes, maxWidth, maxHeight);
}
}
}
class TopologyPainter extends CustomPainter {
final List<TopologyNode> nodes;
TopologyPainter({required this.nodes});
@override
void paint(Canvas canvas, Size size) {
if (nodes.isEmpty) return;
final paint = Paint()
..color = const Color.fromRGBO(203, 213, 225, 1)
..strokeWidth = 3.w
..style = PaintingStyle.stroke;
_drawConnections(canvas, size, nodes[0], paint);
}
void _drawConnections(Canvas canvas, Size size, TopologyNode node, Paint paint) {
final centerX = size.width * node.x;
final centerY = size.height * node.y;
for (var child in node.children) {
final childCenterX = size.width * child.x;
final childCenterY = size.height * child.y;
canvas.drawLine(
Offset(centerX, centerY),
Offset(childCenterX, childCenterY),
paint,
);
_drawConnections(canvas, size, child, paint);
}
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) => false;
}
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class StatusLegendWidget extends StatelessWidget {
const StatusLegendWidget({super.key});
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16.r),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'状态图例',
style: TextStyle(
fontSize: 28.sp,
fontWeight: FontWeight.w600,
color: const Color.fromRGBO(15, 23, 42, 1),
),
),
SizedBox(height: 24.h),
Wrap(
spacing: 32.w,
runSpacing: 20.h,
children: [
_buildLegendItem(const Color.fromRGBO(59, 130, 246, 1), '开启'),
_buildLegendItem(const Color.fromRGBO(226, 232, 240, 1), '关闭'),
_buildLegendItem(const Color.fromRGBO(16, 185, 129, 1), '在线'),
_buildLegendItem(const Color.fromRGBO(71, 85, 105, 1), '离线'),
_buildLegendItem(const Color.fromRGBO(251, 191, 36, 1), '告警'),
_buildLegendItem(const Color.fromRGBO(239, 68, 68, 1), '故障'),
],
),
],
),
);
}
Widget _buildLegendItem(Color color, String label) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 32.w,
height: 32.h,
decoration: BoxDecoration(
color: color,
shape: BoxShape.circle,
),
),
SizedBox(width: 12.w),
Text(
label,
style: TextStyle(
fontSize: 24.sp,
color: const Color.fromRGBO(71, 85, 105, 1),
),
),
],
);
}
}
...@@ -19,12 +19,14 @@ class ServiceIndexView extends StatelessWidget { ...@@ -19,12 +19,14 @@ class ServiceIndexView extends StatelessWidget {
child: LayoutBuilder( child: LayoutBuilder(
builder: (context, constraints) { builder: (context, constraints) {
return SingleChildScrollView( return SingleChildScrollView(
padding: EdgeInsets.symmetric(horizontal: 28.w),
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints(minHeight: constraints.maxHeight), constraints: BoxConstraints(
minHeight: constraints.maxHeight,
),
child: Container( child: Container(
// color: const Color.fromRGBO(242, 243, 245, 1), width: double.infinity,
color: Color.fromRGBO(242, 243, 245, 1.0), color: const Color.fromRGBO(242, 243, 245, 1),
padding: EdgeInsets.symmetric(horizontal: 28.w),
child: BlocBuilder<ServiceIndexCubit, ServiceIndexState>( child: BlocBuilder<ServiceIndexCubit, ServiceIndexState>(
builder: (context, state) { builder: (context, state) {
return Column( return Column(
......
...@@ -6,48 +6,58 @@ class ServiceHeadBlock extends StatelessWidget { ...@@ -6,48 +6,58 @@ class ServiceHeadBlock extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( final screenWidth = MediaQuery.of(context).size.width;
width: double.infinity, return Stack(
height: 150.h, clipBehavior: Clip.none,
padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight, left: 20.w, right: 20.w), children: [
decoration: BoxDecoration( Positioned(
// borderRadius: BorderRadius.circular(20.r), left: -28.w,
color: Colors.white, right: -28.w,
), top: 0,
child: Row( child: Container(
mainAxisAlignment: MainAxisAlignment.spaceBetween, height: 150.h,
children: [ color: Colors.white,
Text(
'客房服务看板',
style: TextStyle(
fontSize: 32.sp,
fontWeight: FontWeight.bold,
color: const Color.fromRGBO(0, 0, 0, 1),
fontFamily: 'FZLTXH',
),
), ),
Container( ),
width: 64.w, Container(
height: 64.w, height: 150.h,
decoration: BoxDecoration( padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight, left: 20.w, right: 20.w),
shape: BoxShape.circle, child: Row(
border: Border.all( mainAxisAlignment: MainAxisAlignment.spaceBetween,
color: const Color.fromRGBO(73, 149, 234, 1), children: [
width: 1.w, Text(
'客房服务看板',
style: TextStyle(
fontSize: 32.sp,
fontWeight: FontWeight.bold,
color: const Color.fromRGBO(0, 0, 0, 1),
fontFamily: 'FZLTXH',
),
), ),
), Container(
child: CircleAvatar( width: 64.w,
radius: 40.w, height: 64.w,
backgroundColor: Colors.white, decoration: BoxDecoration(
child: Icon( shape: BoxShape.circle,
Icons.person, border: Border.all(
color: const Color.fromRGBO(73, 149, 234, 1), color: const Color.fromRGBO(73, 149, 234, 1),
size: 48.sp, width: 1.w,
),
),
child: CircleAvatar(
radius: 40.w,
backgroundColor: Colors.white,
child: Icon(
Icons.person,
color: const Color.fromRGBO(73, 149, 234, 1),
size: 48.sp,
),
),
), ),
), ],
), ),
], ),
), ],
); );
} }
} }
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