Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ”€ :: μ—¬μž 세탁싀 μž„μ‹œ 제거 #244 #245

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ enum DeviceType {

enum RoomLocation {
schoolSide(roomName: "λ‚¨μž 학ꡐ츑 세탁싀"),
dormitorySide(roomName: "λ‚¨μž κΈ°μˆ™μ‚¬μΈ‘ 세탁싀"),
womanRoom(roomName: "μ—¬μž 세탁싀");
dormitorySide(roomName: "λ‚¨μž κΈ°μˆ™μ‚¬μΈ‘ 세탁싀");

const RoomLocation({required this.roomName});

Expand Down
16 changes: 0 additions & 16 deletions lib/presentation/apply_page/ui/view/apply_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,6 @@ class ApplyPage extends StatelessWidget {
deviceId: state.value
.applyList[index * 2].deviceId,
isEnableNotification: false,
isWoman: state
.value
.applyList[index * 2]
.deviceId >
64
? true
: false,
deviceType: state.value
.applyList[index * 2].deviceType,
state: CurrentState.working),
Expand All @@ -163,14 +156,6 @@ class ApplyPage extends StatelessWidget {
.applyList[index * 2 + 1]
.deviceId,
isEnableNotification: false,
isWoman: state
.value
.applyList[
index * 2 + 1]
.deviceId >
64
? true
: false,
deviceType: state
.value
.applyList[index * 2 + 1]
Expand All @@ -180,7 +165,6 @@ class ApplyPage extends StatelessWidget {
//λ¦¬νŒ©ν† λ§ κΌ­ ν•˜κΈ°
deviceId: -1,
isEnableNotification: false,
isWoman: true,
deviceType: DeviceType.empty,
state: CurrentState.working)
],
Expand Down
3 changes: 1 addition & 2 deletions lib/presentation/apply_page/ui/widget/machine_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class MachineCard extends MachineWidget {
super.key,
required super.deviceId,
required super.isEnableNotification,
required super.isWoman,
required super.deviceType,
required super.state,
});
Expand Down Expand Up @@ -75,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,
Expand Down
23 changes: 0 additions & 23 deletions lib/presentation/laundry_room_page/ui/view/laundry_room_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,24 +164,6 @@ class LaundryRoomPage extends StatelessWidget {
padding: EdgeInsets.symmetric(horizontal: 5.0.r),
radius: 8.0,
),
SizedBox(width: 8.0.w),
OSJTextButton(
function: () => context.read<RoomBloc>().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,
),
],
),
),
Expand Down Expand Up @@ -286,7 +268,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,
),
Expand Down Expand Up @@ -316,8 +297,6 @@ class LaundryList extends StatelessWidget {
index +
32],
isEnableNotification: true,
isWoman:
laundryRoomModel.roomLocation == RoomLocation.womanRoom,
),
laundryRoomModel.buttonView.triangle,
MachineButton(
Expand All @@ -332,8 +311,6 @@ class LaundryList extends StatelessWidget {
index +
40],
isEnableNotification: true,
isWoman:
laundryRoomModel.roomLocation == RoomLocation.womanRoom,
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ class SettingPageBottomSheet extends StatelessWidget {
currentRoomLocation: state.value.roomLocation,
roomLocation: RoomLocation.dormitorySide,
),
CheckButton(
currentRoomLocation: state.value.roomLocation,
roomLocation: RoomLocation.womanRoom,
),
],
),
),
Expand Down
38 changes: 22 additions & 16 deletions lib/presentation/utils/machine_button.dart
Original file line number Diff line number Diff line change
@@ -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(
Expand Down Expand Up @@ -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(
Expand All @@ -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.viewId}번",
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)),
],
),
Expand Down
4 changes: 1 addition & 3 deletions lib/presentation/utils/machine_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +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 DeviceType deviceType;
final CurrentState state;
final bool isEnableNotification, isWoman;
final bool isEnableNotification;

void showModalOSJBottomSheet({required BuildContext context}) =>
showModalBottomSheet(
Expand All @@ -29,7 +28,6 @@ abstract class MachineWidget extends StatelessWidget {
builder: (context) => OSJBottomSheet(
deviceId: deviceId,
isEnableNotification: isEnableNotification,
isWoman: isWoman,
state: state,
machine: deviceType,
),
Expand Down
45 changes: 13 additions & 32 deletions lib/presentation/utils/osj_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -29,37 +28,20 @@ class OSJBottomSheet extends StatefulWidget {
}

class _OSJBottomSheetState extends State<OSJBottomSheet> {
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μ•Œλ¦Ό 섀정을 ν•΄μ œν•˜μ‹€κ±΄κ°€μš”?";
}
}

Expand Down Expand Up @@ -104,8 +86,7 @@ class _OSJBottomSheetState extends State<OSJBottomSheet> {
),
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,
Expand Down