Skip to content

Commit

Permalink
feat: My예약 내 아이템 탭할 경우 세부 화면으로 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
ryr0121 committed Dec 3, 2023
1 parent 0cf9011 commit c329e35
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
13 changes: 12 additions & 1 deletion lib/View/booking/component/booking_item_card.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import 'package:flutter/material.dart';
import 'package:frontend/Presenter/booking/resource_service.dart';
import 'package:frontend/View/booking/screen/booking_screen.dart';
import 'package:frontend/View/booking/screen/office_detail_screen.dart';

import '../../../Presenter/booking/car_service.dart';
import '../../../Presenter/booking/office_service.dart';
import '../../colors.dart';
import '../screen/booking_history_screen.dart';
import '../screen/booking_return_screen.dart';
import '../screen/general_detail_screen.dart';
import 'booking_status_item.dart';

enum BookingManageType { cancel, giveBack, reject, allow } // 취소, 반납, 반려, 허가
Expand Down Expand Up @@ -81,7 +83,8 @@ class _BookingItemCardState extends State<BookingItemCard> {
),
Expanded(child: Container()),
SizedBox(
child: IconButton(onPressed: (){},
child: IconButton(
onPressed: didTapMoveToDetailButton,
style: IconButton.styleFrom(padding: EdgeInsets.zero),
icon: const Icon(Icons.arrow_forward_ios, size: 16,)
),
Expand Down Expand Up @@ -336,4 +339,12 @@ class _BookingItemCardState extends State<BookingItemCard> {
parent!.reloadData(response);
}

void didTapMoveToDetailButton() {
switch (widget.type) {
case BookingType.office:
Navigator.of(context).push(MaterialPageRoute(builder: (_) => OfficeDetailScreen(officeId: widget.id,)));
default:
Navigator.of(context).push(MaterialPageRoute(builder: (_) => GeneralDetailScreen(type: widget.type, id: widget.id,)));
}
}
}
22 changes: 7 additions & 15 deletions lib/View/booking/screen/general_detail_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,10 @@ class _GeneralDetailScreenState extends State<GeneralDetailScreen> {
isLoading = true;
dynamic response;
switch (widget.type) {
case BookingType.resource:
response = await ResourceService().getResourceDetailData(widget.id);
case BookingType.car:
response = await CarService().getCarDetailData(widget.id);
default:
return;
case BookingType.resource: response = await ResourceService().getResourceDetailData(widget.id);
case BookingType.car: response = await CarService().getCarDetailData(widget.id);
default: return;
}
// dynamic response = await ResourceService().getResourceDetailData(widget.resourceId);
isLoading = false;
return response;
}
Expand Down Expand Up @@ -95,21 +91,17 @@ class _GeneralDetailScreenState extends State<GeneralDetailScreen> {
future: fetchData(),
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.hasError || snapshot.data == null) {
print('snapshot.hasError - ${snapshot.hasError}');
print('snapshot.error - ${snapshot.error}');
print('snapshot.data - ${snapshot.data}');
return const Center(
child: Text(
'정보를 불러오지 못 하였습니다.',
style: TextStyle(fontSize: 16, color: purple),
),
);
} else {
if (isLoading) {
return const Center(
child: CircularProgressIndicator(
color: purple,
),
);
}
// data = ResourceDetailResponse.fromJson(snapshot.data);
if (isLoading) { return const Center(child: CircularProgressIndicator(color: purple,),); }
configure(snapshot.data);
return SizedBox(
width: MediaQuery.of(context).size.width,
Expand Down

0 comments on commit c329e35

Please sign in to comment.