Commit 59e6cf59 authored by huqu's avatar huqu

fix bugs

parent 1244f87e
...@@ -341,10 +341,10 @@ class AreaDeviceBO extends Equatable { ...@@ -341,10 +341,10 @@ class AreaDeviceBO extends Equatable {
class RoomStatusBO extends Equatable { class RoomStatusBO extends Equatable {
final int roomId; final int roomId;
final String roomNumber; final String roomNumber;
final String occupancyStatus; final String occupancyStatus;//房间有无人状态,0=无人 1=有人
final String roomStatus; final String roomStatus;//房间状态,0=无人 1=有人
final String cleanStatus; final String cleanStatus;//清洁灯状态,0=待清洁 2=已完成
final String devicePowerStatus; final String devicePowerStatus;//设备开关状态 0=关 1=开
const RoomStatusBO({ const RoomStatusBO({
required this.roomId, required this.roomId,
......
import 'dart:convert';
import '../repositories/inspection_device_repository.dart'; import '../repositories/inspection_device_repository.dart';
import '../models/bo/inspection_device_bo.dart'; import '../models/bo/inspection_device_bo.dart';
...@@ -37,9 +39,28 @@ class InspectionDeviceService { ...@@ -37,9 +39,28 @@ class InspectionDeviceService {
required int deviceId, required int deviceId,
required int inspectorId, required int inspectorId,
}) async { }) async {
List<Map<String, dynamic>> list = [
{
'name': '检查输入电压是否正常',
'value': '正常',
'status': 2,
},
{
'name': '确认设备是否正常运行',
'value': '正常',
'status': 2,
},
{
'name': '若异常,请联系电工',
'value': '正常',
'status': 2,
},
];
final result = await _repository.startInspection({ final result = await _repository.startInspection({
'deviceId': deviceId, 'deviceId': deviceId,
'inspectorId': inspectorId, 'inspectorId': inspectorId,
'remark': '巡检完成',//后端要先写死
'items_detail': jsonEncode(list),//后端要先写死
}); });
if (result.success && result.data != null) { if (result.success && result.data != null) {
return result.data!; return result.data!;
......
...@@ -52,7 +52,7 @@ class AbnormalDetailView extends StatelessWidget { ...@@ -52,7 +52,7 @@ class AbnormalDetailView extends StatelessWidget {
body: BlocBuilder<AbnormalCubit, AbnormalState>( body: BlocBuilder<AbnormalCubit, AbnormalState>(
builder: (context, state) { builder: (context, state) {
if (state.isLoading) { if (state.isLoading) {
return const Center(child: CircularProgressIndicator()); return const Center(child: CircularProgressIndicator(color: Color.fromRGBO(66, 165, 245, 1.0)));
} }
if (state.error != null) { if (state.error != null) {
return Center( return Center(
...@@ -121,7 +121,7 @@ class AbnormalDetailView extends StatelessWidget { ...@@ -121,7 +121,7 @@ class AbnormalDetailView extends StatelessWidget {
height: 32.sp, height: 32.sp,
child: const CircularProgressIndicator( child: const CircularProgressIndicator(
strokeWidth: 3, strokeWidth: 3,
color: Color.fromRGBO(237, 245, 255, 1), color: Color.fromRGBO(66, 165, 245, 1.0),
), ),
) )
: Text( : Text(
......
...@@ -111,6 +111,19 @@ class _AbnormalListBodyState extends State<_AbnormalListBody> { ...@@ -111,6 +111,19 @@ class _AbnormalListBodyState extends State<_AbnormalListBody> {
state: pagingState, state: pagingState,
fetchNextPage: fetchNextPage, fetchNextPage: fetchNextPage,
builderDelegate: PagedChildBuilderDelegate<AlarmItem>( builderDelegate: PagedChildBuilderDelegate<AlarmItem>(
firstPageProgressIndicatorBuilder: (_) => const Center(
child: CircularProgressIndicator(
color: Color.fromRGBO(66, 165, 245, 1.0),
),
),
newPageProgressIndicatorBuilder: (_) => const Center(
child: Padding(
padding: EdgeInsets.all(16),
child: CircularProgressIndicator(
color: Color.fromRGBO(66, 165, 245, 1.0),
),
),
),
firstPageErrorIndicatorBuilder: (_) => Center( firstPageErrorIndicatorBuilder: (_) => Center(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
......
...@@ -52,7 +52,7 @@ class DeviceDetailView extends StatelessWidget { ...@@ -52,7 +52,7 @@ class DeviceDetailView extends StatelessWidget {
body: BlocBuilder<DeviceCubit, DeviceState>( body: BlocBuilder<DeviceCubit, DeviceState>(
builder: (context, state) { builder: (context, state) {
if (state.isLoading) { if (state.isLoading) {
return const Center(child: CircularProgressIndicator()); return const Center(child: CircularProgressIndicator(color: Color.fromRGBO(66, 165, 245, 1.0)));
} }
if (state.error != null) { if (state.error != null) {
return Center( return Center(
...@@ -120,7 +120,7 @@ class DeviceDetailView extends StatelessWidget { ...@@ -120,7 +120,7 @@ class DeviceDetailView extends StatelessWidget {
height: 32.sp, height: 32.sp,
child: const CircularProgressIndicator( child: const CircularProgressIndicator(
strokeWidth: 3, strokeWidth: 3,
color: Color.fromRGBO(237, 245, 255, 1), color: Color.fromRGBO(66, 165, 245, 1.0),
), ),
) )
: Text( : Text(
...@@ -157,7 +157,7 @@ class DeviceDetailView extends StatelessWidget { ...@@ -157,7 +157,7 @@ class DeviceDetailView extends StatelessWidget {
height: 32.sp, height: 32.sp,
child: const CircularProgressIndicator( child: const CircularProgressIndicator(
strokeWidth: 3, strokeWidth: 3,
color: Color.fromRGBO(100, 116, 139, 1), color: Color.fromRGBO(66, 165, 245, 1.0),
), ),
) )
: Text( : Text(
......
...@@ -2,17 +2,26 @@ import 'package:flutter/material.dart'; ...@@ -2,17 +2,26 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:smart_hotel_app/models/bo/alert_dashboard_bo.dart'; import 'package:smart_hotel_app/models/bo/alert_dashboard_bo.dart';
import 'package:smart_hotel_app/repositories/alert_dashboard_repository.dart'; import 'package:smart_hotel_app/repositories/alert_dashboard_repository.dart';
import 'package:smart_hotel_app/repositories/alert_detail_repository.dart';
import 'package:smart_hotel_app/services/alert_dashboard_service.dart'; import 'package:smart_hotel_app/services/alert_dashboard_service.dart';
import 'package:smart_hotel_app/services/alert_detail_service.dart';
import 'package:smart_hotel_app/views/home/index/cubit/home_index_state.dart'; import 'package:smart_hotel_app/views/home/index/cubit/home_index_state.dart';
class HomeIndexCubit extends Cubit<HomeIndexState> { class HomeIndexCubit extends Cubit<HomeIndexState> {
final AlertDashboardService _service; final AlertDashboardService _service;
final AlertDetailService _alertDetailService;
HomeIndexCubit({AlertDashboardService? service}) HomeIndexCubit({
: _service = service ?? AlertDashboardService? service,
AlertDetailService? alertDetailService,
}) : _service = service ??
AlertDashboardService( AlertDashboardService(
repository: AlertDashboardRepository(), repository: AlertDashboardRepository(),
), ),
_alertDetailService = alertDetailService ??
AlertDetailService(
repository: AlertDetailRepository(),
),
super(const HomeIndexState()) { super(const HomeIndexState()) {
loadDashboard(); loadDashboard();
} }
...@@ -31,6 +40,20 @@ class HomeIndexCubit extends Cubit<HomeIndexState> { ...@@ -31,6 +40,20 @@ class HomeIndexCubit extends Cubit<HomeIndexState> {
loadDashboard(); loadDashboard();
} }
/// 处理告警
Future<void> handleAlert(int alertId) async {
if (state.isHandlingAlert) return;
emit(state.copyWith(isHandlingAlert: true));
try {
await _alertDetailService.handleAlert(alertId: alertId);
emit(state.copyWith(isHandlingAlert: false));
await reloadDashboard();
} catch (e) {
emit(state.copyWith(isHandlingAlert: false, error: e.toString()));
rethrow;
}
}
void _emitFromDashboard(AlertDashboardBO dashboard) { void _emitFromDashboard(AlertDashboardBO dashboard) {
emit(state.copyWith( emit(state.copyWith(
isLoading: false, isLoading: false,
......
...@@ -19,7 +19,10 @@ class EquipmentItem { ...@@ -19,7 +19,10 @@ class EquipmentItem {
} }
class HomeIndexState extends Equatable { class HomeIndexState extends Equatable {
static const _nothing = Object();
final bool isLoading; final bool isLoading;
final bool isHandlingAlert;
final String? error; final String? error;
final int highAlarmCount; final int highAlarmCount;
final int mediumAlarmCount; final int mediumAlarmCount;
...@@ -29,6 +32,7 @@ class HomeIndexState extends Equatable { ...@@ -29,6 +32,7 @@ class HomeIndexState extends Equatable {
const HomeIndexState({ const HomeIndexState({
this.isLoading = false, this.isLoading = false,
this.isHandlingAlert = false,
this.error, this.error,
this.highAlarmCount = 0, this.highAlarmCount = 0,
this.mediumAlarmCount = 0, this.mediumAlarmCount = 0,
...@@ -39,7 +43,8 @@ class HomeIndexState extends Equatable { ...@@ -39,7 +43,8 @@ class HomeIndexState extends Equatable {
HomeIndexState copyWith({ HomeIndexState copyWith({
bool? isLoading, bool? isLoading,
String? error, bool? isHandlingAlert,
Object? error = _nothing,
int? highAlarmCount, int? highAlarmCount,
int? mediumAlarmCount, int? mediumAlarmCount,
int? onlineDeviceCount, int? onlineDeviceCount,
...@@ -48,7 +53,8 @@ class HomeIndexState extends Equatable { ...@@ -48,7 +53,8 @@ class HomeIndexState extends Equatable {
}) { }) {
return HomeIndexState( return HomeIndexState(
isLoading: isLoading ?? this.isLoading, isLoading: isLoading ?? this.isLoading,
error: error, isHandlingAlert: isHandlingAlert ?? this.isHandlingAlert,
error: identical(error, _nothing) ? this.error : error as String?,
highAlarmCount: highAlarmCount ?? this.highAlarmCount, highAlarmCount: highAlarmCount ?? this.highAlarmCount,
mediumAlarmCount: mediumAlarmCount ?? this.mediumAlarmCount, mediumAlarmCount: mediumAlarmCount ?? this.mediumAlarmCount,
onlineDeviceCount: onlineDeviceCount ?? this.onlineDeviceCount, onlineDeviceCount: onlineDeviceCount ?? this.onlineDeviceCount,
...@@ -60,6 +66,7 @@ class HomeIndexState extends Equatable { ...@@ -60,6 +66,7 @@ class HomeIndexState extends Equatable {
@override @override
List<Object?> get props => [ List<Object?> get props => [
isLoading, isLoading,
isHandlingAlert,
error, error,
highAlarmCount, highAlarmCount,
mediumAlarmCount, mediumAlarmCount,
......
...@@ -12,30 +12,30 @@ class EquipmentListBlock extends StatelessWidget { ...@@ -12,30 +12,30 @@ class EquipmentListBlock extends StatelessWidget {
required this.equipmentList, required this.equipmentList,
}); });
Widget _buildEquipmentItem(EquipmentItem item) { Widget _buildEquipmentItem(EquipmentItem item, bool isLast) {
return Container( return Container(
padding: EdgeInsets.symmetric(vertical: 16.h), padding: EdgeInsets.symmetric(vertical: 16.h),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border( border: !isLast ? Border(
bottom: BorderSide( bottom: BorderSide(
color: const Color.fromRGBO(235, 235, 235, 1.0), color: const Color.fromRGBO(235, 235, 235, 1.0),
width: 1.w, width: 1.h,
),
), ),
) : null,
), ),
child: Row( child: Row(
children: [ children: [
Container( Container(
width: 64.w, width: 64.w,
height: 66.h, height: 53.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(235, 244, 255, 1.0), color: const Color.fromRGBO(229, 241, 255, 1.0),
borderRadius: BorderRadius.circular(12.r), borderRadius: BorderRadius.circular(8.r),
border: Border.all( // border: Border.all(
color: const Color.fromRGBO(66, 165, 245, 1.0), // color: const Color.fromRGBO(66, 165, 245, 1.0),
width: 2.w, // width: 2.w,
style: BorderStyle.solid, // style: BorderStyle.solid,
), // ),
), ),
child: Icon( child: Icon(
item.icon, item.icon,
...@@ -47,6 +47,7 @@ class EquipmentListBlock extends StatelessWidget { ...@@ -47,6 +47,7 @@ class EquipmentListBlock extends StatelessWidget {
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
spacing: 5.h,
children: [ children: [
Transform.translate( Transform.translate(
offset: Offset(0, 2.h), offset: Offset(0, 2.h),
...@@ -59,7 +60,6 @@ class EquipmentListBlock extends StatelessWidget { ...@@ -59,7 +60,6 @@ class EquipmentListBlock extends StatelessWidget {
), ),
), ),
), ),
SizedBox(height: 4.h),
Text( Text(
item.subtitle, item.subtitle,
style: TextStyle( style: TextStyle(
...@@ -85,11 +85,12 @@ class EquipmentListBlock extends StatelessWidget { ...@@ -85,11 +85,12 @@ class EquipmentListBlock extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return SizedBox(
width: double.infinity, width: double.infinity,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
spacing: 12.h,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
...@@ -111,21 +112,20 @@ class EquipmentListBlock extends StatelessWidget { ...@@ -111,21 +112,20 @@ class EquipmentListBlock extends StatelessWidget {
Text( Text(
'查看全部', '查看全部',
style: TextStyle( style: TextStyle(
fontSize: 24.sp, fontSize: 28.sp,
color: const Color.fromRGBO(66, 165, 245, 1.0), color: const Color.fromRGBO(66, 165, 245, 1.0),
), ),
), ),
Icon( Icon(
Icons.chevron_right, Icons.chevron_right,
color: const Color.fromRGBO(66, 165, 245, 1.0), color: const Color.fromRGBO(66, 165, 245, 1.0),
size: 24.sp, size: 30.sp,
), ),
], ],
), ),
), ),
], ],
), ),
SizedBox(height: 12.h),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
...@@ -133,7 +133,13 @@ class EquipmentListBlock extends StatelessWidget { ...@@ -133,7 +133,13 @@ class EquipmentListBlock extends StatelessWidget {
), ),
padding: EdgeInsets.symmetric(horizontal: 20.w), padding: EdgeInsets.symmetric(horizontal: 20.w),
child: Column( child: Column(
children: equipmentList.take(5).map((item) => _buildEquipmentItem(item)).toList(), // children: equipmentList.take(5).map((item) => _buildEquipmentItem(item)).toList(),
children: equipmentList.take(5).toList().asMap().entries.map((entry) {
int index = entry.key;
var item = entry.value;
bool isLast = index == equipmentList.take(5).length - 1;
return _buildEquipmentItem(item, isLast);
}).toList(),
), ),
), ),
], ],
......
...@@ -6,17 +6,37 @@ class TaskHeadBlock extends StatelessWidget { ...@@ -6,17 +6,37 @@ class TaskHeadBlock extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Stack(
width: double.infinity, clipBehavior: Clip.none,
children: [
Positioned(
left: -28.w,
right: -28.w,
top: 0,
child: Container(
height: 150.h,
color: Colors.white,
),
),
Container(
height: 150.h,
padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight), padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight),
child: Text( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'设备告警看板', '设备告警看板',
style: TextStyle( style: TextStyle(
fontSize: 28.sp, fontSize: 32.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: const Color.fromRGBO(51, 51, 51, 1.0), color: const Color.fromRGBO(0, 0, 0, 1),
),
), ),
],
), ),
),
],
); );
} }
} }
\ No newline at end of file
...@@ -2,9 +2,7 @@ import 'package:auto_route/auto_route.dart'; ...@@ -2,9 +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/repositories/alert_detail_repository.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/services/alert_detail_service.dart';
import 'package:smart_hotel_app/views/home/abnormal_list/cubit/abnormal_list_state.dart'; import 'package:smart_hotel_app/views/home/abnormal_list/cubit/abnormal_list_state.dart';
import 'package:smart_hotel_app/views/home/index/cubit/home_index_cubit.dart'; import 'package:smart_hotel_app/views/home/index/cubit/home_index_cubit.dart';
import 'package:smart_hotel_app/utils/toast_utils.dart'; import 'package:smart_hotel_app/utils/toast_utils.dart';
...@@ -17,7 +15,6 @@ class VoltageOperateBlock extends StatelessWidget { ...@@ -17,7 +15,6 @@ class VoltageOperateBlock extends StatelessWidget {
final String normalVoltage; final String normalVoltage;
final String voltageWaitTime; final String voltageWaitTime;
final String voltageAlarmLevel; final String voltageAlarmLevel;
final AlertDetailService? alertDetailService;
const VoltageOperateBlock({ const VoltageOperateBlock({
super.key, super.key,
...@@ -28,7 +25,6 @@ class VoltageOperateBlock extends StatelessWidget { ...@@ -28,7 +25,6 @@ class VoltageOperateBlock extends StatelessWidget {
required this.normalVoltage, required this.normalVoltage,
required this.voltageWaitTime, required this.voltageWaitTime,
required this.voltageAlarmLevel, required this.voltageAlarmLevel,
this.alertDetailService,
}); });
@override @override
...@@ -51,20 +47,20 @@ class VoltageOperateBlock extends StatelessWidget { ...@@ -51,20 +47,20 @@ class VoltageOperateBlock extends StatelessWidget {
children: [ children: [
Container( Container(
width: 64.w, width: 64.w,
height: 66.h, height: 54.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(235, 244, 255, 1.0), color: const Color.fromRGBO(235, 244, 255, 1.0),
borderRadius: BorderRadius.circular(12.r), borderRadius: BorderRadius.circular(12.r),
border: Border.all( // border: Border.all(
color: const Color.fromRGBO(66, 165, 245, 1.0), // color: const Color.fromRGBO(66, 165, 245, 1.0),
width: 2.w, // width: 2.w,
style: BorderStyle.solid, // style: BorderStyle.solid,
), // ),
), ),
child: Icon( child: Icon(
Icons.thermostat_outlined, Icons.thermostat_outlined,
color: const Color.fromRGBO(66, 165, 245, 1.0), color: const Color.fromRGBO(66, 165, 245, 1.0),
size: 32.sp, size: 40.sp,
), ),
), ),
SizedBox(width: 16.w), SizedBox(width: 16.w),
...@@ -95,7 +91,9 @@ class VoltageOperateBlock extends StatelessWidget { ...@@ -95,7 +91,9 @@ class VoltageOperateBlock extends StatelessWidget {
voltageAlarmLevel, voltageAlarmLevel,
style: TextStyle( style: TextStyle(
fontSize: 24.sp, fontSize: 24.sp,
color: voltageAlarmLevel=="置顶" ? const Color.fromRGBO(255, 100, 101, 1.0) : const Color.fromRGBO(255, 204, 21, 1.0), color: voltageAlarmLevel=="置顶" ?
const Color.fromRGBO(255, 100, 101, 1.0) :
const Color.fromRGBO(255, 204, 21, 1.0),
), ),
), ),
], ],
...@@ -105,22 +103,23 @@ class VoltageOperateBlock extends StatelessWidget { ...@@ -105,22 +103,23 @@ class VoltageOperateBlock extends StatelessWidget {
width: double.infinity, width: double.infinity,
margin: EdgeInsets.only(left: 80.w, bottom: 20.h), margin: EdgeInsets.only(left: 80.w, bottom: 20.h),
child: Text( child: Text(
'电压${voltageValue}V (正常≤${normalVoltage}V)·已等待$voltageWaitTime', '电压${voltageValue}V (正常≤${normalVoltage}V)·$voltageWaitTime',
style: TextStyle( style: TextStyle(
fontSize: 24.sp, fontSize: 24.sp,
color: const Color.fromRGBO(100, 116, 139, 1.0), color: const Color.fromRGBO(100, 116, 139, 1.0),
), ),
), ),
), ),
Container( SizedBox(
width: double.infinity, width: double.infinity,
child: Row( child: Row(
spacing: 20.w,
children: [ children: [
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () => _showHandleDialog(context), onTap: () => _showHandleDialog(context),
child: Container( child: Container(
height: 88.h, padding: EdgeInsets.symmetric(vertical: 20.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(66, 165, 245, 1.0), color: const Color.fromRGBO(66, 165, 245, 1.0),
borderRadius: BorderRadius.circular(16.r), borderRadius: BorderRadius.circular(16.r),
...@@ -137,14 +136,13 @@ class VoltageOperateBlock extends StatelessWidget { ...@@ -137,14 +136,13 @@ class VoltageOperateBlock extends StatelessWidget {
), ),
), ),
), ),
SizedBox(width: 20.w),
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
context.pushRoute(AbnormalDetailRoute(alertId: alertId, alarmStatus: AlarmStatus.pending)); context.pushRoute(AbnormalDetailRoute(alertId: alertId, alarmStatus: AlarmStatus.pending));
}, },
child: Container( child: Container(
height: 88.h, padding: EdgeInsets.symmetric(vertical: 20.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(235, 244, 255, 1.0), color: const Color.fromRGBO(235, 244, 255, 1.0),
borderRadius: BorderRadius.circular(16.r), borderRadius: BorderRadius.circular(16.r),
...@@ -244,9 +242,18 @@ class VoltageOperateBlock extends StatelessWidget { ...@@ -244,9 +242,18 @@ class VoltageOperateBlock extends StatelessWidget {
), ),
SizedBox(height: 20.h), SizedBox(height: 20.h),
GestureDetector( GestureDetector(
onTap: () { onTap: () async {
Navigator.of(dialogContext).pop(); Navigator.of(dialogContext).pop();
_handleAlert(context); try {
await context.read<HomeIndexCubit>().handleAlert(alertId);
if (context.mounted) {
showToast('操作成功');
}
} catch (e) {
if (context.mounted) {
showToast('操作失败: $e');
}
}
}, },
child: Container( child: Container(
width: double.infinity, width: double.infinity,
...@@ -273,20 +280,4 @@ class VoltageOperateBlock extends StatelessWidget { ...@@ -273,20 +280,4 @@ class VoltageOperateBlock extends StatelessWidget {
}, },
); );
} }
Future<void> _handleAlert(BuildContext context) async {
try {
final service = alertDetailService ??
AlertDetailService(repository: AlertDetailRepository());
await service.handleAlert(alertId: alertId);
if (context.mounted) {
showToast('操作成功');
context.read<HomeIndexCubit>().reloadDashboard();
}
} catch (e) {
if (context.mounted) {
showToast('操作失败: $e');
}
}
}
} }
\ No newline at end of file
...@@ -86,7 +86,7 @@ class _InspectionDetailBodyState extends State<_InspectionDetailBody> { ...@@ -86,7 +86,7 @@ class _InspectionDetailBodyState extends State<_InspectionDetailBody> {
return Scaffold( return Scaffold(
backgroundColor: const Color.fromRGBO(242, 243, 245, 1), backgroundColor: const Color.fromRGBO(242, 243, 245, 1),
appBar: _buildAppBar(context), appBar: _buildAppBar(context),
body: const Center(child: CircularProgressIndicator()), body: const Center(child: CircularProgressIndicator(color: Color.fromRGBO(66, 165, 245, 1.0))),
); );
} }
......
...@@ -24,6 +24,19 @@ class DeviceList extends StatelessWidget { ...@@ -24,6 +24,19 @@ class DeviceList extends StatelessWidget {
state: pagingState, state: pagingState,
fetchNextPage: fetchNextPage, fetchNextPage: fetchNextPage,
builderDelegate: PagedChildBuilderDelegate<InspectionDevice>( builderDelegate: PagedChildBuilderDelegate<InspectionDevice>(
firstPageProgressIndicatorBuilder: (_) => const Center(
child: CircularProgressIndicator(
color: Color.fromRGBO(66, 165, 245, 1.0),
),
),
newPageProgressIndicatorBuilder: (_) => const Center(
child: Padding(
padding: EdgeInsets.all(16),
child: CircularProgressIndicator(
color: Color.fromRGBO(66, 165, 245, 1.0),
),
),
),
firstPageErrorIndicatorBuilder: (_) => Center( firstPageErrorIndicatorBuilder: (_) => Center(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
......
...@@ -87,7 +87,6 @@ class InspectionDeviceView extends StatelessWidget { ...@@ -87,7 +87,6 @@ class InspectionDeviceView extends StatelessWidget {
), ),
], ],
if (state.inspectionItems.isNotEmpty) ...[ if (state.inspectionItems.isNotEmpty) ...[
SizedBox(height: 20.h),
InspectionItemsCard( InspectionItemsCard(
items: state.inspectionItems, items: state.inspectionItems,
), ),
...@@ -104,26 +103,21 @@ class InspectionDeviceView extends StatelessWidget { ...@@ -104,26 +103,21 @@ class InspectionDeviceView extends StatelessWidget {
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: 88.h, height: 88.h,
alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(24.r),
border: Border.all(
color: const Color.fromRGBO(66, 165, 245, 1.0), color: const Color.fromRGBO(66, 165, 245, 1.0),
width: 2.w, borderRadius: BorderRadius.circular(24.r),
),
), ),
child: Center(
child: Text( child: Text(
'巡检记录', '巡检记录',
style: TextStyle( style: TextStyle(
color: const Color.fromRGBO(66, 165, 245, 1.0), color: Colors.white,
fontSize: 32.sp, fontSize: 32.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
), ),
), ),
),
SizedBox(height: 30.h), SizedBox(height: 30.h),
], ],
); );
......
...@@ -45,25 +45,36 @@ class InspectionHistoryCard extends StatelessWidget { ...@@ -45,25 +45,36 @@ class InspectionHistoryCard extends StatelessWidget {
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
spacing: 12.w,
children: [ children: [
Container( Container(
width: 60.w, width: 80.w,
height: 60.h, height: 64.h,
alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(242, 243, 245, 1.0), color: const Color.fromRGBO(229, 241, 255, 1.0),
borderRadius: BorderRadius.circular(8.r), borderRadius: BorderRadius.circular(8.r),
), ),
child: Container(
width: 44.w,
height: 44.h,
decoration: const BoxDecoration(
color: Color.fromRGBO(73, 149, 234, 1),
shape: BoxShape.circle,
),
child: Icon( child: Icon(
Icons.person, Icons.person,
color: const Color.fromRGBO(100, 116, 139, 1.0), color: Colors.white,
size: 32.sp, size: 40.sp,
),
), ),
), ),
SizedBox(width: 12.w),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
spacing: 4.h,
children: [ children: [
Text( Text(
item.inspectorName, item.inspectorName,
...@@ -73,19 +84,18 @@ class InspectionHistoryCard extends StatelessWidget { ...@@ -73,19 +84,18 @@ class InspectionHistoryCard extends StatelessWidget {
color: const Color.fromRGBO(10, 13, 20, 1.0), color: const Color.fromRGBO(10, 13, 20, 1.0),
), ),
), ),
SizedBox(height: 4.h),
Row( Row(
children: [ children: [
Icon( Icon(
Icons.access_time, Icons.access_time,
color: const Color.fromRGBO(100, 116, 139, 1.0), color: const Color.fromRGBO(100, 116, 139, 1.0),
size: 20.sp, size: 24.sp,
), ),
SizedBox(width: 4.w), SizedBox(width: 4.w),
Text( Text(
item.inspectionTime, item.inspectionTime,
style: TextStyle( style: TextStyle(
fontSize: 22.sp, fontSize: 24.sp,
color: const Color.fromRGBO(100, 116, 139, 1.0), color: const Color.fromRGBO(100, 116, 139, 1.0),
), ),
), ),
...@@ -96,23 +106,23 @@ class InspectionHistoryCard extends StatelessWidget { ...@@ -96,23 +106,23 @@ class InspectionHistoryCard extends StatelessWidget {
], ],
), ),
Container( Container(
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 6.h), padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 4.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(225, 245, 238, 1.0), color: const Color.fromRGBO(225, 245, 238, 1.0),
borderRadius: BorderRadius.circular(10.r), borderRadius: BorderRadius.circular(40.r),
), ),
child: Row( child: Row(
children: [ children: [
Icon( Icon(
Icons.check, Icons.check,
color: const Color.fromRGBO(26, 188, 156, 1.0), color: const Color.fromRGBO(26, 188, 156, 1.0),
size: 20.sp, size: 24.sp,
), ),
SizedBox(width: 4.w), SizedBox(width: 4.w),
Text( Text(
item.result, item.result,
style: TextStyle( style: TextStyle(
fontSize: 22.sp, fontSize: 24.sp,
color: const Color.fromRGBO(26, 188, 156, 1.0), color: const Color.fromRGBO(26, 188, 156, 1.0),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
...@@ -122,10 +132,10 @@ class InspectionHistoryCard extends StatelessWidget { ...@@ -122,10 +132,10 @@ class InspectionHistoryCard extends StatelessWidget {
), ),
], ],
), ),
SizedBox(height: 16.h), SizedBox(height: 20.h),
Container( Container(
width: double.infinity, width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h), padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(242, 243, 245, 1.0), color: const Color.fromRGBO(242, 243, 245, 1.0),
borderRadius: BorderRadius.circular(12.r), borderRadius: BorderRadius.circular(12.r),
...@@ -133,12 +143,11 @@ class InspectionHistoryCard extends StatelessWidget { ...@@ -133,12 +143,11 @@ class InspectionHistoryCard extends StatelessWidget {
child: Text( child: Text(
item.remark, item.remark,
style: TextStyle( style: TextStyle(
fontSize: 22.sp, fontSize: 24.sp,
color: const Color.fromRGBO(100, 116, 139, 1.0), color: const Color.fromRGBO(100, 116, 139, 1.0),
), ),
), ),
), ),
SizedBox(height: 20.h),
], ],
); );
} }
......
...@@ -28,8 +28,7 @@ class InspectionItemsCard extends StatelessWidget { ...@@ -28,8 +28,7 @@ class InspectionItemsCard extends StatelessWidget {
'巡检项目', '巡检项目',
style: TextStyle( style: TextStyle(
fontSize: 26.sp, fontSize: 26.sp,
fontWeight: FontWeight.bold, color: const Color.fromRGBO(100, 116, 139, 1.0),
color: const Color.fromRGBO(10, 13, 20, 1.0),
), ),
), ),
SizedBox(height: 20.h), SizedBox(height: 20.h),
...@@ -66,23 +65,23 @@ class InspectionItemsCard extends StatelessWidget { ...@@ -66,23 +65,23 @@ class InspectionItemsCard extends StatelessWidget {
), ),
SizedBox(width: 12.w), SizedBox(width: 12.w),
Container( Container(
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 6.h), padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 4.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(225, 245, 238, 1.0), color: const Color.fromRGBO(225, 245, 238, 1.0),
borderRadius: BorderRadius.circular(10.r), borderRadius: BorderRadius.circular(40.r),
), ),
child: Row( child: Row(
children: [ children: [
Icon( Icon(
Icons.check, Icons.check,
color: const Color.fromRGBO(26, 188, 156, 1.0), color: const Color.fromRGBO(26, 188, 156, 1.0),
size: 20.sp, size: 24.sp,
), ),
SizedBox(width: 4.w), SizedBox(width: 4.w),
Text( Text(
item.result, item.result,
style: TextStyle( style: TextStyle(
fontSize: 22.sp, fontSize: 24.sp,
color: const Color.fromRGBO(26, 188, 156, 1.0), color: const Color.fromRGBO(26, 188, 156, 1.0),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
......
...@@ -83,11 +83,11 @@ class StartInspectionButton extends StatelessWidget { ...@@ -83,11 +83,11 @@ class StartInspectionButton extends StatelessWidget {
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: 88.h, height: 88.h,
alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(66, 165, 245, 1.0), color: const Color.fromRGBO(66, 165, 245, 1.0),
borderRadius: BorderRadius.circular(24.r), borderRadius: BorderRadius.circular(24.r),
), ),
child: Center(
child: Text( child: Text(
'开始巡检', '开始巡检',
style: TextStyle( style: TextStyle(
...@@ -97,7 +97,6 @@ class StartInspectionButton extends StatelessWidget { ...@@ -97,7 +97,6 @@ class StartInspectionButton extends StatelessWidget {
), ),
), ),
), ),
),
); );
}, },
); );
......
...@@ -49,7 +49,6 @@ class _InspectionHistoryBodyState extends State<_InspectionHistoryBody> { ...@@ -49,7 +49,6 @@ class _InspectionHistoryBodyState extends State<_InspectionHistoryBody> {
final total = final total =
context.read<InspectionHistoryCubit>().state.totalCount; context.read<InspectionHistoryCubit>().state.totalCount;
final nextKey = state.nextIntPageKey; final nextKey = state.nextIntPageKey;
if (nextKey == null) return null;
if ((nextKey - 1) * InspectionHistoryCubit.pageSize >= total) { if ((nextKey - 1) * InspectionHistoryCubit.pageSize >= total) {
return null; return null;
} }
...@@ -129,8 +128,7 @@ class _InspectionHistoryBodyState extends State<_InspectionHistoryBody> { ...@@ -129,8 +128,7 @@ class _InspectionHistoryBodyState extends State<_InspectionHistoryBody> {
style: TextStyle( style: TextStyle(
fontSize: 28.sp, fontSize: 28.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: color: const Color.fromRGBO(10, 13, 20, 1.0),
const Color.fromRGBO(10, 13, 20, 1.0),
), ),
), ),
], ],
...@@ -144,6 +142,19 @@ class _InspectionHistoryBodyState extends State<_InspectionHistoryBody> { ...@@ -144,6 +142,19 @@ class _InspectionHistoryBodyState extends State<_InspectionHistoryBody> {
fetchNextPage: fetchNextPage, fetchNextPage: fetchNextPage,
builderDelegate: builderDelegate:
PagedChildBuilderDelegate<InspectionRecord>( PagedChildBuilderDelegate<InspectionRecord>(
firstPageProgressIndicatorBuilder: (_) => const Center(
child: CircularProgressIndicator(
color: Color.fromRGBO(66, 165, 245, 1.0),
),
),
newPageProgressIndicatorBuilder: (_) => const Center(
child: Padding(
padding: EdgeInsets.all(16),
child: CircularProgressIndicator(
color: Color.fromRGBO(66, 165, 245, 1.0),
),
),
),
firstPageErrorIndicatorBuilder: (_) => Center( firstPageErrorIndicatorBuilder: (_) => Center(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
......
...@@ -12,37 +12,40 @@ class InspectionRecordItem extends StatelessWidget { ...@@ -12,37 +12,40 @@ class InspectionRecordItem extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final resultColor = _getResultColor(record.result);
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(20.r), borderRadius: BorderRadius.circular(20.r),
), ),
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 16.h), padding: EdgeInsets.symmetric(horizontal: 28.w, vertical: 28.h),
margin: EdgeInsets.only(bottom: 20.h), margin: EdgeInsets.only(bottom: 20.h),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [ children: [
Container( Container(
width: 60.w, width: 80.w,
height: 60.h, height: 64.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(242, 243, 245, 1.0), color: const Color.fromRGBO(229, 241, 255, 1.0),
borderRadius: BorderRadius.circular(8.r), borderRadius: BorderRadius.circular(8.r),
), ),
child: Icon( child: Icon(
record.icon, record.icon,
color: const Color.fromRGBO(100, 116, 139, 1.0), color: const Color.fromRGBO(73, 149, 234, 1.0),
size: 32.sp, size: 32.sp,
), ),
), ),
SizedBox(width: 12.w), SizedBox(width: 20.w),
Column( Expanded(
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
spacing: 10.h,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
record.deviceName, record.deviceName,
...@@ -52,81 +55,89 @@ class InspectionRecordItem extends StatelessWidget { ...@@ -52,81 +55,89 @@ class InspectionRecordItem extends StatelessWidget {
color: const Color.fromRGBO(10, 13, 20, 1.0), color: const Color.fromRGBO(10, 13, 20, 1.0),
), ),
), ),
SizedBox(height: 8.h), Container(
Row( padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 4.h),
decoration: BoxDecoration(
color: resultColor.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(40.r),
),
child: Row(
children: [ children: [
Icon( Icon(
Icons.person, _getResultIcon(record.result),
color: const Color.fromRGBO(66, 165, 245, 1.0), color: resultColor,
size: 18.sp, size: 24.sp,
), ),
SizedBox(width: 4.w), SizedBox(width: 4.w),
Text( Text(
record.inspectorName, record.result,
style: TextStyle( style: TextStyle(
fontSize: 22.sp, fontSize: 24.sp,
color: const Color.fromRGBO(100, 116, 139, 1.0), color: resultColor,
fontWeight: FontWeight.bold,
), ),
), ),
], ],
), ),
],
), ),
], ],
), ),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
spacing: 4.w,
children: [
Container( Container(
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 6.h), width: 24.w,
decoration: BoxDecoration( height: 24.h,
color: _getResultColor(record.result).withOpacity(0.1), decoration: const BoxDecoration(
borderRadius: BorderRadius.circular(10.r), color: Color.fromRGBO(73, 149, 234, 1),
border: Border.all( shape: BoxShape.circle,
color: _getResultColor(record.result),
width: 1.w,
), ),
child: Icon(
Icons.person,
color: Colors.white,
size: 22.sp,
), ),
child: Row(
children: [
Icon(
_getResultIcon(record.result),
color: _getResultColor(record.result),
size: 18.sp,
), ),
SizedBox(width: 4.w),
Text( Text(
record.result, record.inspectorName,
style: TextStyle( style: TextStyle(
fontSize: 22.sp, fontSize: 24.sp,
color: _getResultColor(record.result), color: const Color.fromRGBO(100, 116, 139, 1.0),
fontWeight: FontWeight.bold,
),
),
],
), ),
), ),
], ],
), ),
SizedBox(height: 12.h),
Row( Row(
children: [ children: [
Icon( Icon(
Icons.access_time, Icons.access_time,
color: const Color.fromRGBO(100, 116, 139, 1.0), color: const Color.fromRGBO(100, 116, 139, 1.0),
size: 20.sp, size: 24.sp,
), ),
SizedBox(width: 4.w), SizedBox(width: 4.w),
Text( Text(
record.inspectionTime, record.inspectionTime,
style: TextStyle( style: TextStyle(
fontSize: 22.sp, fontSize: 24.sp,
color: const Color.fromRGBO(100, 116, 139, 1.0), color: const Color.fromRGBO(100, 116, 139, 1.0),
), ),
), ),
], ],
), ),
SizedBox(height: 16.h), ],
)
],
)
),
],
),
SizedBox(height: 20.h),
Container( Container(
width: double.infinity, width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h), padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 16.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(242, 243, 245, 1.0), color: const Color.fromRGBO(242, 243, 245, 1.0),
borderRadius: BorderRadius.circular(12.r), borderRadius: BorderRadius.circular(12.r),
...@@ -134,23 +145,24 @@ class InspectionRecordItem extends StatelessWidget { ...@@ -134,23 +145,24 @@ class InspectionRecordItem extends StatelessWidget {
child: Text( child: Text(
record.remark, record.remark,
style: TextStyle( style: TextStyle(
fontSize: 22.sp, fontSize: 24.sp,
color: const Color.fromRGBO(100, 116, 139, 1.0), color: const Color.fromRGBO(100, 116, 139, 1.0),
), ),
), ),
), ),
SizedBox(height: 16.h), SizedBox(height: 20.h),
Divider( Divider(
color: const Color.fromRGBO(242, 243, 245, 1.0),
height: 1.h, height: 1.h,
thickness: 0.5,
color: const Color.fromRGBO(100, 116, 139, 0.2),
), ),
SizedBox(height: 16.h), SizedBox(height: 20.h),
Text( Text(
'巡检项目', '巡检项目',
style: TextStyle( style: TextStyle(
fontSize: 24.sp, fontSize: 24.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: const Color.fromRGBO(71, 85, 105, 1.0), color: const Color.fromRGBO(100, 116, 139, 1.0),
), ),
), ),
SizedBox(height: 12.h), SizedBox(height: 12.h),
...@@ -182,27 +194,27 @@ class InspectionRecordItem extends StatelessWidget { ...@@ -182,27 +194,27 @@ class InspectionRecordItem extends StatelessWidget {
} }
Widget _buildItemTag(InspectionItemRecord item) { Widget _buildItemTag(InspectionItemRecord item) {
final resultColor = _getResultColor(item.result); final resultColor = _getResultColor(record.result);
return Container( return Container(
padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 8.h), padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 8.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color.fromRGBO(209, 250, 229, 1.0), // resultColor.withValues(alpha: 0.18), color: resultColor.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(18.r), borderRadius: BorderRadius.circular(40.r),
), ),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
spacing: 6.w,
children: [ children: [
Icon( Icon(
_getResultIcon(item.result), _getResultIcon(record.result),
color: resultColor, color: resultColor,
size: 18.sp, size: 24.sp,
), ),
SizedBox(width: 6.w),
Text( Text(
item.name, item.name,
style: TextStyle( style: TextStyle(
fontSize: 22.sp, fontSize: 24.sp,
color: resultColor, color: resultColor,
), ),
), ),
......
...@@ -26,10 +26,10 @@ class StatisticsCard extends StatelessWidget { ...@@ -26,10 +26,10 @@ class StatisticsCard extends StatelessWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
_buildStatItem('总计', totalCount, const Color.fromRGBO(66, 165, 245, 1.0)), _buildStatItem('总计', totalCount, const Color.fromRGBO(73, 149, 234, 1.0)),
_buildStatItem('通过', passCount, const Color.fromRGBO(26, 188, 156, 1.0)), _buildStatItem('通过', passCount, const Color.fromRGBO(20, 184, 166, 1.0)),
_buildStatItem('警告', warningCount, const Color.fromRGBO(247, 184, 75, 1.0)), _buildStatItem('警告', warningCount, const Color.fromRGBO(250, 204, 21, 1.0)),
_buildStatItem('不通过', failCount, const Color.fromRGBO(239, 68, 68, 1.0)), _buildStatItem('不通过', failCount, const Color.fromRGBO(255, 100, 101, 1.0)),
], ],
), ),
); );
...@@ -37,6 +37,7 @@ class StatisticsCard extends StatelessWidget { ...@@ -37,6 +37,7 @@ class StatisticsCard extends StatelessWidget {
Widget _buildStatItem(String label, int count, Color color) { Widget _buildStatItem(String label, int count, Color color) {
return Column( return Column(
spacing: 5.h,
children: [ children: [
Text( Text(
count.toString(), count.toString(),
...@@ -46,7 +47,6 @@ class StatisticsCard extends StatelessWidget { ...@@ -46,7 +47,6 @@ class StatisticsCard extends StatelessWidget {
color: color, color: color,
), ),
), ),
SizedBox(height: 4.h),
Text( Text(
label, label,
style: TextStyle( style: TextStyle(
......
...@@ -55,7 +55,7 @@ class InspectionTopologyPage extends StatelessWidget { ...@@ -55,7 +55,7 @@ class InspectionTopologyPage extends StatelessWidget {
builder: (context, state) { builder: (context, state) {
if (state.isLoading) { if (state.isLoading) {
return const Center( return const Center(
child: CircularProgressIndicator(), child: CircularProgressIndicator(color: const Color.fromRGBO(66, 165, 245, 1.0)),
); );
} }
......
...@@ -33,7 +33,7 @@ class BtnLogin extends StatelessWidget { ...@@ -33,7 +33,7 @@ class BtnLogin extends StatelessWidget {
height: 40.w, height: 40.w,
child: CircularProgressIndicator( child: CircularProgressIndicator(
strokeWidth: 3.w, strokeWidth: 3.w,
color: Colors.white, color: const Color.fromRGBO(66, 165, 245, 1.0),
), ),
) )
: Text( : Text(
......
...@@ -16,14 +16,14 @@ class ProfileHeaderBlock extends StatelessWidget { ...@@ -16,14 +16,14 @@ class ProfileHeaderBlock extends StatelessWidget {
return Container( return Container(
width: double.infinity, width: double.infinity,
color: Colors.white, color: Colors.white,
padding: EdgeInsets.only(left: 28.w, right: 28.w, top: ScreenUtil().statusBarHeight + 32.h, bottom: 32.h), padding: EdgeInsets.only(left: 28.w, right: 28.w, top: ScreenUtil().statusBarHeight + 20.h, bottom: 32.h),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'我的', '我的',
style: TextStyle( style: TextStyle(
fontSize: 36.sp, fontSize: 32.sp,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Colors.black, color: Colors.black,
), ),
......
...@@ -115,6 +115,19 @@ class _ReportDeviceListBodyState extends State<_ReportDeviceListBody> { ...@@ -115,6 +115,19 @@ class _ReportDeviceListBodyState extends State<_ReportDeviceListBody> {
state: pagingState, state: pagingState,
fetchNextPage: fetchNextPage, fetchNextPage: fetchNextPage,
builderDelegate: PagedChildBuilderDelegate<DeviceInfo>( builderDelegate: PagedChildBuilderDelegate<DeviceInfo>(
firstPageProgressIndicatorBuilder: (_) => const Center(
child: CircularProgressIndicator(
color: Color.fromRGBO(66, 165, 245, 1.0),
),
),
newPageProgressIndicatorBuilder: (_) => const Center(
child: Padding(
padding: EdgeInsets.all(16),
child: CircularProgressIndicator(
color: Color.fromRGBO(66, 165, 245, 1.0),
),
),
),
firstPageErrorIndicatorBuilder: (_) => Center( firstPageErrorIndicatorBuilder: (_) => Center(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
......
...@@ -40,7 +40,7 @@ class ReportEnergyDetailView extends StatelessWidget { ...@@ -40,7 +40,7 @@ class ReportEnergyDetailView extends StatelessWidget {
body: BlocBuilder<EnergyCubit, EnergyState>( body: BlocBuilder<EnergyCubit, EnergyState>(
builder: (context, state) { builder: (context, state) {
if (state.isLoading) { if (state.isLoading) {
return const Center(child: CircularProgressIndicator()); return const Center(child: CircularProgressIndicator(color: Color.fromRGBO(66, 165, 245, 1.0)));
} }
if (state.error != null) { if (state.error != null) {
return Center( return Center(
......
...@@ -51,9 +51,10 @@ class _ReportIndexViewState extends State<ReportIndexView> with AutoRouteAwareSt ...@@ -51,9 +51,10 @@ class _ReportIndexViewState extends State<ReportIndexView> with AutoRouteAwareSt
if (state.isLoading) { if (state.isLoading) {
return Container( return Container(
color: const Color.fromRGBO(242, 243, 245, 1), color: const Color.fromRGBO(242, 243, 245, 1),
child: const Center(child: CircularProgressIndicator()), child: const Center(child: CircularProgressIndicator(color: Color.fromRGBO(66, 165, 245, 1.0))),
); );
} }
if (state.error != null) { if (state.error != null) {
return Container( return Container(
color: const Color.fromRGBO(242, 243, 245, 1), color: const Color.fromRGBO(242, 243, 245, 1),
...@@ -79,6 +80,7 @@ class _ReportIndexViewState extends State<ReportIndexView> with AutoRouteAwareSt ...@@ -79,6 +80,7 @@ class _ReportIndexViewState extends State<ReportIndexView> with AutoRouteAwareSt
), ),
); );
} }
return LayoutBuilder( return LayoutBuilder(
builder: (context, constraints) { builder: (context, constraints) {
return SingleChildScrollView( return SingleChildScrollView(
...@@ -89,31 +91,16 @@ class _ReportIndexViewState extends State<ReportIndexView> with AutoRouteAwareSt ...@@ -89,31 +91,16 @@ class _ReportIndexViewState extends State<ReportIndexView> with AutoRouteAwareSt
child: Container( child: Container(
width: double.infinity, width: double.infinity,
color: const Color.fromRGBO(242, 243, 245, 1), color: const Color.fromRGBO(242, 243, 245, 1),
padding: EdgeInsets.only( padding: EdgeInsets.only(left: 28.w, right: 28.w, bottom: 15.h),
left: 28.w,
right: 28.w,
top: ScreenUtil().statusBarHeight),
child: Column( child: Column(
spacing: 15.h,
children: [ children: [
ReportHeaderBlock( const ReportHeaderBlock(),
reportHeader: state.reportHeader), ReportMetricsBlock(reportMetrics: state.reportMetrics),
SizedBox(height: 10.h), WeeklyPowerChart(weeklyPowerUsage: state.weeklyPowerUsage),
ReportMetricsBlock( RoomStatusDistribution(roomStatusDistribution: state.roomStatusDistribution),
reportMetrics: state.reportMetrics), DeviceOnlineRate(deviceOnlineRate: state.deviceOnlineRate),
SizedBox(height: 10.h), QuickActionsBlock(quickActions: state.quickActions),
WeeklyPowerChart(
weeklyPowerUsage: state.weeklyPowerUsage),
SizedBox(height: 10.h),
RoomStatusDistribution(
roomStatusDistribution:
state.roomStatusDistribution),
SizedBox(height: 10.h),
DeviceOnlineRate(
deviceOnlineRate: state.deviceOnlineRate),
SizedBox(height: 10.h),
QuickActionsBlock(
quickActions: state.quickActions),
SizedBox(height: 10.h),
], ],
), ),
), ),
......
...@@ -2,23 +2,39 @@ import 'package:flutter/material.dart'; ...@@ -2,23 +2,39 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
class ReportHeaderBlock extends StatelessWidget { class ReportHeaderBlock extends StatelessWidget {
final Map<String, dynamic> reportHeader; const ReportHeaderBlock({super.key});
const ReportHeaderBlock({super.key, required this.reportHeader});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Stack(
width: double.infinity, clipBehavior: Clip.none,
padding: EdgeInsets.symmetric(horizontal: 0.w, vertical: 16.h), children: [
child: Text( Positioned(
reportHeader['title'] as String, left: -28.w,
right: -28.w,
top: 0,
child: Container(
height: 150.h,
color: Colors.white,
),
),
Container(
height: 150.h,
padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight),
child: Row(
children: [
Text(
'经营概览看板',
style: TextStyle( style: TextStyle(
fontSize: 36.sp, fontSize: 32.sp,
fontWeight: FontWeight.w500, fontWeight: FontWeight.bold,
color: const Color.fromRGBO(71, 71, 71, 1), color: const Color.fromRGBO(0, 0, 0, 1),
),
),
],
), ),
), ),
],
); );
} }
} }
\ No newline at end of file
...@@ -43,7 +43,7 @@ class ReportRoomDetailView extends StatelessWidget { ...@@ -43,7 +43,7 @@ class ReportRoomDetailView extends StatelessWidget {
), ),
centerTitle: true, centerTitle: true,
), ),
body: const Center(child: CircularProgressIndicator()), body: const Center(child: CircularProgressIndicator(color: Color.fromRGBO(66, 165, 245, 1.0))),
); );
} }
...@@ -126,7 +126,7 @@ class ReportRoomDetailView extends StatelessWidget { ...@@ -126,7 +126,7 @@ class ReportRoomDetailView extends StatelessWidget {
if (state.isLoading) if (state.isLoading)
const Padding( const Padding(
padding: EdgeInsets.all(16.0), padding: EdgeInsets.all(16.0),
child: Center(child: CircularProgressIndicator()), child: Center(child: CircularProgressIndicator(color: const Color.fromRGBO(66, 165, 245, 1.0))),
), ),
...state.detailRooms.map((room) { ...state.detailRooms.map((room) {
return Padding( return Padding(
......
...@@ -44,7 +44,7 @@ class ServiceDeviceDetailView extends StatelessWidget { ...@@ -44,7 +44,7 @@ class ServiceDeviceDetailView extends StatelessWidget {
builder: (context, state) { builder: (context, state) {
final cubit = context.read<ServiceDeviceCubit>(); final cubit = context.read<ServiceDeviceCubit>();
if (state.isLoading) { if (state.isLoading) {
return const Center(child: CircularProgressIndicator()); return const Center(child: CircularProgressIndicator(color: Color.fromRGBO(66, 165, 245, 1.0)));
} }
if (state.error != null) { if (state.error != null) {
return Center( return Center(
...@@ -68,10 +68,15 @@ class ServiceDeviceDetailView extends StatelessWidget { ...@@ -68,10 +68,15 @@ class ServiceDeviceDetailView extends StatelessWidget {
); );
} }
return SingleChildScrollView( return SingleChildScrollView(
padding: EdgeInsets.symmetric(horizontal: 28.w), padding: EdgeInsets.symmetric(horizontal: 28.w, vertical: 20.h),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 28.w, vertical: 40.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(24.r),
),
child: Column( child: Column(
children: [ children: [
SizedBox(height: 20.h),
TemperatureControlBlock( TemperatureControlBlock(
isOn: state.isOn, isOn: state.isOn,
targetTemperature: state.targetTemperature, targetTemperature: state.targetTemperature,
...@@ -93,9 +98,9 @@ class ServiceDeviceDetailView extends StatelessWidget { ...@@ -93,9 +98,9 @@ class ServiceDeviceDetailView extends StatelessWidget {
speedOptions: state.speedOptions, speedOptions: state.speedOptions,
onSetWindSpeed: cubit.setWindSpeed, onSetWindSpeed: cubit.setWindSpeed,
), ),
SizedBox(height: 20.h),
], ],
), ),
),
); );
}, },
), ),
......
...@@ -67,7 +67,7 @@ class _ModeSelectionBlockState extends State<ModeSelectionBlock> { ...@@ -67,7 +67,7 @@ class _ModeSelectionBlockState extends State<ModeSelectionBlock> {
Text( Text(
mode['name'] as String, mode['name'] as String,
style: TextStyle( style: TextStyle(
fontSize: 22.sp, fontSize: 24.sp,
color: isSelected color: isSelected
? Colors.white ? Colors.white
: const Color.fromRGBO(107, 114, 128, 1), : const Color.fromRGBO(107, 114, 128, 1),
......
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:flutter_switch/flutter_switch.dart';
import 'dart:math' as math; import 'dart:math' as math;
class TemperatureControlBlock extends StatefulWidget { class TemperatureControlBlock extends StatefulWidget {
...@@ -29,83 +30,37 @@ class TemperatureControlBlock extends StatefulWidget { ...@@ -29,83 +30,37 @@ class TemperatureControlBlock extends StatefulWidget {
_TemperatureControlBlockState(); _TemperatureControlBlockState();
} }
class _TemperatureControlBlockState extends State<TemperatureControlBlock> class _TemperatureControlBlockState extends State<TemperatureControlBlock> {
with SingleTickerProviderStateMixin {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final progress = (widget.targetTemperature - widget.minTemperature) / final progress = (widget.targetTemperature - widget.minTemperature) /
(widget.maxTemperature - widget.minTemperature); (widget.maxTemperature - widget.minTemperature);
return Container( return Column(
width: double.infinity,
padding: EdgeInsets.symmetric(vertical: 20.w),
child: Column(
children: [ children: [
Align( Row(
alignment: Alignment.centerRight, mainAxisAlignment: MainAxisAlignment.end,
child: Padding( children: [
padding: EdgeInsets.only(right: 20.w), FlutterSwitch(
child: _buildPowerSwitch(), width: 80.w,
), height: 35.h,
valueFontSize: 20.sp,
toggleSize: 25.h,
borderRadius: 20.r,
padding: 4.w,
value: widget.isOn,
activeColor: const Color.fromRGBO(80, 162, 255, 1),
inactiveColor: const Color.fromRGBO(210, 213, 218, 1),
onToggle: widget.onTogglePower,
),
SizedBox(width: 20.w),
],
), ),
SizedBox(height: 20.h), SizedBox(height: 20.h),
_buildCircularTemperatureControl(progress), _buildCircularTemperatureControl(progress),
SizedBox(height: 40.h), SizedBox(height: 40.h),
_buildControlButtons(), _buildControlButtons(),
], ],
),
);
}
Widget _buildPowerSwitch() {
return GestureDetector(
onTap: () => widget.onTogglePower(!widget.isOn),
child: Container(
width: 88.w,
height: 48.h,
decoration: BoxDecoration(
gradient: widget.isOn
? const LinearGradient(
colors: [
Color.fromRGBO(96, 165, 250, 1),
Color.fromRGBO(59, 130, 246, 1),
],
)
: const LinearGradient(
colors: [
Color.fromRGBO(209, 213, 219, 1),
Color.fromRGBO(156, 163, 175, 1),
],
),
borderRadius: BorderRadius.circular(24.r),
),
child: Stack(
children: [
AnimatedAlign(
duration: const Duration(milliseconds: 200),
alignment: widget.isOn ? Alignment.centerRight : Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 4.w),
child: Container(
width: 40.w,
height: 40.h,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 4,
offset: const Offset(0, 2),
),
],
),
),
),
),
],
),
),
); );
} }
...@@ -138,40 +93,38 @@ class _TemperatureControlBlockState extends State<TemperatureControlBlock> ...@@ -138,40 +93,38 @@ class _TemperatureControlBlockState extends State<TemperatureControlBlock>
Text( Text(
'${widget.targetTemperature}', '${widget.targetTemperature}',
style: TextStyle( style: TextStyle(
fontSize: 100.sp, fontSize: 68.sp,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: widget.isOn color: widget.isOn
? const Color.fromRGBO(37, 99, 235, 1) ? const Color.fromRGBO(35, 89, 245, 1)
: const Color.fromRGBO(209, 213, 219, 1), : const Color.fromRGBO(209, 213, 219, 1),
), ),
), ),
SizedBox(height: 8.h),
Text( Text(
'°C', '°C',
style: TextStyle( style: TextStyle(
fontSize: 48.sp, fontSize: 36.sp,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: widget.isOn color: widget.isOn
? const Color.fromRGBO(59, 130, 246, 1) ? const Color.fromRGBO(35, 89, 245, 1)
: const Color.fromRGBO(209, 213, 219, 1), : const Color.fromRGBO(209, 213, 219, 1),
), ),
), ),
SizedBox(height: 20.h),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text( Text(
'当前室温 ', '当前室温 ',
style: TextStyle( style: TextStyle(
fontSize: 28.sp, fontSize: 24.sp,
color: const Color.fromRGBO(156, 163, 175, 1), color: const Color.fromRGBO(100, 116, 139, 1),
), ),
), ),
Text( Text(
'${widget.currentTemperature}°C', '${widget.currentTemperature}°C',
style: TextStyle( style: TextStyle(
fontSize: 28.sp, fontSize: 24.sp,
color: const Color.fromRGBO(107, 114, 128, 1), color: const Color.fromRGBO(100, 116, 139, 1),
), ),
), ),
], ],
...@@ -186,14 +139,14 @@ class _TemperatureControlBlockState extends State<TemperatureControlBlock> ...@@ -186,14 +139,14 @@ class _TemperatureControlBlockState extends State<TemperatureControlBlock>
child: Container( child: Container(
width: 64.w, width: 64.w,
height: 64.w, height: 64.w,
decoration: BoxDecoration( decoration: const BoxDecoration(
color: const Color.fromRGBO(37, 99, 235, 1), color: Color.fromRGBO(37, 99, 235, 1),
shape: BoxShape.circle, shape: BoxShape.circle,
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: const Color.fromRGBO(37, 99, 235, 0.3), color: Color.fromRGBO(37, 99, 235, 0.3),
blurRadius: 10, blurRadius: 10,
offset: const Offset(0, 4), offset: Offset(0, 4),
), ),
], ],
), ),
...@@ -217,44 +170,43 @@ class _TemperatureControlBlockState extends State<TemperatureControlBlock> ...@@ -217,44 +170,43 @@ class _TemperatureControlBlockState extends State<TemperatureControlBlock>
Widget _buildControlButtons() { Widget _buildControlButtons() {
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
spacing: 40.w,
children: [ children: [
GestureDetector( GestureDetector(
onTap: widget.onDecreaseTemperature, onTap: widget.onDecreaseTemperature,
child: Container( child: Container(
width: 140.w, width: 102.w,
height: 120.h, height: 82.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(229, 231, 235, 1), color: const Color.fromRGBO(224, 227, 232, 1),
borderRadius: BorderRadius.circular(40.r), borderRadius: BorderRadius.circular(26.r),
), ),
child: Icon( child: Icon(
Icons.remove, Icons.remove,
size: 48.sp, size: 70.sp,
color: const Color.fromRGBO(107, 114, 128, 1), color: const Color.fromRGBO(107, 114, 128, 1),
), ),
), ),
), ),
SizedBox(width: 40.w),
Text( Text(
'温度调节', '温度调节',
style: TextStyle( style: TextStyle(
fontSize: 32.sp, fontSize: 32.sp,
color: const Color.fromRGBO(107, 114, 128, 1), color: const Color.fromRGBO(100, 116, 139, 1),
), ),
), ),
SizedBox(width: 40.w),
GestureDetector( GestureDetector(
onTap: widget.onIncreaseTemperature, onTap: widget.onIncreaseTemperature,
child: Container( child: Container(
width: 140.w, width: 102.w,
height: 120.h, height: 82.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(229, 231, 235, 1), color: const Color.fromRGBO(224, 227, 232, 1),
borderRadius: BorderRadius.circular(40.r), borderRadius: BorderRadius.circular(26.r),
), ),
child: Icon( child: Icon(
Icons.add, Icons.add,
size: 48.sp, size: 70.sp,
color: const Color.fromRGBO(107, 114, 128, 1), color: const Color.fromRGBO(107, 114, 128, 1),
), ),
), ),
......
...@@ -58,7 +58,7 @@ class _WindSpeedBlockState extends State<WindSpeedBlock> { ...@@ -58,7 +58,7 @@ class _WindSpeedBlockState extends State<WindSpeedBlock> {
child: Text( child: Text(
speed, speed,
style: TextStyle( style: TextStyle(
fontSize: 22.sp, fontSize: 24.sp,
color: isSelected color: isSelected
? Colors.white ? Colors.white
: const Color.fromRGBO(107, 114, 128, 1), : const Color.fromRGBO(107, 114, 128, 1),
......
...@@ -89,10 +89,7 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> { ...@@ -89,10 +89,7 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> {
} }
/// 加载房间状态列表 /// 加载房间状态列表
Future<void> loadRooms({ Future<void> loadRooms({int? floorId, String? areaType}) async {
int? floorId,
String? areaType,
}) async {
emit(state.copyWith(isLoading: true, error: null)); emit(state.copyWith(isLoading: true, error: null));
try { try {
final roomStatuses = await _roomService.getRoomStatus( final roomStatuses = await _roomService.getRoomStatus(
...@@ -151,7 +148,11 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> { ...@@ -151,7 +148,11 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> {
'roomId': rs.roomId, 'roomId': rs.roomId,
'number': rs.roomNumber, 'number': rs.roomNumber,
'status': displayStatus, 'status': displayStatus,
'type': '客房', // 默认类型,后续可通过楼层areas信息扩展 'type': '客房',
'occupancyStatus': rs.occupancyStatus, // 0=无人 1=有人
'roomStatus': rs.roomStatus, // 0=无人 1=有人
'cleanStatus': rs.cleanStatus, // 0=待清洁 2=已完成
'devicePowerStatus': rs.devicePowerStatus, // 0=关 1=开
}; };
} }
...@@ -183,15 +184,8 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> { ...@@ -183,15 +184,8 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> {
} }
} }
void selectType(String? type) {
emit(state.copyWith(selectedType: type));
}
/// 加载非客房-相关楼层区域设备 /// 加载非客房-相关楼层区域设备
Future<void> loadAreaDevices({ Future<void> loadAreaDevices({required int floorId, required String areaType}) async {
required int floorId,
required String areaType,
}) async {
emit(state.copyWith(isLoadingAreaDevices: true, error: null)); emit(state.copyWith(isLoadingAreaDevices: true, error: null));
try { try {
final devices = await _roomService.getAreaDevices( final devices = await _roomService.getAreaDevices(
...@@ -210,8 +204,103 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> { ...@@ -210,8 +204,103 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> {
} }
} }
void selectRoom(String? room) { /// 选择房间
emit(state.copyWith(selectedRoom: room)); void selectRoom({String? room, int? roomId}) {
emit(state.copyWith(selectedRoom: room, selectedRoomId: roomId));
}
/// UI 层切换楼层(含取消选中、重置类型/房间/搜索、加载房间数据)
void toggleFloor(String floorName, int floorId) {
final isSameFloor = state.selectedFloor == floorName;
final newFloor = isSameFloor ? null : floorName;
// 计算新楼层的 areas
List<String> areas = state.areas;
if (newFloor != null) {
final matched = _floorAreasCache.where(
(f) => f.floorId.toString() == newFloor,
);
areas = matched.isNotEmpty ? matched.first.areas : <String>[];
}
emit(state.copyWith(
selectedFloor: newFloor,
selectedType: null,
selectedRoom: null,
selectedRoomId: null,
searchText: '',
areas: areas,
));
if (newFloor != null) {
loadRooms(floorId: floorId);
}
}
/// UI 层切换区域类型(含取消选中、重置房间、加载非客房设备)
void toggleType(String type) {
final newType = state.selectedType != type ? type : null;
emit(state.copyWith(
selectedType: newType,
selectedRoom: null,
selectedRoomId: null,
));
if (newType != null && newType != '客房') {
_loadAreaDevicesForCurrentFloor(newType);
}
}
/// 获取当前筛选条件下的房间列表
List<Map<String, dynamic>> getFilteredRooms() {
List<Map<String, dynamic>> allRooms;
if (state.selectedFloor == null) {
allRooms = [];
for (final floorMap in (state.floors ?? [])) {
final floorName = floorMap.values.first;
allRooms.addAll(getRoomsByFloor(floorName));
}
} else {
allRooms = getRoomsByFloor(state.selectedFloor!);
}
if (state.selectedType != null) {
allRooms =
allRooms.where((room) => room['type'] == state.selectedType).toList();
}
if (state.searchText.isEmpty) {
return allRooms;
}
return allRooms
.where((room) => (room['number'] as String)
.toLowerCase()
.contains(state.searchText.toLowerCase()))
.toList();
}
/// 获取当前选中房间的完整数据
Map<String, dynamic>? getSelectedRoomDetail() {
if (state.selectedRoom == null) return null;
return _findRoomByNumber(state.selectedRoom!);
}
/// 根据楼层标签获取楼层 ID
int? getFloorIdByLabel(String floorLabel) {
for (final floorMap in (state.floors ?? [])) {
if (floorMap.values.first == floorLabel) {
return floorMap.keys.first;
}
}
return null;
}
/// 根据当前选中楼层加载非客房区域设备
void _loadAreaDevicesForCurrentFloor(String areaType) {
if (state.selectedFloor == null) return;
final floorId = getFloorIdByLabel(state.selectedFloor!);
if (floorId == null) return;
loadAreaDevices(floorId: floorId, areaType: areaType);
} }
void setSearchText(String text) { void setSearchText(String text) {
...@@ -261,4 +350,10 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> { ...@@ -261,4 +350,10 @@ class ServiceIndexCubit extends Cubit<ServiceIndexState> {
} }
return null; return null;
} }
@override
Future<void> close() {
return super.close();
}
} }
...@@ -2,15 +2,18 @@ import 'package:equatable/equatable.dart'; ...@@ -2,15 +2,18 @@ import 'package:equatable/equatable.dart';
import 'package:smart_hotel_app/models/bo/room_bo.dart'; import 'package:smart_hotel_app/models/bo/room_bo.dart';
class ServiceIndexState extends Equatable { class ServiceIndexState extends Equatable {
/// copyWith sentinel: 区分「未传参」和「显式传 null」
static const _nothing = Object();
final int pendingCount; final int pendingCount;
final int occupiedRooms; final int occupiedRooms;
final int vacantRooms; final int vacantRooms;
// final List<String> floors;
final List<Map<int,String>>? floors; final List<Map<int,String>>? floors;
final List<String> areas; final List<String> areas;
final String? selectedFloor; final String? selectedFloor;
final String? selectedType; final String? selectedType;
final String? selectedRoom; final String? selectedRoom;
final int? selectedRoomId;
final String searchText; final String searchText;
final List<Map<String, dynamic>> rooms; final List<Map<String, dynamic>> rooms;
final List<AreaDeviceBO> areaDevices; final List<AreaDeviceBO> areaDevices;
...@@ -29,6 +32,7 @@ class ServiceIndexState extends Equatable { ...@@ -29,6 +32,7 @@ class ServiceIndexState extends Equatable {
this.selectedFloor, this.selectedFloor,
this.selectedType, this.selectedType,
this.selectedRoom, this.selectedRoom,
this.selectedRoomId,
this.searchText = '', this.searchText = '',
this.rooms = const [], this.rooms = const [],
this.areaDevices = const [], this.areaDevices = const [],
...@@ -43,18 +47,18 @@ class ServiceIndexState extends Equatable { ...@@ -43,18 +47,18 @@ class ServiceIndexState extends Equatable {
int? pendingCount, int? pendingCount,
int? occupiedRooms, int? occupiedRooms,
int? vacantRooms, int? vacantRooms,
// List<String>? floors,
List<Map<int,String>>? floors, List<Map<int,String>>? floors,
List<String>? areas, List<String>? areas,
String? selectedFloor, Object? selectedFloor = _nothing,
String? selectedType, Object? selectedType = _nothing,
String? selectedRoom, Object? selectedRoom = _nothing,
Object? selectedRoomId = _nothing,
String? searchText, String? searchText,
List<Map<String, dynamic>>? rooms, List<Map<String, dynamic>>? rooms,
List<AreaDeviceBO>? areaDevices, List<AreaDeviceBO>? areaDevices,
bool? isLoading, bool? isLoading,
bool? isLoadingAreaDevices, bool? isLoadingAreaDevices,
String? error, Object? error = _nothing,
bool? isPoweringOn, bool? isPoweringOn,
bool? isPoweringOff, bool? isPoweringOff,
}) { }) {
...@@ -64,15 +68,16 @@ class ServiceIndexState extends Equatable { ...@@ -64,15 +68,16 @@ class ServiceIndexState extends Equatable {
vacantRooms: vacantRooms ?? this.vacantRooms, vacantRooms: vacantRooms ?? this.vacantRooms,
floors: floors ?? this.floors, floors: floors ?? this.floors,
areas: areas ?? this.areas, areas: areas ?? this.areas,
selectedFloor: selectedFloor ?? this.selectedFloor, selectedFloor: identical(selectedFloor, _nothing) ? this.selectedFloor : selectedFloor as String?,
selectedType: selectedType ?? this.selectedType, selectedType: identical(selectedType, _nothing) ? this.selectedType : selectedType as String?,
selectedRoom: selectedRoom ?? this.selectedRoom, selectedRoom: identical(selectedRoom, _nothing) ? this.selectedRoom : selectedRoom as String?,
selectedRoomId: identical(selectedRoomId, _nothing) ? this.selectedRoomId : selectedRoomId as int?,
searchText: searchText ?? this.searchText, searchText: searchText ?? this.searchText,
rooms: rooms ?? this.rooms, rooms: rooms ?? this.rooms,
areaDevices: areaDevices ?? this.areaDevices, areaDevices: areaDevices ?? this.areaDevices,
isLoading: isLoading ?? this.isLoading, isLoading: isLoading ?? this.isLoading,
isLoadingAreaDevices: isLoadingAreaDevices ?? this.isLoadingAreaDevices, isLoadingAreaDevices: isLoadingAreaDevices ?? this.isLoadingAreaDevices,
error: error ?? this.error, error: identical(error, _nothing) ? this.error : error as String?,
isPoweringOn: isPoweringOn ?? this.isPoweringOn, isPoweringOn: isPoweringOn ?? this.isPoweringOn,
isPoweringOff: isPoweringOff ?? this.isPoweringOff, isPoweringOff: isPoweringOff ?? this.isPoweringOff,
); );
...@@ -88,6 +93,7 @@ class ServiceIndexState extends Equatable { ...@@ -88,6 +93,7 @@ class ServiceIndexState extends Equatable {
selectedFloor, selectedFloor,
selectedType, selectedType,
selectedRoom, selectedRoom,
selectedRoomId,
searchText, searchText,
rooms, rooms,
areaDevices, areaDevices,
......
...@@ -64,7 +64,7 @@ class _ServiceIndexViewState extends State<ServiceIndexView> with AutoRouteAware ...@@ -64,7 +64,7 @@ class _ServiceIndexViewState extends State<ServiceIndexView> with AutoRouteAware
occupiedCount: state.occupiedRooms, occupiedCount: state.occupiedRooms,
vacantCount: state.vacantRooms, vacantCount: state.vacantRooms,
), ),
RoomManagementBlock(), const RoomManagementBlock(),
SizedBox(height: 18.h), SizedBox(height: 18.h),
], ],
); );
......
...@@ -50,7 +50,7 @@ class AreaDeviceList extends StatelessWidget { ...@@ -50,7 +50,7 @@ class AreaDeviceList extends StatelessWidget {
return const Center( return const Center(
child: Padding( child: Padding(
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),
child: CircularProgressIndicator(), child: CircularProgressIndicator(color: const Color.fromRGBO(66, 165, 245, 1.0)),
), ),
); );
} }
......
...@@ -6,7 +6,6 @@ class ServiceHeadBlock extends StatelessWidget { ...@@ -6,7 +6,6 @@ class ServiceHeadBlock extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
return Stack( return Stack(
clipBehavior: Clip.none, clipBehavior: Clip.none,
children: [ children: [
...@@ -21,7 +20,7 @@ class ServiceHeadBlock extends StatelessWidget { ...@@ -21,7 +20,7 @@ class ServiceHeadBlock extends StatelessWidget {
), ),
Container( Container(
height: 150.h, height: 150.h,
padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight, left: 20.w, right: 20.w), padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
...@@ -31,26 +30,31 @@ class ServiceHeadBlock extends StatelessWidget { ...@@ -31,26 +30,31 @@ class ServiceHeadBlock extends StatelessWidget {
fontSize: 32.sp, fontSize: 32.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: const Color.fromRGBO(0, 0, 0, 1), color: const Color.fromRGBO(0, 0, 0, 1),
fontFamily: 'FZLTXH',
), ),
), ),
Container( Container(
width: 64.w, width: 64.w,
height: 64.w, height: 64.h,
alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(229, 241, 255, 1),
shape: BoxShape.circle, shape: BoxShape.circle,
border: Border.all( border: Border.all(
color: const Color.fromRGBO(73, 149, 234, 1), color: const Color.fromRGBO(73, 149, 234, 1),
width: 1.w, width: 2.w,
), ),
), ),
child: CircleAvatar( child: Container(
radius: 40.w, width: 40.w,
backgroundColor: Colors.white, height: 40.h,
decoration: const BoxDecoration(
color: Color.fromRGBO(73, 149, 234, 1),
shape: BoxShape.circle,
),
child: Icon( child: Icon(
Icons.person, Icons.person,
color: const Color.fromRGBO(73, 149, 234, 1), color: Colors.white,
size: 48.sp, size: 28.sp,
), ),
), ),
), ),
...@@ -60,4 +64,5 @@ class ServiceHeadBlock extends StatelessWidget { ...@@ -60,4 +64,5 @@ class ServiceHeadBlock extends StatelessWidget {
], ],
); );
} }
} }
...@@ -18,64 +18,40 @@ class ServiceStatsBlock extends StatelessWidget { ...@@ -18,64 +18,40 @@ class ServiceStatsBlock extends StatelessWidget {
return Container( return Container(
width: double.infinity, width: double.infinity,
padding: EdgeInsets.only(top: 20.w, bottom: 20.w), padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
decoration: BoxDecoration( child: Row(
// borderRadius: BorderRadius.circular(24.r), spacing: 12.w,
color: Color.fromRGBO(242, 243, 245, 1.0),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Text(
// '服务概览',
// style: TextStyle(
// fontSize: 28.sp,
// fontWeight: FontWeight.bold,
// color: const Color.fromRGBO(31, 41, 55, 1),
// ),
// ),
// SizedBox(height: 20.h),
Row(
children: [ children: [
_buildStatCard( _buildStatCard(
'待响应需求', '待响应',
'$pendingCount', '$pendingCount',
const Color.fromRGBO(239, 68, 68, 1), const Color.fromRGBO(73, 149, 234, 1),
Icons.warning_amber_rounded,
), ),
SizedBox(width: 12.w),
_buildStatCard( _buildStatCard(
'入住中', '入住中',
'$occupiedCount', '$occupiedCount',
const Color.fromRGBO(34, 197, 94, 1), const Color.fromRGBO(20, 184, 166, 1),
Icons.meeting_room_outlined,
), ),
SizedBox(width: 12.w),
_buildStatCard( _buildStatCard(
'空闲可清洁', '空闲可清洁',
'$vacantCount', '$vacantCount',
const Color.fromRGBO(59, 130, 246, 1), const Color.fromRGBO(10, 13, 20, 1),
Icons.cleaning_services_outlined,
),
],
), ),
], ],
), ),
); );
} }
Widget _buildStatCard( Widget _buildStatCard(String label, String value, Color color) {
String label, String value, Color color, IconData icon) {
return Expanded( return Expanded(
child: Container( child: Container(
padding: EdgeInsets.all(16.w), padding: EdgeInsets.symmetric(vertical: 16.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: color.withOpacity(0.08), color: Colors.white,
borderRadius: BorderRadius.circular(16.r), borderRadius: BorderRadius.circular(24.r),
), ),
child: Column( child: Column(
spacing: 5.h,
children: [ children: [
// Icon(icon, color: color, size: 28.sp),
SizedBox(height: 8.h),
Text( Text(
value, value,
style: TextStyle( style: TextStyle(
...@@ -84,12 +60,11 @@ class ServiceStatsBlock extends StatelessWidget { ...@@ -84,12 +60,11 @@ class ServiceStatsBlock extends StatelessWidget {
color: color, color: color,
), ),
), ),
SizedBox(height: 4.h),
Text( Text(
label, label,
style: TextStyle( style: TextStyle(
fontSize: 24.sp, fontSize: 24.sp,
color: const Color.fromRGBO(107, 114, 128, 1), color: const Color.fromRGBO(100, 116, 139, 1),
), ),
), ),
], ],
......
...@@ -55,7 +55,7 @@ class ServiceRoomDetailView extends StatelessWidget { ...@@ -55,7 +55,7 @@ class ServiceRoomDetailView extends StatelessWidget {
builder: (context, state) { builder: (context, state) {
if (state.isLoading) { if (state.isLoading) {
return const Center( return const Center(
child: CircularProgressIndicator(), child: CircularProgressIndicator(color: const Color.fromRGBO(66, 165, 245, 1.0)),
); );
} }
...@@ -117,7 +117,7 @@ class ServiceRoomDetailView extends StatelessWidget { ...@@ -117,7 +117,7 @@ class ServiceRoomDetailView extends StatelessWidget {
onDeviceToggle: (index, value) => onDeviceToggle: (index, value) =>
cubit.toggleControlDevice(index, value), cubit.toggleControlDevice(index, value),
onDeviceTap: (index, device) { onDeviceTap: (index, device) {
if (device.name == '空调' || device.name?.contains('空调') == true) { if (device.name.contains('空调')) {
context.pushRoute(ServiceDeviceDetailRoute(deviceId: device.deviceId)); context.pushRoute(ServiceDeviceDetailRoute(deviceId: device.deviceId));
} }
}, },
......
...@@ -49,7 +49,7 @@ class DeviceControlCard extends StatelessWidget { ...@@ -49,7 +49,7 @@ class DeviceControlCard extends StatelessWidget {
color: const Color.fromRGBO(10, 13, 20, 1.0), color: const Color.fromRGBO(10, 13, 20, 1.0),
), ),
), ),
SizedBox(height: 20.h), SizedBox(height: 30.h),
...controlDevices.asMap().entries.map((entry) { ...controlDevices.asMap().entries.map((entry) {
final index = entry.key; final index = entry.key;
final device = entry.value; final device = entry.value;
...@@ -71,10 +71,11 @@ class DeviceControlCard extends StatelessWidget { ...@@ -71,10 +71,11 @@ class DeviceControlCard extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Row( Row(
spacing: 16.w,
children: [ children: [
Container( Container(
width: 64.w, width: 64.w,
height: 64.h, height: 53.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(235, 244, 255, 1.0), color: const Color.fromRGBO(235, 244, 255, 1.0),
borderRadius: BorderRadius.circular(12.r), borderRadius: BorderRadius.circular(12.r),
...@@ -85,7 +86,6 @@ class DeviceControlCard extends StatelessWidget { ...@@ -85,7 +86,6 @@ class DeviceControlCard extends StatelessWidget {
size: 36.sp, size: 36.sp,
), ),
), ),
SizedBox(width: 16.w),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
...@@ -109,27 +109,24 @@ class DeviceControlCard extends StatelessWidget { ...@@ -109,27 +109,24 @@ class DeviceControlCard extends StatelessWidget {
], ],
), ),
FlutterSwitch( FlutterSwitch(
width: 48.0, width: 80.w,
height: 25.0, height: 35.h,
valueFontSize: 20.sp,
toggleSize: 25.h,
borderRadius: 20.r,
padding: 4.w,
value: mainPowerOn, value: mainPowerOn,
showOnOff: false, activeColor: const Color.fromRGBO(80, 162, 255, 1),
onToggle: onMainPowerToggle inactiveColor: const Color.fromRGBO(210, 213, 218, 1),
), onToggle: onMainPowerToggle,
// FlutterSwitch( ),
// value: mainPowerOn,
// onToggle: onMainPowerToggle,
// activeColor: const Color.fromRGBO(59, 130, 246, 1),
// inactiveColor: const Color.fromRGBO(209, 213, 219, 1),
// width: 50.w,
// height: 28.h,
// // toggleSize: 26,
// ),
], ],
), ),
SizedBox(height: 20.h), SizedBox(height: 30.h),
Divider( Divider(
color: const Color.fromRGBO(242, 243, 245, 1.0), height: 0.5.h,
thickness: 1.h, color: const Color.fromRGBO(100, 116, 139, 0.2),
thickness: 0.5,
), ),
], ],
); );
...@@ -147,10 +144,7 @@ class DeviceControlCard extends StatelessWidget { ...@@ -147,10 +144,7 @@ class DeviceControlCard extends StatelessWidget {
color: Colors.transparent, color: Colors.transparent,
child: InkWell( child: InkWell(
onTap: onDeviceTap != null ? () => onDeviceTap!(index, device) : null, onTap: onDeviceTap != null ? () => onDeviceTap!(index, device) : null,
child: Column( child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [ children: [
Icon( Icon(
device.icon, device.icon,
...@@ -168,44 +162,29 @@ class DeviceControlCard extends StatelessWidget { ...@@ -168,44 +162,29 @@ class DeviceControlCard extends StatelessWidget {
), ),
], ],
), ),
if (device.detailText != null) ...[
SizedBox(height: 8.h),
Text(
device.detailText!,
style: TextStyle(
fontSize: 24.sp,
color: const Color.fromRGBO(100, 116, 139, 1.0),
),
),
],
],
),
), ),
), ),
), ),
FlutterSwitch( FlutterSwitch(
width: 48.0, width: 80.w,
height: 25.0, height: 35.h,
valueFontSize: 20.sp,
toggleSize: 25.h,
borderRadius: 20.r,
padding: 4.w,
value: device.isOn, value: device.isOn,
showOnOff: false, activeColor: const Color.fromRGBO(80, 162, 255, 1),
inactiveColor: const Color.fromRGBO(210, 213, 218, 1),
onToggle: (value) => onDeviceToggle(index, value), onToggle: (value) => onDeviceToggle(index, value),
), ),
// FlutterSwitch(
// value: device.isOn,
// onToggle: (value) => onDeviceToggle(index, value),
// activeColor: const Color.fromRGBO(66, 165, 245, 1.0),
// inactiveColor: const Color.fromRGBO(200, 208, 220, 1.0),
// width: 60.w,
// height: 30.h,
// toggleSize: 26,
// ),
], ],
), ),
if (index < controlDevices.length - 1) ...[ if (index < controlDevices.length - 1) ...[
SizedBox(height: 20.h), SizedBox(height: 30.h),
Divider( Divider(
color: const Color.fromRGBO(242, 243, 245, 1.0), height: 0.5.h,
thickness: 1.h, color: const Color.fromRGBO(100, 116, 139, 0.2),
thickness: 0.5,
), ),
], ],
], ],
......
...@@ -4,59 +4,59 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; ...@@ -4,59 +4,59 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
class RoomBottomButtons extends StatelessWidget { class RoomBottomButtons extends StatelessWidget {
final VoidCallback? onPowerOn; final VoidCallback? onPowerOn;
final VoidCallback? onPowerOff; final VoidCallback? onPowerOff;
final VoidCallback? onDeviceControl; // final VoidCallback? onDeviceControl;
final bool isProcessing; final bool isProcessing;
const RoomBottomButtons({ const RoomBottomButtons({
super.key, super.key,
this.onPowerOn, this.onPowerOn,
this.onPowerOff, this.onPowerOff,
this.onDeviceControl, // this.onDeviceControl,
this.isProcessing = false, this.isProcessing = false,
}); });
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return Row(
spacing: 12.w,
children: [ children: [
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
onTap: (onPowerOn != null && !isProcessing) ? onPowerOn : null, onTap: (onPowerOn != null && !isProcessing) ? onPowerOn : null,
child: Container( child: Container(
height: 88.h, height: 70.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: (onPowerOn != null && !isProcessing) color: (onPowerOn != null && !isProcessing)
? const Color.fromRGBO(66, 165, 245, 1.0) ? const Color.fromRGBO(73, 149, 234, 1)
: const Color.fromRGBO(204, 204, 204, 1), : const Color.fromRGBO(204, 204, 204, 1),
borderRadius: BorderRadius.circular(20.r), borderRadius: BorderRadius.circular(16.r),
), ),
child: Center( child: Center(
child: Text( child: Text(
'送电', '送电',
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 32.sp, fontSize: 28.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.w500,
), ),
), ),
), ),
), ),
), ),
), ),
SizedBox(width: 12.w),
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
onTap: (onPowerOff != null && !isProcessing) ? onPowerOff : null, onTap: (onPowerOff != null && !isProcessing) ? onPowerOff : null,
child: Container( child: Container(
height: 88.h, height: 70.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: const Color.fromRGBO(229, 241, 255, 1),
borderRadius: BorderRadius.circular(20.r), borderRadius: BorderRadius.circular(16.r),
border: Border.all( border: Border.all(
color: (onPowerOff != null && !isProcessing) color: (onPowerOff != null && !isProcessing)
? const Color.fromRGBO(66, 165, 245, 1.0) ? const Color.fromRGBO(73, 149, 234, 1)
: const Color.fromRGBO(204, 204, 204, 1), : const Color.fromRGBO(204, 204, 204, 1),
width: 2.w, width: 1.w,
), ),
), ),
child: Center( child: Center(
...@@ -66,37 +66,36 @@ class RoomBottomButtons extends StatelessWidget { ...@@ -66,37 +66,36 @@ class RoomBottomButtons extends StatelessWidget {
color: (onPowerOff != null && !isProcessing) color: (onPowerOff != null && !isProcessing)
? const Color.fromRGBO(66, 165, 245, 1.0) ? const Color.fromRGBO(66, 165, 245, 1.0)
: const Color.fromRGBO(100, 116, 139, 1), : const Color.fromRGBO(100, 116, 139, 1),
fontSize: 32.sp, fontSize: 28.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.w500,
), ),
), ),
), ),
), ),
), ),
), ),
SizedBox(width: 12.w), // Expanded(
Expanded( // child: GestureDetector(
child: GestureDetector( // onTap: onDeviceControl,
onTap: onDeviceControl, // child: Container(
child: Container( // height: 70.h,
height: 88.h, // decoration: BoxDecoration(
decoration: BoxDecoration( // color: const Color.fromRGBO(100, 116, 139, 0.2),
color: const Color.fromRGBO(200, 208, 220, 1.0), // borderRadius: BorderRadius.circular(16.r),
borderRadius: BorderRadius.circular(20.r), // ),
), // child: Center(
child: Center( // child: Text(
child: Text( // '设备控制',
'设备控制', // style: TextStyle(
style: TextStyle( // color: const Color.fromRGBO(100, 116, 139, 1.0),
color: const Color.fromRGBO(100, 116, 139, 1.0), // fontSize: 28.sp,
fontSize: 32.sp, // fontWeight: FontWeight.w500,
fontWeight: FontWeight.bold, // ),
), // ),
), // ),
), // ),
), // ),
), // ),
),
], ],
); );
} }
......
...@@ -20,6 +20,7 @@ class RoomDeviceStatusCard extends StatelessWidget { ...@@ -20,6 +20,7 @@ class RoomDeviceStatusCard extends StatelessWidget {
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.h), padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.h),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
spacing: 20.h,
children: [ children: [
Text( Text(
'房间设备状态', '房间设备状态',
...@@ -29,7 +30,6 @@ class RoomDeviceStatusCard extends StatelessWidget { ...@@ -29,7 +30,6 @@ class RoomDeviceStatusCard extends StatelessWidget {
color: const Color.fromRGBO(10, 13, 20, 1.0), color: const Color.fromRGBO(10, 13, 20, 1.0),
), ),
), ),
SizedBox(height: 20.h),
GridView.builder( GridView.builder(
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
...@@ -37,7 +37,7 @@ class RoomDeviceStatusCard extends StatelessWidget { ...@@ -37,7 +37,7 @@ class RoomDeviceStatusCard extends StatelessWidget {
crossAxisCount: 2, crossAxisCount: 2,
crossAxisSpacing: 16.w, crossAxisSpacing: 16.w,
mainAxisSpacing: 16.h, mainAxisSpacing: 16.h,
childAspectRatio: 2, childAspectRatio: 2.5,
), ),
itemCount: devices.length, itemCount: devices.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
...@@ -47,18 +47,20 @@ class RoomDeviceStatusCard extends StatelessWidget { ...@@ -47,18 +47,20 @@ class RoomDeviceStatusCard extends StatelessWidget {
color: const Color.fromRGBO(235, 244, 255, 1.0), color: const Color.fromRGBO(235, 244, 255, 1.0),
borderRadius: BorderRadius.circular(28.r), borderRadius: BorderRadius.circular(28.r),
), ),
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 16.h), padding: EdgeInsets.symmetric(horizontal: 20.w),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
spacing: 8.h,
children: [ children: [
Row( Row(
spacing: 8.w,
children: [ children: [
Icon( Icon(
device.icon, device.icon,
color: const Color.fromRGBO(66, 165, 245, 1.0), color: const Color.fromRGBO(66, 165, 245, 1.0),
size: 36.sp, size: 36.sp,
), ),
SizedBox(width: 8.w),
Text( Text(
device.name, device.name,
style: TextStyle( style: TextStyle(
...@@ -69,7 +71,6 @@ class RoomDeviceStatusCard extends StatelessWidget { ...@@ -69,7 +71,6 @@ class RoomDeviceStatusCard extends StatelessWidget {
), ),
], ],
), ),
SizedBox(height: 12.h),
if (device.statusText != null) if (device.statusText != null)
Text( Text(
device.statusText!, device.statusText!,
......
...@@ -24,12 +24,13 @@ class RoomOverviewCard extends StatelessWidget { ...@@ -24,12 +24,13 @@ class RoomOverviewCard extends StatelessWidget {
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.h), padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.h),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
spacing: 24.h,
children: [ children: [
Row( Row(
children: [ children: [
Container( Container(
width: 88.w, width: 64.w,
height: 88.h, height: 53.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromRGBO(235, 244, 255, 1.0), color: const Color.fromRGBO(235, 244, 255, 1.0),
borderRadius: BorderRadius.circular(16.r), borderRadius: BorderRadius.circular(16.r),
...@@ -41,11 +42,6 @@ class RoomOverviewCard extends StatelessWidget { ...@@ -41,11 +42,6 @@ class RoomOverviewCard extends StatelessWidget {
), ),
), ),
SizedBox(width: 20.w), SizedBox(width: 20.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text( Text(
roomNumber, roomNumber,
style: TextStyle( style: TextStyle(
...@@ -64,11 +60,6 @@ class RoomOverviewCard extends StatelessWidget { ...@@ -64,11 +60,6 @@ class RoomOverviewCard extends StatelessWidget {
), ),
], ],
), ),
],
),
],
),
SizedBox(height: 24.h),
Wrap( Wrap(
spacing: 8.w, spacing: 8.w,
children: statusTags.map((tag) { children: statusTags.map((tag) {
...@@ -80,13 +71,13 @@ class RoomOverviewCard extends StatelessWidget { ...@@ -80,13 +71,13 @@ class RoomOverviewCard extends StatelessWidget {
), ),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
spacing: 4.w,
children: [ children: [
Icon( Icon(
Icons.check, Icons.check,
color: const Color.fromRGBO(26, 188, 156, 1.0), color: const Color.fromRGBO(26, 188, 156, 1.0),
size: 20.sp, size: 20.sp,
), ),
SizedBox(width: 4.w),
Text( Text(
_getTagLabel(tag), _getTagLabel(tag),
style: TextStyle( style: TextStyle(
......
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