diff --git a/lib/View/booking/component/booking_item_card.dart b/lib/View/booking/component/booking_item_card.dart index 8eab947..725f323 100644 --- a/lib/View/booking/component/booking_item_card.dart +++ b/lib/View/booking/component/booking_item_card.dart @@ -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 } // 취소, 반납, 반려, 허가 @@ -81,7 +83,8 @@ class _BookingItemCardState extends State { ), 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,) ), @@ -336,4 +339,12 @@ class _BookingItemCardState extends State { 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,))); + } + } } diff --git a/lib/View/booking/screen/general_detail_screen.dart b/lib/View/booking/screen/general_detail_screen.dart index 847bdaf..29ad93a 100644 --- a/lib/View/booking/screen/general_detail_screen.dart +++ b/lib/View/booking/screen/general_detail_screen.dart @@ -42,14 +42,10 @@ class _GeneralDetailScreenState extends State { 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; } @@ -95,6 +91,9 @@ class _GeneralDetailScreenState extends State { future: fetchData(), builder: (BuildContext context, AsyncSnapshot 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( '정보를 불러오지 못 하였습니다.', @@ -102,14 +101,7 @@ class _GeneralDetailScreenState extends State { ), ); } 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,