From a30d44da8e4c4ce1125cd0fd3e6dbbe06d09586e Mon Sep 17 00:00:00 2001 From: seigibus Date: Sat, 15 Apr 2023 15:49:03 +0900 Subject: [PATCH 01/10] =?UTF-8?q?feat:=20card=E3=82=BF=E3=83=83=E3=83=97?= =?UTF-8?q?=E3=81=A7=E8=A9=B3=E7=B4=B0=E3=83=9A=E3=83=BC=E3=82=B8=E3=81=AB?= =?UTF-8?q?=E9=81=B7=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/router.dart | 17 +++++ lib/view/pages/trips/trip_detail_page.dart | 54 +++++++++++++++ lib/view/widgets/trips/trip_card.dart | 69 ++++++++++--------- .../widgets/trips/trip_overview_card.dart | 50 ++++++++++++++ 4 files changed, 158 insertions(+), 32 deletions(-) create mode 100644 lib/view/pages/trips/trip_detail_page.dart create mode 100644 lib/view/widgets/trips/trip_overview_card.dart diff --git a/lib/router.dart b/lib/router.dart index 4f5069d7..92493e58 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -2,11 +2,13 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; +import 'package:trip_app_nativeapp/core/exception/app_exception.dart'; import 'package:trip_app_nativeapp/features/user/controller/app_user_controller.dart'; import 'package:trip_app_nativeapp/view/pages/debug_page.dart'; import 'package:trip_app_nativeapp/view/pages/error_page.dart'; import 'package:trip_app_nativeapp/view/pages/loading_page.dart'; import 'package:trip_app_nativeapp/view/pages/login_page.dart'; +import 'package:trip_app_nativeapp/view/pages/trips/trip_detail_page.dart'; import 'package:trip_app_nativeapp/view/pages/trips/trips_list_page.dart'; part 'router.g.dart'; @@ -59,6 +61,21 @@ GoRouter router(RouterRef ref) { GoRoute( path: TripListPage.path, builder: (context, state) => const TripListPage(), + routes: [ + GoRoute( + path: TripDetailPage.path, + builder: (context, state) { + final id = int.tryParse(state.params['id'] ?? ''); + if (id != null) { + return TripDetailPage(id); + } else { + return const ErrorPage( + exception: AppException(message: '旅の選択に失敗しました。'), + ); + } + }, + ), + ], ), GoRoute( path: LoginPage.path, diff --git a/lib/view/pages/trips/trip_detail_page.dart b/lib/view/pages/trips/trip_detail_page.dart new file mode 100644 index 00000000..ea1e85da --- /dev/null +++ b/lib/view/pages/trips/trip_detail_page.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:trip_app_nativeapp/core/extensions/build_context.dart'; +import 'package:trip_app_nativeapp/features/trips/controller/trip_controller.dart'; +import 'package:trip_app_nativeapp/view/widgets/common/car_driving_loading.dart'; +import 'package:trip_app_nativeapp/view/widgets/common/error_cat.dart'; +import 'package:trip_app_nativeapp/view/widgets/trips/trip_overview_card.dart'; + +class TripDetailPage extends HookConsumerWidget { + const TripDetailPage(this.id, {super.key}); + + static const path = ':id'; + final int id; + + @override + Widget build(BuildContext context, WidgetRef ref) { + return Scaffold( + body: SafeArea( + top: false, + child: ref.watch(tripsProvider).when( + data: (trips) { + final trip = trips.firstWhere((trip) => trip.id == id); + return Stack( + children: [ + Column( + children: [ + SizedBox( + height: context.displaySize.width * 9 / 16, + child: Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: NetworkImage( + 'https://tsunagutabi.com/wp-content/uploads/2020/04/%E6%97%85%E8%A1%8C%E3%83%96%E3%83%AD%E3%82%B0%E3%81%AB%E3%81%8A%E3%81%99%E3%81%99%E3%82%81%E3%81%AE%E3%83%95%E3%83%AA%E3%83%BC%E7%94%BB%E5%83%8F%EF%BC%86%E7%B4%A0%E6%9D%90%E3%82%B5%E3%82%A4%E3%83%88%E3%81%BE%E3%81%A8%E3%82%81.jpg'), + fit: BoxFit.cover, + ), + ), + ), + ) + ], + ), + Positioned( + top: context.displaySize.width * 9 / 16, + child: TripOverviewCard(trip), + ), + ], + ); + }, + error: ErrorCat.new, + loading: CarDrivingLoading.new, + ), + ), + ); + } +} diff --git a/lib/view/widgets/trips/trip_card.dart b/lib/view/widgets/trips/trip_card.dart index 6c4103f7..38fad6ac 100644 --- a/lib/view/widgets/trips/trip_card.dart +++ b/lib/view/widgets/trips/trip_card.dart @@ -1,10 +1,12 @@ import 'package:flutter/material.dart'; import 'package:gap/gap.dart'; +import 'package:go_router/go_router.dart'; import 'package:lottie/lottie.dart'; import 'package:trip_app_nativeapp/core/extensions/build_context.dart'; import 'package:trip_app_nativeapp/core/extensions/datetime.dart'; import 'package:trip_app_nativeapp/core/gen/assets.gen.dart'; import 'package:trip_app_nativeapp/features/trips/domain/entity/trip/trip.dart'; +import 'package:trip_app_nativeapp/view/pages/trips/trips_list_page.dart'; class TripCard extends StatelessWidget { const TripCard(this.trip, {super.key}); @@ -13,39 +15,42 @@ class TripCard extends StatelessWidget { @override Widget build(BuildContext context) { - return Card( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - elevation: 4, - child: Padding( - padding: const EdgeInsets.all(8), - child: Column( - mainAxisSize: MainAxisSize.min, // Columnの高さを最小限にする - children: [ - Expanded( - child: Lottie.asset( - Assets.lotties.tripCard, - height: context.displaySize.height * 0.14, + return GestureDetector( + onTap: () => context.go('${TripListPage.path}/${trip.id}'), + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + elevation: 4, + child: Padding( + padding: const EdgeInsets.all(8), + child: Column( + mainAxisSize: MainAxisSize.min, // Columnの高さを最小限にする + children: [ + Expanded( + child: Lottie.asset( + Assets.lotties.tripCard, + height: context.displaySize.height * 0.14, + ), + ), + Text( + trip.title.value, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: context.textTheme.titleLarge, + ), + const Gap(8), + Text( + '🛫 ${trip.period.fromDate.toJsonDateString()}', + style: context.textTheme.titleMedium, + ), + const Gap(8), + Text( + '${trip.period.endDate.toJsonDateString()} 🔚', + style: context.textTheme.titleMedium, ), - ), - Text( - trip.title.value, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: context.textTheme.titleLarge, - ), - const Gap(8), - Text( - '🛫 ${trip.period.fromDate.toJsonDateString()}', - style: context.textTheme.titleMedium, - ), - const Gap(8), - Text( - '${trip.period.endDate.toJsonDateString()} 🔚', - style: context.textTheme.titleMedium, - ), - ], + ], + ), ), ), ); diff --git a/lib/view/widgets/trips/trip_overview_card.dart b/lib/view/widgets/trips/trip_overview_card.dart new file mode 100644 index 00000000..31056903 --- /dev/null +++ b/lib/view/widgets/trips/trip_overview_card.dart @@ -0,0 +1,50 @@ +import 'package:flutter/material.dart'; +import 'package:gap/gap.dart'; +import 'package:trip_app_nativeapp/core/extensions/build_context.dart'; +import 'package:trip_app_nativeapp/core/extensions/datetime.dart'; +import 'package:trip_app_nativeapp/features/trips/domain/entity/trip/trip.dart'; + +class TripOverviewCard extends StatelessWidget { + const TripOverviewCard(this.trip, {super.key}); + + final ExistingTrip trip; + + @override + Widget build(BuildContext context) { + return Center( + child: SizedBox( + height: 150, + width: context.displaySize.width * 0.9, + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + elevation: 4, + child: Padding( + padding: const EdgeInsets.all(8), + child: Column( + children: [ + Text( + trip.title.value, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: context.textTheme.titleLarge, + ), + const Gap(8), + Text( + '🛫 ${trip.period.fromDate.toJsonDateString()}', + style: context.textTheme.titleMedium, + ), + const Gap(8), + Text( + '${trip.period.endDate.toJsonDateString()} 🔚', + style: context.textTheme.titleMedium, + ), + ], + ), + ), + ), + ), + ); + } +} From 0fa5fb7823f1b3c777974c82066ac6c3781f9313 Mon Sep 17 00:00:00 2001 From: seigibus Date: Sun, 16 Apr 2023 19:15:08 +0900 Subject: [PATCH 02/10] =?UTF-8?q?feat:=20tab=E5=88=87=E3=82=8A=E6=9B=BF?= =?UTF-8?q?=E3=81=88=E3=81=A7=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=82=B3?= =?UTF-8?q?=E3=83=B3=E3=83=86=E3=83=B3=E3=83=84=E3=82=92=E5=87=BA=E3=81=97?= =?UTF-8?q?=E5=88=86=E3=81=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/view/pages/trips/trip_detail_page.dart | 94 ++++++++++++++----- .../widgets/trips/trip_belonging_list.dart | 13 +++ .../widgets/trips/trip_overview_card.dart | 86 +++++++++++------ lib/view/widgets/trips/trip_schedule.dart | 16 ++++ 4 files changed, 160 insertions(+), 49 deletions(-) create mode 100644 lib/view/widgets/trips/trip_belonging_list.dart create mode 100644 lib/view/widgets/trips/trip_schedule.dart diff --git a/lib/view/pages/trips/trip_detail_page.dart b/lib/view/pages/trips/trip_detail_page.dart index ea1e85da..c65812c9 100644 --- a/lib/view/pages/trips/trip_detail_page.dart +++ b/lib/view/pages/trips/trip_detail_page.dart @@ -1,48 +1,100 @@ import 'package:flutter/material.dart'; +import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:trip_app_nativeapp/core/extensions/build_context.dart'; import 'package:trip_app_nativeapp/features/trips/controller/trip_controller.dart'; import 'package:trip_app_nativeapp/view/widgets/common/car_driving_loading.dart'; import 'package:trip_app_nativeapp/view/widgets/common/error_cat.dart'; +import 'package:trip_app_nativeapp/view/widgets/trips/trip_belonging_list.dart'; import 'package:trip_app_nativeapp/view/widgets/trips/trip_overview_card.dart'; +import 'package:trip_app_nativeapp/view/widgets/trips/trip_schedule.dart'; + +final tabStateProvider = StateProvider((ref) => 0); class TripDetailPage extends HookConsumerWidget { const TripDetailPage(this.id, {super.key}); static const path = ':id'; + static const scheduleTabIndex = 0; final int id; @override Widget build(BuildContext context, WidgetRef ref) { + final tabIndex = useState(scheduleTabIndex); + final backgroundImageHeight = context.displaySize.width / 16 * 9; return Scaffold( body: SafeArea( top: false, child: ref.watch(tripsProvider).when( data: (trips) { final trip = trips.firstWhere((trip) => trip.id == id); - return Stack( - children: [ - Column( - children: [ - SizedBox( - height: context.displaySize.width * 9 / 16, - child: Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: NetworkImage( - 'https://tsunagutabi.com/wp-content/uploads/2020/04/%E6%97%85%E8%A1%8C%E3%83%96%E3%83%AD%E3%82%B0%E3%81%AB%E3%81%8A%E3%81%99%E3%81%99%E3%82%81%E3%81%AE%E3%83%95%E3%83%AA%E3%83%BC%E7%94%BB%E5%83%8F%EF%BC%86%E7%B4%A0%E6%9D%90%E3%82%B5%E3%82%A4%E3%83%88%E3%81%BE%E3%81%A8%E3%82%81.jpg'), - fit: BoxFit.cover, - ), + return NestedScrollView( + headerSliverBuilder: + (BuildContext context, bool innerBoxIsScrolled) { + return [ + SliverAppBar( + // TODO(seigi0714): スクロールした場合のみ表示したい。 + title: Text( + trip.title.value, + style: context.textTheme.titleLarge, + ), + expandedHeight: + backgroundImageHeight + TripOverviewCard.height / 2, + flexibleSpace: FlexibleSpaceBar( + background: SizedBox( + height: backgroundImageHeight + + TripOverviewCard.height / 2, + child: Stack( + alignment: Alignment.topCenter, + children: [ + SizedBox( + height: backgroundImageHeight, + child: Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: NetworkImage( + 'https://tsunagutabi.com/wp-content/uploads/2020/04/%E6%97%85%E8%A1%8C%E3%83%96%E3%83%AD%E3%82%B0%E3%81%AB%E3%81%8A%E3%81%99%E3%81%99%E3%82%81%E3%81%AE%E3%83%95%E3%83%AA%E3%83%BC%E7%94%BB%E5%83%8F%EF%BC%86%E7%B4%A0%E6%9D%90%E3%82%B5%E3%82%A4%E3%83%88%E3%81%BE%E3%81%A8%E3%82%81.jpg'), + fit: BoxFit.cover, + ), + ), + ), + ), + Positioned( + top: backgroundImageHeight - + TripOverviewCard.height / 2, + child: TripOverviewCard(trip), + ), + ], ), ), - ) - ], - ), - Positioned( - top: context.displaySize.width * 9 / 16, - child: TripOverviewCard(trip), - ), - ], + ), + pinned: true, + bottom: PreferredSize( + preferredSize: const Size.fromHeight(48), + child: TabBar( + controller: TabController( + length: 2, + vsync: Scaffold.of(context), + initialIndex: tabIndex.value, + ), + labelColor: Colors.black, + tabs: const [ + Tab( + text: '🗓️日程', + ), + Tab( + text: '🧳持ち物', + ) + ], + onTap: (i) => tabIndex.value = i, + ), + ), + ), + ]; + }, + body: tabIndex.value == scheduleTabIndex + ? TripSchedule(trip) + : const TripBelongingList(), ); }, error: ErrorCat.new, diff --git a/lib/view/widgets/trips/trip_belonging_list.dart b/lib/view/widgets/trips/trip_belonging_list.dart new file mode 100644 index 00000000..da34cb60 --- /dev/null +++ b/lib/view/widgets/trips/trip_belonging_list.dart @@ -0,0 +1,13 @@ +import 'package:flutter/material.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; + +class TripBelongingList extends HookConsumerWidget { + const TripBelongingList({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + return const Center( + child: Text('持ち物リスト'), + ); + } +} diff --git a/lib/view/widgets/trips/trip_overview_card.dart b/lib/view/widgets/trips/trip_overview_card.dart index 31056903..072042e7 100644 --- a/lib/view/widgets/trips/trip_overview_card.dart +++ b/lib/view/widgets/trips/trip_overview_card.dart @@ -1,5 +1,6 @@ +import 'dart:developer'; + import 'package:flutter/material.dart'; -import 'package:gap/gap.dart'; import 'package:trip_app_nativeapp/core/extensions/build_context.dart'; import 'package:trip_app_nativeapp/core/extensions/datetime.dart'; import 'package:trip_app_nativeapp/features/trips/domain/entity/trip/trip.dart'; @@ -8,41 +9,70 @@ class TripOverviewCard extends StatelessWidget { const TripOverviewCard(this.trip, {super.key}); final ExistingTrip trip; + static const height = 150.0; @override Widget build(BuildContext context) { return Center( child: SizedBox( - height: 150, - width: context.displaySize.width * 0.9, + height: height, + width: context.displaySize.width * 0.95, child: Card( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - elevation: 4, - child: Padding( - padding: const EdgeInsets.all(8), - child: Column( - children: [ - Text( - trip.title.value, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: context.textTheme.titleLarge, - ), - const Gap(8), - Text( - '🛫 ${trip.period.fromDate.toJsonDateString()}', - style: context.textTheme.titleMedium, - ), - const Gap(8), - Text( - '${trip.period.endDate.toJsonDateString()} 🔚', - style: context.textTheme.titleMedium, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + elevation: 4, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Expanded( + child: Center( + child: Text( + trip.title.value, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: context.textTheme.titleLarge, + ), ), - ], - ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + children: [ + Text( + '🛫 ${trip.period.fromDate.toJsonDateString()}', + style: context.textTheme.titleMedium, + ), + Text( + '${trip.period.endDate.toJsonDateString()} 🔚', + style: context.textTheme.titleMedium, + ), + ], + ), + Row( + children: [ + IconButton( + onPressed: () => log('share'), + icon: const Icon( + Icons.share, + ), + ), + IconButton( + onPressed: () => log('edit'), + icon: const Icon( + Icons.edit, + ), + ), + ], + ), + ], + ), + ], ), + ), ), ), ); diff --git a/lib/view/widgets/trips/trip_schedule.dart b/lib/view/widgets/trips/trip_schedule.dart new file mode 100644 index 00000000..8ea8537a --- /dev/null +++ b/lib/view/widgets/trips/trip_schedule.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; +import 'package:trip_app_nativeapp/features/trips/domain/entity/trip/trip.dart'; + +class TripSchedule extends StatelessWidget { + const TripSchedule(this.trip, {super.key}); + + final ExistingTrip trip; + static const height = 150.0; + + @override + Widget build(BuildContext context) { + return const Center( + child: Text('スケジュール'), + ); + } +} From bfa8130d98936a1e45738584e25c895d41bea76d Mon Sep 17 00:00:00 2001 From: seigibus Date: Mon, 24 Apr 2023 20:57:48 +0900 Subject: [PATCH 03/10] =?UTF-8?q?feat:=20=E6=96=87=E5=AD=97=E3=82=B5?= =?UTF-8?q?=E3=82=A4=E3=82=BA=E9=85=8D=E7=BD=AE=E3=82=92=E5=BE=AE=E8=AA=BF?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widgets/trips/trip_overview_card.dart | 65 +++++++++++-------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/lib/view/widgets/trips/trip_overview_card.dart b/lib/view/widgets/trips/trip_overview_card.dart index 072042e7..ae26a1a1 100644 --- a/lib/view/widgets/trips/trip_overview_card.dart +++ b/lib/view/widgets/trips/trip_overview_card.dart @@ -26,47 +26,58 @@ class TripOverviewCard extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( - child: Center( + child: Container( + alignment: Alignment.centerLeft, child: Text( trip.title.value, maxLines: 1, overflow: TextOverflow.ellipsis, - style: context.textTheme.titleLarge, + style: context.textTheme.headlineMedium, ), ), ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, children: [ - Column( - children: [ - Text( - '🛫 ${trip.period.fromDate.toJsonDateString()}', - style: context.textTheme.titleMedium, - ), - Text( - '${trip.period.endDate.toJsonDateString()} 🔚', - style: context.textTheme.titleMedium, - ), - ], - ), - Row( - children: [ - IconButton( - onPressed: () => log('share'), - icon: const Icon( - Icons.share, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '🛫 ${trip.period.fromDate.toJsonDateString()}', + style: context.textTheme.titleMedium, ), - ), - IconButton( - onPressed: () => log('edit'), - icon: const Icon( - Icons.edit, + Text( + '${trip.period.endDate.toJsonDateString()} 🔚', + style: context.textTheme.titleMedium, ), + ], + ), + ), + SizedBox( + width: 36, + height: 36, + child: IconButton( + onPressed: () => log('share'), + icon: const Icon( + Icons.share, + ), + padding: EdgeInsets.zero, + constraints: const BoxConstraints(), + ), + ), + SizedBox( + width: 36, + height: 36, + child: IconButton( + onPressed: () => log('edit'), + icon: const Icon( + Icons.edit, ), - ], + ), ), ], ), From 88e682301abd3d995860ccc376a9d985a6496da7 Mon Sep 17 00:00:00 2001 From: seigibus Date: Mon, 24 Apr 2023 21:06:10 +0900 Subject: [PATCH 04/10] =?UTF-8?q?style:=20Lint=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/view/pages/trips/trip_detail_page.dart | 3 ++- lib/view/widgets/trips/trip_overview_card.dart | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/view/pages/trips/trip_detail_page.dart b/lib/view/pages/trips/trip_detail_page.dart index c65812c9..07d5a4a3 100644 --- a/lib/view/pages/trips/trip_detail_page.dart +++ b/lib/view/pages/trips/trip_detail_page.dart @@ -53,7 +53,8 @@ class TripDetailPage extends HookConsumerWidget { decoration: const BoxDecoration( image: DecorationImage( image: NetworkImage( - 'https://tsunagutabi.com/wp-content/uploads/2020/04/%E6%97%85%E8%A1%8C%E3%83%96%E3%83%AD%E3%82%B0%E3%81%AB%E3%81%8A%E3%81%99%E3%81%99%E3%82%81%E3%81%AE%E3%83%95%E3%83%AA%E3%83%BC%E7%94%BB%E5%83%8F%EF%BC%86%E7%B4%A0%E6%9D%90%E3%82%B5%E3%82%A4%E3%83%88%E3%81%BE%E3%81%A8%E3%82%81.jpg'), + 'https://tsunagutabi.com/wp-content/uploads/2020/04/%E6%97%85%E8%A1%8C%E3%83%96%E3%83%AD%E3%82%B0%E3%81%AB%E3%81%8A%E3%81%99%E3%81%99%E3%82%81%E3%81%AE%E3%83%95%E3%83%AA%E3%83%BC%E7%94%BB%E5%83%8F%EF%BC%86%E7%B4%A0%E6%9D%90%E3%82%B5%E3%82%A4%E3%83%88%E3%81%BE%E3%81%A8%E3%82%81.jpg', + ), fit: BoxFit.cover, ), ), diff --git a/lib/view/widgets/trips/trip_overview_card.dart b/lib/view/widgets/trips/trip_overview_card.dart index ae26a1a1..d27af3ff 100644 --- a/lib/view/widgets/trips/trip_overview_card.dart +++ b/lib/view/widgets/trips/trip_overview_card.dart @@ -65,8 +65,6 @@ class TripOverviewCard extends StatelessWidget { icon: const Icon( Icons.share, ), - padding: EdgeInsets.zero, - constraints: const BoxConstraints(), ), ), SizedBox( From 607568215108e68ca8a088f7ae8288582e05c5f0 Mon Sep 17 00:00:00 2001 From: seigibus Date: Mon, 24 Apr 2023 21:32:56 +0900 Subject: [PATCH 05/10] =?UTF-8?q?feat:=20=E9=81=B8=E6=8A=9E=E3=81=97?= =?UTF-8?q?=E3=81=9F=E6=97=85=E3=81=AE=E5=8F=96=E5=BE=97=E3=81=AB=E5=A4=B1?= =?UTF-8?q?=E6=95=97=E3=81=97=E3=81=9F=E5=A0=B4=E5=90=88=E3=82=A8=E3=83=A9?= =?UTF-8?q?=E3=83=BC=E3=82=92=E8=BF=94=E5=8D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正 --- lib/view/pages/trips/trip_detail_page.dart | 18 ++++++++++++++++-- lib/view/widgets/trips/trip_schedule.dart | 6 +----- pubspec.lock | 2 +- pubspec.yaml | 1 + 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/lib/view/pages/trips/trip_detail_page.dart b/lib/view/pages/trips/trip_detail_page.dart index 07d5a4a3..6d4a123e 100644 --- a/lib/view/pages/trips/trip_detail_page.dart +++ b/lib/view/pages/trips/trip_detail_page.dart @@ -1,6 +1,8 @@ +import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:trip_app_nativeapp/core/exception/app_exception.dart'; import 'package:trip_app_nativeapp/core/extensions/build_context.dart'; import 'package:trip_app_nativeapp/features/trips/controller/trip_controller.dart'; import 'package:trip_app_nativeapp/view/widgets/common/car_driving_loading.dart'; @@ -27,7 +29,19 @@ class TripDetailPage extends HookConsumerWidget { top: false, child: ref.watch(tripsProvider).when( data: (trips) { - final trip = trips.firstWhere((trip) => trip.id == id); + final trip = trips.firstWhereOrNull((trip) => trip.id == id); + if (trip == null) { + return const Center( + child: ErrorCat( + AppException( + code: 'not_found', + message: '選択した旅の予定が見つかりませんでした。', + ), + null, + ), + ); + } + return NestedScrollView( headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { @@ -94,7 +108,7 @@ class TripDetailPage extends HookConsumerWidget { ]; }, body: tabIndex.value == scheduleTabIndex - ? TripSchedule(trip) + ? const TripSchedule() : const TripBelongingList(), ); }, diff --git a/lib/view/widgets/trips/trip_schedule.dart b/lib/view/widgets/trips/trip_schedule.dart index 8ea8537a..b331bdfb 100644 --- a/lib/view/widgets/trips/trip_schedule.dart +++ b/lib/view/widgets/trips/trip_schedule.dart @@ -1,11 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:trip_app_nativeapp/features/trips/domain/entity/trip/trip.dart'; class TripSchedule extends StatelessWidget { - const TripSchedule(this.trip, {super.key}); - - final ExistingTrip trip; - static const height = 150.0; + const TripSchedule({super.key}); @override Widget build(BuildContext context) { diff --git a/pubspec.lock b/pubspec.lock index e1d40319..2bbe7530 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -178,7 +178,7 @@ packages: source: hosted version: "4.4.0" collection: - dependency: transitive + dependency: "direct main" description: name: collection sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 diff --git a/pubspec.yaml b/pubspec.yaml index 8e8e2729..186810ce 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,6 +9,7 @@ environment: sdk: '>=2.18.0 <3.0.0' dependencies: + collection: ^1.17.0 connectivity_plus: ^3.0.2 cupertino_icons: ^1.0.2 device_preview: ^1.1.0 From 640f977774ccbe505ea864aba7d0b036ff0df3eb Mon Sep 17 00:00:00 2001 From: seigibus Date: Wed, 26 Apr 2023 08:07:05 +0900 Subject: [PATCH 06/10] =?UTF-8?q?fix:=20=E4=B8=8D=E8=A6=81=E3=81=AAprovide?= =?UTF-8?q?r=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正 --- lib/view/pages/trips/trip_detail_page.dart | 2 -- lib/view/widgets/trips/trip_belonging_list.dart | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/view/pages/trips/trip_detail_page.dart b/lib/view/pages/trips/trip_detail_page.dart index 6d4a123e..2908b99b 100644 --- a/lib/view/pages/trips/trip_detail_page.dart +++ b/lib/view/pages/trips/trip_detail_page.dart @@ -11,8 +11,6 @@ import 'package:trip_app_nativeapp/view/widgets/trips/trip_belonging_list.dart'; import 'package:trip_app_nativeapp/view/widgets/trips/trip_overview_card.dart'; import 'package:trip_app_nativeapp/view/widgets/trips/trip_schedule.dart'; -final tabStateProvider = StateProvider((ref) => 0); - class TripDetailPage extends HookConsumerWidget { const TripDetailPage(this.id, {super.key}); diff --git a/lib/view/widgets/trips/trip_belonging_list.dart b/lib/view/widgets/trips/trip_belonging_list.dart index da34cb60..2abf5e8a 100644 --- a/lib/view/widgets/trips/trip_belonging_list.dart +++ b/lib/view/widgets/trips/trip_belonging_list.dart @@ -1,11 +1,10 @@ import 'package:flutter/material.dart'; -import 'package:hooks_riverpod/hooks_riverpod.dart'; -class TripBelongingList extends HookConsumerWidget { +class TripBelongingList extends StatelessWidget { const TripBelongingList({super.key}); @override - Widget build(BuildContext context, WidgetRef ref) { + Widget build(BuildContext context) { return const Center( child: Text('持ち物リスト'), ); From 8314f8449cba901c3cae39f0e87ce9c5faa290c8 Mon Sep 17 00:00:00 2001 From: shimizu-saffle Date: Sat, 29 Apr 2023 08:40:20 +0900 Subject: [PATCH 07/10] run ci --- .github/workflows/flutter_ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/flutter_ci.yaml b/.github/workflows/flutter_ci.yaml index fc30dace..b6e764a1 100644 --- a/.github/workflows/flutter_ci.yaml +++ b/.github/workflows/flutter_ci.yaml @@ -91,3 +91,4 @@ jobs: # fail_ci_if_error: true # flags: unittests # verbose: true + # From 4767cf1248af357d866cc2544e2c17baccf0906b Mon Sep 17 00:00:00 2001 From: shimizu-saffle Date: Sat, 29 Apr 2023 08:58:02 +0900 Subject: [PATCH 08/10] chore: bump custom_lint: ^0.3.4 --- pubspec.lock | 24 ++++++++++++++++-------- pubspec.yaml | 2 +- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 2bbe7530..a39bdcbd 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -153,14 +153,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.2" + ci: + dependency: transitive + description: + name: ci + sha256: "145d095ce05cddac4d797a158bc4cf3b6016d1fe63d8c3d2fbd7212590adca13" + url: "https://pub.dev" + source: hosted + version: "0.1.0" cli_util: dependency: transitive description: name: cli_util - sha256: "66f86e916d285c1a93d3b79587d94bd71984a66aac4ff74e524cfa7877f1395c" + sha256: b8db3080e59b2503ca9e7922c3df2072cf13992354d5e944074ffa836fba43b7 url: "https://pub.dev" source: hosted - version: "0.3.5" + version: "0.4.0" clock: dependency: transitive description: @@ -245,26 +253,26 @@ packages: dependency: "direct dev" description: name: custom_lint - sha256: "32648ef4f1dda618d98a22bc958fa79d479895891061e63338bec510b67e821a" + sha256: e87176016465263daf10c209df1f50a52e9e46e7612fab7462da1e6d984638f6 url: "https://pub.dev" source: hosted - version: "0.3.2" + version: "0.3.4" custom_lint_builder: dependency: transitive description: name: custom_lint_builder - sha256: "5d472a901d07ab5ba0239262c340d29930aa2cfd0c73068aa4d1142a353ffee4" + sha256: "6b5e20a249f2f7f15d098f802fe736b72cac14cddccdfcb46027e1b401deec9f" url: "https://pub.dev" source: hosted - version: "0.3.2" + version: "0.3.4" custom_lint_core: dependency: transitive description: name: custom_lint_core - sha256: cc20ce83432675abcc109b766aad2e420946eaeecc32ffd34bada389cdaa9a74 + sha256: f42f688bc26bdf4c081e011ba27a00439f17c20d9aeca4312f8022e577f8363f url: "https://pub.dev" source: hosted - version: "0.3.2" + version: "0.3.4" dart_jsonwebtoken: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 186810ce..4109a586 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -43,7 +43,7 @@ dependencies: dev_dependencies: build_runner: ^2.3.0 - custom_lint: ^0.3.2 + custom_lint: ^0.3.4 flutter_lints: ^2.0.0 flutter_test: sdk: flutter From 2380e3067e4902d6bfa913b7cb7e9001d758ece4 Mon Sep 17 00:00:00 2001 From: shimizu-saffle Date: Sat, 29 Apr 2023 09:16:31 +0900 Subject: [PATCH 09/10] Remove unnecessary comment symbol --- .github/workflows/flutter_ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/flutter_ci.yaml b/.github/workflows/flutter_ci.yaml index b6e764a1..fc30dace 100644 --- a/.github/workflows/flutter_ci.yaml +++ b/.github/workflows/flutter_ci.yaml @@ -91,4 +91,3 @@ jobs: # fail_ci_if_error: true # flags: unittests # verbose: true - # From 3c2b791047cfc367b6301e10cd46065f1b47aeda Mon Sep 17 00:00:00 2001 From: shimizu-saffle Date: Sat, 29 Apr 2023 11:30:20 +0900 Subject: [PATCH 10/10] refactor: TripDetailPage path --- lib/router.dart | 2 +- lib/view/pages/trips/trip_detail_page.dart | 4 +++- lib/view/widgets/trips/trip_card.dart | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/router.dart b/lib/router.dart index 92493e58..e0c9100e 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -63,7 +63,7 @@ GoRouter router(RouterRef ref) { builder: (context, state) => const TripListPage(), routes: [ GoRoute( - path: TripDetailPage.path, + path: TripDetailPage.pathParam, builder: (context, state) { final id = int.tryParse(state.params['id'] ?? ''); if (id != null) { diff --git a/lib/view/pages/trips/trip_detail_page.dart b/lib/view/pages/trips/trip_detail_page.dart index 2908b99b..f12ca554 100644 --- a/lib/view/pages/trips/trip_detail_page.dart +++ b/lib/view/pages/trips/trip_detail_page.dart @@ -5,6 +5,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:trip_app_nativeapp/core/exception/app_exception.dart'; import 'package:trip_app_nativeapp/core/extensions/build_context.dart'; import 'package:trip_app_nativeapp/features/trips/controller/trip_controller.dart'; +import 'package:trip_app_nativeapp/view/pages/trips/trips_list_page.dart'; import 'package:trip_app_nativeapp/view/widgets/common/car_driving_loading.dart'; import 'package:trip_app_nativeapp/view/widgets/common/error_cat.dart'; import 'package:trip_app_nativeapp/view/widgets/trips/trip_belonging_list.dart'; @@ -14,7 +15,8 @@ import 'package:trip_app_nativeapp/view/widgets/trips/trip_schedule.dart'; class TripDetailPage extends HookConsumerWidget { const TripDetailPage(this.id, {super.key}); - static const path = ':id'; + static String path({required int id}) => '${TripListPage.path}/$id'; + static const pathParam = ':id'; static const scheduleTabIndex = 0; final int id; diff --git a/lib/view/widgets/trips/trip_card.dart b/lib/view/widgets/trips/trip_card.dart index 38fad6ac..86151c44 100644 --- a/lib/view/widgets/trips/trip_card.dart +++ b/lib/view/widgets/trips/trip_card.dart @@ -6,7 +6,7 @@ import 'package:trip_app_nativeapp/core/extensions/build_context.dart'; import 'package:trip_app_nativeapp/core/extensions/datetime.dart'; import 'package:trip_app_nativeapp/core/gen/assets.gen.dart'; import 'package:trip_app_nativeapp/features/trips/domain/entity/trip/trip.dart'; -import 'package:trip_app_nativeapp/view/pages/trips/trips_list_page.dart'; +import 'package:trip_app_nativeapp/view/pages/trips/trip_detail_page.dart'; class TripCard extends StatelessWidget { const TripCard(this.trip, {super.key}); @@ -16,7 +16,7 @@ class TripCard extends StatelessWidget { @override Widget build(BuildContext context) { return GestureDetector( - onTap: () => context.go('${TripListPage.path}/${trip.id}'), + onTap: () => context.push(TripDetailPage.path(id: trip.id)), child: Card( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12),