diff --git a/android/app/build.gradle b/android/app/build.gradle index ac67c83a..130fc4f0 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -13,12 +13,12 @@ if (flutterRoot == null) { def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { - flutterVersionCode = '25' + flutterVersionCode = '26' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { - flutterVersionName = '3.6.0' + flutterVersionName = '3.7.0' } def keystoreProperties = new Properties() diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index e03c0a3a..90e805c6 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -367,7 +367,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 21; + CURRENT_PROJECT_VERSION = 22; DEVELOPMENT_TEAM = Z25H7B85Z8; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -376,7 +376,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 3.6.0; + MARKETING_VERSION = 3.7.0; PRODUCT_BUNDLE_IDENTIFIER = com.osj.lotura; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -507,7 +507,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 21; + CURRENT_PROJECT_VERSION = 22; DEVELOPMENT_TEAM = Z25H7B85Z8; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -516,7 +516,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 3.6.0; + MARKETING_VERSION = 3.7.0; PRODUCT_BUNDLE_IDENTIFIER = com.osj.lotura; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -537,7 +537,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 21; + CURRENT_PROJECT_VERSION = 22; DEVELOPMENT_TEAM = Z25H7B85Z8; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -546,7 +546,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 3.6.0; + MARKETING_VERSION = 3.7.0; PRODUCT_BUNDLE_IDENTIFIER = com.osj.lotura; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; diff --git a/lib/data/laundry/data_source/remote/remote_laundry_data_source.dart b/lib/data/laundry/data_source/remote/remote_laundry_data_source.dart index c4db5ee6..f1a007a6 100644 --- a/lib/data/laundry/data_source/remote/remote_laundry_data_source.dart +++ b/lib/data/laundry/data_source/remote/remote_laundry_data_source.dart @@ -28,7 +28,7 @@ class RemoteLaundryDataSource { } Future> getAllLaundryList() async { - final response = await http.get(Uri.parse("$baseurl/device_list")); + final response = await http.get(Uri.parse("$baseurl/device_list_boy")); if (response.statusCode != 200) { throw Exception(response.body); } diff --git a/lib/data/laundry/dto/response/laundry_response.dart b/lib/data/laundry/dto/response/laundry_response.dart index df0364e8..34eb7c2b 100644 --- a/lib/data/laundry/dto/response/laundry_response.dart +++ b/lib/data/laundry/dto/response/laundry_response.dart @@ -24,7 +24,11 @@ class LaundryResponse { return LaundryEntity( id: id, state: CurrentState.values.elementAt(state), - deviceType: deviceType == "WASH" ? DeviceType.wash : DeviceType.dry, + deviceType: deviceType == "WASH" + ? DeviceType.wash + : deviceType == "DRY" + ? DeviceType.dry + : DeviceType.empty, ); } } diff --git a/lib/main.dart b/lib/main.dart index 888a05d5..a7148c7c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -108,6 +108,11 @@ enum DeviceType { text: "건조기", icon: LoturaIcons.dry, imagePath: "assets/dry_image.jpeg", + ), + empty( + text: "", + icon: Icons.abc, + imagePath: "", ); final String text, imagePath; @@ -120,21 +125,30 @@ enum DeviceType { }); } +enum Gender { + boy(text: "남자 세탁실"), + girl(text: "여자 세탁실"); + + const Gender({required this.text}); + + final String text; +} + enum RoomLocation { schoolSide(roomName: "남자 학교측 세탁실"), dormitorySide(roomName: "남자 기숙사측 세탁실"), - womanRoom(roomName: "여자 세탁실"); + schoolGirlSide(roomName: "여자 기숙사측 세탁실"); const RoomLocation({required this.roomName}); final String roomName; } -enum ButtonView { - image, - icon; +enum LaundryRoomLayer { + first(icon: Icons.looks_one_outlined), + second(icon: Icons.looks_two_outlined); - Widget get triangle => this == ButtonView.image - ? const SizedBox.shrink() - : const Icon(LoturaIcons.triangleUp, color: Colors.grey); + const LaundryRoomLayer({required this.icon}); + + final IconData icon; } diff --git a/lib/presentation/apply_page/ui/view/apply_page.dart b/lib/presentation/apply_page/ui/view/apply_page.dart index fe6f505f..200c6a17 100644 --- a/lib/presentation/apply_page/ui/view/apply_page.dart +++ b/lib/presentation/apply_page/ui/view/apply_page.dart @@ -5,6 +5,7 @@ import 'package:lotura/main.dart'; import 'package:lotura/presentation/apply_page/bloc/apply_bloc.dart'; import 'package:lotura/presentation/apply_page/bloc/apply_model.dart'; import 'package:lotura/presentation/apply_page/bloc/apply_state.dart'; +import 'package:lotura/presentation/apply_page/ui/widget/machine_card.dart'; import 'package:lotura/presentation/notice_page/bloc/notice_bloc.dart'; import 'package:lotura/presentation/notice_page/bloc/notice_event.dart'; import 'package:lotura/presentation/notice_page/bloc/notice_model.dart'; @@ -13,7 +14,6 @@ import 'package:lotura/presentation/notice_page/ui/view/notice_page.dart'; import 'package:lotura/presentation/setting_page/ui/view/setting_page.dart'; import 'package:lotura/presentation/utils/lotura_colors.dart'; import 'package:lotura/presentation/utils/lotura_icons.dart'; -import 'package:lotura/presentation/utils/machine_card.dart'; class ApplyPage extends StatelessWidget { ApplyPage({super.key}); @@ -146,13 +146,6 @@ class ApplyPage extends StatelessWidget { deviceId: state.value .applyList[index * 2].deviceId, isEnableNotification: false, - isWoman: state - .value - .applyList[index * 2] - .deviceId > - 31 - ? true - : false, deviceType: state.value .applyList[index * 2].deviceType, state: CurrentState.working), @@ -163,14 +156,6 @@ class ApplyPage extends StatelessWidget { .applyList[index * 2 + 1] .deviceId, isEnableNotification: false, - isWoman: state - .value - .applyList[ - index * 2 + 1] - .deviceId > - 31 - ? true - : false, deviceType: state .value .applyList[index * 2 + 1] @@ -180,8 +165,7 @@ class ApplyPage extends StatelessWidget { //리팩토링 꼭 하기 deviceId: -1, isEnableNotification: false, - isWoman: true, - deviceType: DeviceType.dry, + deviceType: DeviceType.empty, state: CurrentState.working) ], ), diff --git a/lib/presentation/utils/machine_card.dart b/lib/presentation/apply_page/ui/widget/machine_card.dart similarity index 92% rename from lib/presentation/utils/machine_card.dart rename to lib/presentation/apply_page/ui/widget/machine_card.dart index 04ae1e34..cb382b9e 100644 --- a/lib/presentation/utils/machine_card.dart +++ b/lib/presentation/apply_page/ui/widget/machine_card.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart' as s; +import 'package:lotura/main.dart'; import 'package:lotura/presentation/utils/machine_widget.dart'; class MachineCard extends MachineWidget { @@ -7,14 +8,13 @@ class MachineCard extends MachineWidget { super.key, required super.deviceId, required super.isEnableNotification, - required super.isWoman, required super.deviceType, required super.state, }); @override Widget build(BuildContext context) { - return isEmptyContainer + return deviceType == DeviceType.empty ? Container( width: 170.0.r, padding: EdgeInsets.only(top: 10.0.r), @@ -27,7 +27,7 @@ class MachineCard extends MachineWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ Image.asset( - deviceType.imagePath, + "assets/dry_image.jpeg", width: 100.0.r, height: 100.0.r, color: Colors.transparent, @@ -74,7 +74,7 @@ class MachineCard extends MachineWidget { height: 100.0.r, ), Text( - "${isWoman ? deviceId - 31 : deviceId}번 ${deviceType.text}", + "$deviceId번 ${deviceType.text}", textScaler: TextScaler.noScaling, style: TextStyle( fontSize: 20.0.sp, diff --git a/lib/presentation/laundry_room_page/ui/view/laundry_room_page.dart b/lib/presentation/laundry_room_page/ui/view/laundry_room_page.dart index 7263ee2b..97febb98 100644 --- a/lib/presentation/laundry_room_page/ui/view/laundry_room_page.dart +++ b/lib/presentation/laundry_room_page/ui/view/laundry_room_page.dart @@ -6,6 +6,7 @@ import 'package:lotura/main.dart'; import 'package:lotura/presentation/laundry_room_page/bloc/laundry_bloc.dart'; import 'package:lotura/presentation/laundry_room_page/bloc/laundry_model.dart'; import 'package:lotura/presentation/laundry_room_page/bloc/laundry_state.dart'; +import 'package:lotura/presentation/laundry_room_page/ui/widget/machine_button.dart'; import 'package:lotura/presentation/notice_page/bloc/notice_bloc.dart'; import 'package:lotura/presentation/notice_page/bloc/notice_event.dart'; import 'package:lotura/presentation/notice_page/bloc/notice_model.dart'; @@ -18,9 +19,6 @@ import 'package:lotura/presentation/setting_page/bloc/room_state.dart'; import 'package:lotura/presentation/setting_page/ui/view/setting_page.dart'; import 'package:lotura/presentation/utils/lotura_colors.dart'; import 'package:lotura/presentation/utils/lotura_icons.dart'; -import 'package:lotura/presentation/utils/machine_button.dart'; -import 'package:lotura/presentation/utils/machine_card.dart'; -import 'package:lotura/presentation/utils/machine_widget.dart'; import 'package:lotura/presentation/utils/osj_bottom_sheet.dart'; import 'package:lotura/presentation/utils/osj_text_button.dart'; @@ -30,12 +28,20 @@ class LaundryRoomPage extends StatelessWidget { final int nfcTagData; final Map place = { - 0: "남자 학교측 세탁실", - 1: "남자 기숙사측 세탁실", - 2: "여자 세탁실", + 0: "남자 학교측 세탁실 1층", + 1: "남자 학교측 세탁실 2층", + 2: "남자 기숙사측 세탁실 1층", + 3: "남자 기숙사측 세탁실 2층", + 4: "여자 세탁실 1층", }; - final Map placeIndex = {0: 0, 1: 16, 2: 31}; + final Map placeIndex = { + 0: 0, + 1: 16, + 2: 31, + 3: 47, + 4: 63, + }; @override Widget build(BuildContext context) { @@ -121,65 +127,68 @@ class LaundryRoomPage extends StatelessWidget { SingleChildScrollView( scrollDirection: Axis.horizontal, padding: EdgeInsets.symmetric(vertical: 12.0.h), - child: Row( - children: [ - OSJTextButton( - function: () => context.read().add( - ModifyRoomIndexEvent( - roomLocation: RoomLocation.schoolSide)), - fontSize: 18.0.sp, - color: roomBlocState.value.roomLocation == - RoomLocation.schoolSide - ? LoturaColors.white - : LoturaColors.gray100, - fontColor: roomBlocState.value.roomLocation == - RoomLocation.schoolSide - ? LoturaColors.primary700 - : LoturaColors.gray300, - text: "남자 학교측", - padding: EdgeInsets.symmetric(horizontal: 5.0.r), - radius: 8.0, - ), - SizedBox(width: 8.0.w), - OSJTextButton( - function: () => context.read().add( - ModifyRoomIndexEvent( - roomLocation: RoomLocation.dormitorySide)), - fontSize: 18.0.sp, - color: roomBlocState.value.roomLocation == - RoomLocation.dormitorySide - ? LoturaColors.white - : LoturaColors.gray100, - fontColor: roomBlocState.value.roomLocation == - RoomLocation.dormitorySide - ? LoturaColors.primary700 - : LoturaColors.gray300, - text: "남자 기숙사측", - padding: EdgeInsets.symmetric(horizontal: 5.0.r), - radius: 8.0, - ), - SizedBox(width: 8.0.w), - OSJTextButton( - function: () => context.read().add( - ModifyRoomIndexEvent( - roomLocation: RoomLocation.womanRoom)), - fontSize: 18.0.sp, - color: roomBlocState.value.roomLocation == - RoomLocation.womanRoom - ? LoturaColors.white - : LoturaColors.gray100, - fontColor: roomBlocState.value.roomLocation == - RoomLocation.womanRoom - ? LoturaColors.primary700 - : LoturaColors.gray300, - text: "여자", - padding: EdgeInsets.symmetric(horizontal: 5.0.r), - radius: 8.0, - ), - ], - ), + child: roomBlocState.data.roomLocation != + RoomLocation.schoolGirlSide + ? Row( + children: [ + OSJTextButton( + function: () => context.read().add( + ModifyRoomIndexEvent( + roomLocation: + RoomLocation.schoolSide)), + fontSize: 18.0.sp, + color: roomBlocState.value.roomLocation == + RoomLocation.schoolSide + ? LoturaColors.white + : LoturaColors.gray100, + fontColor: roomBlocState.value.roomLocation == + RoomLocation.schoolSide + ? LoturaColors.primary700 + : LoturaColors.gray300, + text: "남자 학교측", + padding: + EdgeInsets.symmetric(horizontal: 5.0.r), + radius: 8.0, + ), + SizedBox(width: 8.0.w), + OSJTextButton( + function: () => context.read().add( + ModifyRoomIndexEvent( + roomLocation: + RoomLocation.dormitorySide)), + fontSize: 18.0.sp, + color: roomBlocState.value.roomLocation == + RoomLocation.dormitorySide + ? LoturaColors.white + : LoturaColors.gray100, + fontColor: roomBlocState.value.roomLocation == + RoomLocation.dormitorySide + ? LoturaColors.primary700 + : LoturaColors.gray300, + text: "남자 기숙사측", + padding: + EdgeInsets.symmetric(horizontal: 5.0.r), + radius: 8.0, + ), + ], + ) + : OSJTextButton( + function: () => context.read().add( + ModifyRoomIndexEvent( + roomLocation: + RoomLocation.schoolGirlSide)), + fontSize: 18.0.sp, + color: LoturaColors.white, + fontColor: LoturaColors.primary700, + text: "여자 기숙사측", + padding: EdgeInsets.symmetric(horizontal: 5.0.r), + radius: 8.0, + ), + ), + LaundryRoomLayerFilter( + laundryRoomLayer: roomBlocState.value.laundryRoomLayer, + currentRoomLocation: roomBlocState.data.roomLocation, ), - ViewTypeFilter(buttonView: roomBlocState.value.buttonView), Expanded( child: BlocBuilder>( @@ -190,11 +199,14 @@ class LaundryRoomPage extends StatelessWidget { const Center(child: CircularProgressIndicator()), Error() => const Center(child: Text("인터넷 연결을 확인해주세요")), - Loaded() => LaundryList( - list: state.data.laundryList, - laundryRoomModel: roomBlocState.value, - nfcData: nfcTagData, - ), + Loaded() => roomBlocState.data.roomLocation != + RoomLocation.schoolGirlSide + ? LaundryList( + list: state.data.laundryList, + laundryRoomModel: roomBlocState.value, + nfcData: nfcTagData, + ) + : const Center(child: Text("여자 세탁실은 준비중~")), }; }, ), @@ -209,38 +221,50 @@ class LaundryRoomPage extends StatelessWidget { } } -class ViewTypeFilter extends StatelessWidget { - const ViewTypeFilter({super.key, required this.buttonView}); +class LaundryRoomLayerFilter extends StatelessWidget { + const LaundryRoomLayerFilter({ + super.key, + required this.laundryRoomLayer, + required this.currentRoomLocation, + }); - final ButtonView buttonView; + final LaundryRoomLayer laundryRoomLayer; + final RoomLocation currentRoomLocation; @override Widget build(BuildContext context) { return Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - IconButton( - onPressed: () => context - .read() - .add(ModifyButtonViewEvent(buttonView: ButtonView.image)), - icon: Icon(LoturaIcons.grid, - size: 18.0.r, - color: buttonView == ButtonView.image + TextButton( + onPressed: () => context.read().add( + ModifyLaundryRoomLayerEvent( + laundryRoomLayer: LaundryRoomLayer.first)), + child: Text( + "1층", + style: TextStyle( + fontSize: 18.0.sp, + color: laundryRoomLayer == LaundryRoomLayer.first ? LoturaColors.black - : LoturaColors.gray300), - ), - IconButton( - onPressed: () => context - .read() - .add(ModifyButtonViewEvent(buttonView: ButtonView.icon)), - icon: Icon( - LoturaIcons.list, - size: 18.0.r, - color: buttonView == ButtonView.icon - ? LoturaColors.black - : LoturaColors.gray300, + : LoturaColors.gray300, + ), ), ), + if (currentRoomLocation != RoomLocation.schoolGirlSide) + TextButton( + onPressed: () => context.read().add( + ModifyLaundryRoomLayerEvent( + laundryRoomLayer: LaundryRoomLayer.second)), + child: Text( + "2층", + style: TextStyle( + fontSize: 18.0.sp, + color: laundryRoomLayer == LaundryRoomLayer.second + ? LoturaColors.black + : LoturaColors.gray300, + ), + ), + ), ], ); } @@ -258,26 +282,7 @@ class LaundryList extends StatelessWidget { final LaundryRoomModel laundryRoomModel; final int nfcData; - final Map placeIndex = {0: 0, 1: 16, 2: 31}; - - MachineWidget machineWidget( - {required LaundryRoomModel roomState, - required int deviceId, - required CurrentState state, - required DeviceType deviceType}) => - roomState.buttonView == ButtonView.image - ? MachineCard( - deviceId: deviceId, - isEnableNotification: true, - isWoman: roomState.roomLocation == RoomLocation.womanRoom, - state: state, - deviceType: deviceType) - : MachineButton( - deviceId: deviceId, - isEnableNotification: true, - isWoman: roomState.roomLocation == RoomLocation.womanRoom, - state: state, - deviceType: deviceType); + final Map placeIndex = {0: 0, 1: 16, 2: 31, 3: 47, 4: 63}; @override Widget build(BuildContext context) { @@ -299,7 +304,6 @@ class LaundryList extends StatelessWidget { builder: (context) => OSJBottomSheet( deviceId: nfcData, isEnableNotification: true, - isWoman: nfcData > 31 ? true : false, state: list[nfcData - 1].state, machine: list[nfcData - 1].deviceType, ), @@ -310,80 +314,39 @@ class LaundryList extends StatelessWidget { return ScrollConfiguration( behavior: const ScrollBehavior().copyWith(overscroll: false), child: ListView.builder( - itemCount: - laundryRoomModel.roomLocation == RoomLocation.womanRoom ? 10 : 8, + itemCount: 8, + // laundryRoomModel.roomLocation == RoomLocation.womanRoom ? 10 : 8, itemBuilder: (context, index) { return Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - machineWidget( - roomState: laundryRoomModel, - deviceId: list[ - placeIndex[laundryRoomModel.roomLocation.index]! + - index] - .id, - deviceType: list[ - placeIndex[laundryRoomModel.roomLocation.index]! + - index] - .deviceType, - state: list[ - placeIndex[laundryRoomModel.roomLocation.index]! + - index] - .state), - laundryRoomModel.buttonView.triangle, - machineWidget( - roomState: laundryRoomModel, - deviceId: placeIndex[laundryRoomModel.roomLocation.index]! + + MachineButton( + laundryEntity: laundryRoomModel.laundryRoomLayer == + LaundryRoomLayer.first + ? list[ + placeIndex[laundryRoomModel.roomLocation.index]! + + index] + : list[ + placeIndex[laundryRoomModel.roomLocation.index]! + index + - (laundryRoomModel.roomLocation == - RoomLocation.womanRoom - ? 10 - : 8) < - 44 - ? list[placeIndex[ - laundryRoomModel.roomLocation.index]! + - index + - (laundryRoomModel.roomLocation == - RoomLocation.womanRoom - ? 10 - : 8)] - .id - : -1, - deviceType: - placeIndex[laundryRoomModel.roomLocation.index]! + - index + - (laundryRoomModel.roomLocation == - RoomLocation.womanRoom - ? 10 - : 8) < - 44 - ? list[placeIndex[ - laundryRoomModel.roomLocation.index]! + - index + - (laundryRoomModel.roomLocation == - RoomLocation.womanRoom - ? 10 - : 8)] - .deviceType - : DeviceType.dry, - state: placeIndex[laundryRoomModel.roomLocation.index]! + + 32], + isEnableNotification: true, + ), + const Icon(LoturaIcons.triangleUp, color: Colors.grey), + MachineButton( + laundryEntity: laundryRoomModel.laundryRoomLayer == + LaundryRoomLayer.first + ? list[ + placeIndex[laundryRoomModel.roomLocation.index]! + index + - (laundryRoomModel.roomLocation == - RoomLocation.womanRoom - ? 10 - : 8) < - 44 - ? list[placeIndex[ - laundryRoomModel.roomLocation.index]! + + 8] + : list[ + placeIndex[laundryRoomModel.roomLocation.index]! + index + - (laundryRoomModel.roomLocation == - RoomLocation.womanRoom - ? 10 - : 8)] - .state - : CurrentState.breakdown, + 40], + isEnableNotification: true, ), ], ), diff --git a/lib/presentation/utils/machine_button.dart b/lib/presentation/laundry_room_page/ui/widget/machine_button.dart similarity index 79% rename from lib/presentation/utils/machine_button.dart rename to lib/presentation/laundry_room_page/ui/widget/machine_button.dart index f626a8b0..6f184ba2 100644 --- a/lib/presentation/utils/machine_button.dart +++ b/lib/presentation/laundry_room_page/ui/widget/machine_button.dart @@ -1,22 +1,27 @@ import 'package:flutter/material.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart' as s; +import 'package:lotura/domain/laundry/entity/laundry_entity.dart'; +import 'package:lotura/main.dart'; import 'package:lotura/presentation/utils/lotura_colors.dart'; import 'package:lotura/presentation/utils/lotura_icons.dart'; import 'package:lotura/presentation/utils/machine_widget.dart'; class MachineButton extends MachineWidget { - const MachineButton({ + MachineButton({ super.key, - required super.deviceId, + required this.laundryEntity, required super.isEnableNotification, - required super.isWoman, - required super.state, - required super.deviceType, - }); + }) : super( + deviceId: laundryEntity.id, + deviceType: laundryEntity.deviceType, + state: laundryEntity.state, + ); + + final LaundryEntity laundryEntity; @override Widget build(BuildContext context) { - return isEmptyContainer + return laundryEntity.deviceType == DeviceType.empty ? Container( padding: EdgeInsets.all(12.0.r), constraints: BoxConstraints( @@ -71,7 +76,7 @@ class MachineButton extends MachineWidget { maxWidth: 185.0.w, ), decoration: BoxDecoration( - color: state.color, + color: laundryEntity.state.color, borderRadius: BorderRadius.circular(16.0), border: Border.all(color: LoturaColors.gray200)), child: Row( @@ -84,23 +89,24 @@ class MachineButton extends MachineWidget { height: 32.0.r, decoration: BoxDecoration( shape: BoxShape.circle, - color: state.color, - border: - Border.all(color: state.deviceIconColor, width: 2), + color: laundryEntity.state.color, + border: Border.all( + color: laundryEntity.state.deviceIconColor, width: 2), ), - child: Icon(deviceType.icon, - size: 20.0.r, color: state.deviceIconColor), + child: Icon(laundryEntity.deviceType.icon, + size: 20.0.r, + color: laundryEntity.state.deviceIconColor), ), Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ - Text("${isWoman ? deviceId - 31 : deviceId}번", + Text("${laundryEntity.id}번", style: TextStyle( fontSize: 15.0.sp, fontWeight: FontWeight.w500)), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - Text(deviceType.text, + Text(laundryEntity.deviceType.text, style: TextStyle(fontSize: 14.0.sp)), ], ), diff --git a/lib/presentation/setting_page/bloc/laundry_room_model.dart b/lib/presentation/setting_page/bloc/laundry_room_model.dart index a1771fe4..44d51242 100644 --- a/lib/presentation/setting_page/bloc/laundry_room_model.dart +++ b/lib/presentation/setting_page/bloc/laundry_room_model.dart @@ -2,12 +2,12 @@ import 'package:lotura/main.dart'; class LaundryRoomModel { final RoomLocation roomLocation; - final ButtonView buttonView; + final LaundryRoomLayer laundryRoomLayer; final bool isClick, isNFCShowBottomSheet, showingBottomSheet; const LaundryRoomModel({ required this.roomLocation, - required this.buttonView, + required this.laundryRoomLayer, required this.isClick, required this.isNFCShowBottomSheet, required this.showingBottomSheet, @@ -15,13 +15,13 @@ class LaundryRoomModel { LaundryRoomModel copyWith( {RoomLocation? roomLocation, - ButtonView? buttonView, + LaundryRoomLayer? laundryRoomLayer, bool? isClick, bool? isNFCShowBottomSheet, bool? showingBottomSheet}) { return LaundryRoomModel( roomLocation: roomLocation ?? this.roomLocation, - buttonView: buttonView ?? this.buttonView, + laundryRoomLayer: laundryRoomLayer ?? this.laundryRoomLayer, isClick: isClick ?? this.isClick, isNFCShowBottomSheet: isNFCShowBottomSheet ?? this.isNFCShowBottomSheet, showingBottomSheet: showingBottomSheet ?? this.showingBottomSheet); diff --git a/lib/presentation/setting_page/bloc/room_bloc.dart b/lib/presentation/setting_page/bloc/room_bloc.dart index 941a5b2f..da2e884e 100644 --- a/lib/presentation/setting_page/bloc/room_bloc.dart +++ b/lib/presentation/setting_page/bloc/room_bloc.dart @@ -18,14 +18,14 @@ class RoomBloc extends Bloc> { super(Initial( data: const LaundryRoomModel( roomLocation: RoomLocation.schoolSide, - buttonView: ButtonView.icon, + laundryRoomLayer: LaundryRoomLayer.first, isClick: false, isNFCShowBottomSheet: false, showingBottomSheet: false))) { on(_updateRoomIndexEventHandler); on(_getRoomIndexEventHandler); on(_modifyRoomIndexEventHandler); - on(_modifyPlaceIconIndexEventHandler); + on(_modifyPlaceIconIndexEventHandler); on(_showBottomSheetEventHandler); on(_initialShowBottomSheetEventHandler); on(_showingBottomSheetEventHandler); @@ -51,9 +51,10 @@ class RoomBloc extends Bloc> { emit(Changed(data: state.value.copyWith(roomLocation: event.roomLocation))); } - void _modifyPlaceIconIndexEventHandler( - ModifyButtonViewEvent event, Emitter> emit) { - emit(Changed(data: state.value.copyWith(buttonView: event.buttonView))); + void _modifyPlaceIconIndexEventHandler(ModifyLaundryRoomLayerEvent event, + Emitter> emit) { + emit(Changed( + data: state.value.copyWith(laundryRoomLayer: event.laundryRoomLayer))); } void _showBottomSheetEventHandler( diff --git a/lib/presentation/setting_page/bloc/room_event.dart b/lib/presentation/setting_page/bloc/room_event.dart index c8f9c3b0..1e6d8393 100644 --- a/lib/presentation/setting_page/bloc/room_event.dart +++ b/lib/presentation/setting_page/bloc/room_event.dart @@ -16,10 +16,10 @@ class ModifyRoomIndexEvent extends RoomEvent { ModifyRoomIndexEvent({required this.roomLocation}); } -class ModifyButtonViewEvent extends RoomEvent { - final ButtonView buttonView; +class ModifyLaundryRoomLayerEvent extends RoomEvent { + final LaundryRoomLayer laundryRoomLayer; - ModifyButtonViewEvent({required this.buttonView}); + ModifyLaundryRoomLayerEvent({required this.laundryRoomLayer}); } class ShowBottomSheetEvent extends RoomEvent {} diff --git a/lib/presentation/setting_page/ui/widget/setting_page_bottom_sheet.dart b/lib/presentation/setting_page/ui/widget/setting_page_bottom_sheet.dart index 92b18ffd..626a5ee9 100644 --- a/lib/presentation/setting_page/ui/widget/setting_page_bottom_sheet.dart +++ b/lib/presentation/setting_page/ui/widget/setting_page_bottom_sheet.dart @@ -46,17 +46,16 @@ class SettingPageBottomSheet extends StatelessWidget { fontSize: 25.0.sp, color: LoturaColors.black), ), ), + SizedBox(height: 30.0.r), CheckButton( - currentRoomLocation: state.value.roomLocation, + gender: Gender.boy, roomLocation: RoomLocation.schoolSide, + currentRoomLocation: state.data.roomLocation, ), CheckButton( - currentRoomLocation: state.value.roomLocation, - roomLocation: RoomLocation.dormitorySide, - ), - CheckButton( - currentRoomLocation: state.value.roomLocation, - roomLocation: RoomLocation.womanRoom, + gender: Gender.girl, + roomLocation: RoomLocation.schoolGirlSide, + currentRoomLocation: state.data.roomLocation, ), ], ), @@ -70,10 +69,12 @@ class SettingPageBottomSheet extends StatelessWidget { class CheckButton extends StatelessWidget { const CheckButton({ super.key, - required this.currentRoomLocation, + required this.gender, required this.roomLocation, + required this.currentRoomLocation, }); + final Gender gender; final RoomLocation roomLocation, currentRoomLocation; @override @@ -95,7 +96,7 @@ class CheckButton extends StatelessWidget { children: [ Flexible( child: Text( - roomLocation.roomName, + gender.text, overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 16.0.sp, diff --git a/lib/presentation/utils/machine_widget.dart b/lib/presentation/utils/machine_widget.dart index 3f1c04a0..58b15d4e 100644 --- a/lib/presentation/utils/machine_widget.dart +++ b/lib/presentation/utils/machine_widget.dart @@ -8,19 +8,14 @@ abstract class MachineWidget extends StatelessWidget { super.key, required this.deviceId, required this.isEnableNotification, - required this.isWoman, required this.state, required this.deviceType, }); final int deviceId; - final bool isEnableNotification, isWoman; - - final CurrentState state; final DeviceType deviceType; - - bool get isEmptyContainer => - (!isWoman && deviceId == 32) || (isWoman && deviceId == -1); + final CurrentState state; + final bool isEnableNotification; void showModalOSJBottomSheet({required BuildContext context}) => showModalBottomSheet( @@ -33,7 +28,6 @@ abstract class MachineWidget extends StatelessWidget { builder: (context) => OSJBottomSheet( deviceId: deviceId, isEnableNotification: isEnableNotification, - isWoman: isWoman, state: state, machine: deviceType, ), diff --git a/lib/presentation/utils/osj_bottom_sheet.dart b/lib/presentation/utils/osj_bottom_sheet.dart index b1d49927..25f7da94 100644 --- a/lib/presentation/utils/osj_bottom_sheet.dart +++ b/lib/presentation/utils/osj_bottom_sheet.dart @@ -14,13 +14,12 @@ class OSJBottomSheet extends StatefulWidget { super.key, required this.deviceId, required this.isEnableNotification, - required this.isWoman, required this.state, required this.machine, }); final int deviceId; - final bool isEnableNotification, isWoman; + final bool isEnableNotification; final CurrentState state; final DeviceType machine; @@ -29,37 +28,20 @@ class OSJBottomSheet extends StatefulWidget { } class _OSJBottomSheetState extends State { - String text(bool isEnableNotification, isWoman, CurrentState state) { + String text(bool isEnableNotification, CurrentState state) { if (isEnableNotification) { - if (isWoman) { - switch (state) { - case CurrentState.working: - return "여자 세탁실 ${widget.deviceId - 31}번 ${widget.machine.text}를\n알림 설정 하실건가요?"; - case CurrentState.available: - return "여자 세탁실 ${widget.deviceId - 31}번 ${widget.machine.text}는\n현재 사용 가능한 상태에요."; - case CurrentState.disconnected: - return "여자층 ${widget.deviceId - 31}번 ${widget.machine.text}의 연결이 끊겨서\n상태를 확인할 수 없어요."; - case CurrentState.breakdown: - return "여자 세탁실 ${widget.deviceId - 31}번 ${widget.machine.text}는\n고장으로 인해 사용이 불가능해요."; - } - } else { - switch (state) { - case CurrentState.working: - return "${widget.deviceId}번 ${widget.machine.text}를\n알림 설정 하실건가요?"; - case CurrentState.available: - return "${widget.deviceId}번 ${widget.machine.text}는\n현재 사용 가능한 상태에요."; - case CurrentState.disconnected: - return "${widget.deviceId}번 ${widget.machine.text}의 연결이 끊겨서\n상태를 확인할 수 없어요."; - case CurrentState.breakdown: - return "${widget.deviceId}번 ${widget.machine.text}는\n고장으로 인해 사용이 불가능해요."; - } + switch (state) { + case CurrentState.working: + return "${widget.deviceId}번 ${widget.machine.text}를\n알림 설정 하실건가요?"; + case CurrentState.available: + return "${widget.deviceId}번 ${widget.machine.text}는\n현재 사용 가능한 상태에요."; + case CurrentState.disconnected: + return "${widget.deviceId}번 ${widget.machine.text}의 연결이 끊겨서\n상태를 확인할 수 없어요."; + case CurrentState.breakdown: + return "${widget.deviceId}번 ${widget.machine.text}는\n고장으로 인해 사용이 불가능해요."; } } else { - if (isWoman) { - return "여자 세탁실 ${widget.deviceId - 31}번 ${widget.machine.text}의\n알림 설정을 해제하실건가요?"; - } else { - return "${widget.deviceId}번 ${widget.machine.text}의\n알림 설정을 해제하실건가요?"; - } + return "${widget.deviceId}번 ${widget.machine.text}의\n알림 설정을 해제하실건가요?"; } } @@ -104,8 +86,7 @@ class _OSJBottomSheetState extends State { ), SizedBox(height: 10.0.r), Text( - text(widget.isEnableNotification, widget.isWoman, - widget.state), + text(widget.isEnableNotification, widget.state), style: TextStyle( color: Colors.black, fontSize: 22.0.sp, diff --git a/pubspec.yaml b/pubspec.yaml index 54b2767e..a3c2b17e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 3.6.0+25 +version: 3.7.0+26 environment: sdk: '>=3.1.3 <4.0.0'