From 9f2097a26850b18abe753138c370e1fc034d4ad8 Mon Sep 17 00:00:00 2001 From: Efril Date: Thu, 14 May 2026 14:11:42 +0700 Subject: [PATCH] add all outlet --- android/app/build.gradle.kts | 2 +- lib/main.dart | 1 - .../pages/home/widgets/promo_banner.dart | 144 ++++++++++++++++-- pubspec.lock | 38 ++--- 4 files changed, 149 insertions(+), 36 deletions(-) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 4928c43..5a7213f 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -26,7 +26,7 @@ android { applicationId = "com.apskel.enaklo_owner" // You can update the following values to match your application needs. // For more information, see: https://flutter.dev/to/review-gradle-config. - minSdk = 21 + minSdk = flutter.minSdkVersion targetSdk = flutter.targetSdkVersion versionCode = flutter.versionCode versionName = flutter.versionName diff --git a/lib/main.dart b/lib/main.dart index c9b2e97..25f0646 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -28,7 +28,6 @@ void main() async { // Initialize FCM after dependencies are ready await getIt().initialize( onMessageTap: (message) { - // TODO: handle navigation when notification is tapped debugPrint('[FCM] Navigate based on: ${message.data}'); }, ); diff --git a/lib/presentation/pages/home/widgets/promo_banner.dart b/lib/presentation/pages/home/widgets/promo_banner.dart index c2ad529..c302732 100644 --- a/lib/presentation/pages/home/widgets/promo_banner.dart +++ b/lib/presentation/pages/home/widgets/promo_banner.dart @@ -32,11 +32,24 @@ class HomePromoBanner extends StatelessWidget { AppValue.padding, 0, ), - child: Row( - children: [ - for (int i = 0; i < outletListState.outlets.length; i++) ...[ - Expanded( - child: _OutletCard( + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: [ + // Card "Semua Outlet" di posisi pertama + _AllOutletCard( + isSelected: selectedState.isAllOutlets, + onTap: () { + if (!selectedState.isAllOutlets) { + context + .read() + .add(const SelectedOutletEvent.cleared()); + } + }, + ), + const SpaceWidth(12), + for (int i = 0; i < outletListState.outlets.length; i++) ...[ + _OutletCard( outlet: outletListState.outlets[i], isSelected: selectedState.selectedOutletId == outletListState.outlets[i].id, @@ -54,11 +67,11 @@ class HomePromoBanner extends StatelessWidget { } }, ), - ), - if (i < outletListState.outlets.length - 1) - const SpaceWidth(12), + if (i < outletListState.outlets.length - 1) + const SpaceWidth(12), + ], ], - ], + ), ), ); }, @@ -68,6 +81,100 @@ class HomePromoBanner extends StatelessWidget { } } +class _AllOutletCard extends StatelessWidget { + final bool isSelected; + final VoidCallback onTap; + + const _AllOutletCard({ + required this.isSelected, + required this.onTap, + }); + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: onTap, + child: AnimatedContainer( + duration: const Duration(milliseconds: 200), + width: 130, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + border: Border.all( + color: isSelected ? AppColor.white : Colors.transparent, + width: 2, + ), + boxShadow: isSelected + ? [ + BoxShadow( + color: AppColor.white.withOpacity(0.3), + blurRadius: 8, + offset: const Offset(0, 2), + ), + ] + : [], + ), + child: Opacity( + opacity: isSelected ? 1.0 : 0.55, + child: ParticleCard( + height: 110, + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12), + decorationOpacity: 0.8, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + const Spacer(), + Container( + padding: const EdgeInsets.symmetric( + horizontal: 8, vertical: 3), + decoration: BoxDecoration( + color: AppColor.white.withOpacity(0.25), + borderRadius: BorderRadius.circular(12), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.store_rounded, + color: AppColor.white, + size: 12, + ), + const SpaceWidth(4), + Text( + 'Semua', + style: AppStyle.xs.copyWith( + color: AppColor.white, + fontWeight: FontWeight.w700, + fontSize: 9, + ), + ), + ], + ), + ), + ], + ), + const SpaceHeight(6), + Text( + 'Semua Outlet', + style: AppStyle.sm.copyWith( + color: AppColor.white, + fontWeight: FontWeight.w800, + height: 1.25, + ), + maxLines: 3, + overflow: TextOverflow.ellipsis, + ), + ], + ), + ), + ), + ), + ); + } +} + class _OutletCard extends StatelessWidget { final Outlet outlet; final bool isSelected; @@ -85,6 +192,7 @@ class _OutletCard extends StatelessWidget { onTap: onTap, child: AnimatedContainer( duration: const Duration(milliseconds: 200), + width: 130, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12), border: Border.all( @@ -188,18 +296,24 @@ class _PromoBannerSkeleton extends StatelessWidget { AppValue.padding, 0, ), - child: Row( - children: [ - Expanded(child: _skeletonCard()), - const SpaceWidth(12), - Expanded(child: _skeletonCard()), - ], + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: [ + _skeletonCard(), + const SpaceWidth(12), + _skeletonCard(), + const SpaceWidth(12), + _skeletonCard(), + ], + ), ), ); } Widget _skeletonCard() { return Container( + width: 130, height: 110, decoration: BoxDecoration( color: AppColor.border, diff --git a/pubspec.lock b/pubspec.lock index 242445d..39c7a96 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -213,10 +213,10 @@ packages: dependency: transitive description: name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.4.1" checked_yaml: dependency: transitive description: @@ -865,26 +865,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" url: "https://pub.dev" source: hosted - version: "10.0.9" + version: "11.0.2" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" url: "https://pub.dev" source: hosted - version: "3.0.9" + version: "3.0.10" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" line_icons: dependency: "direct main" description: @@ -921,26 +921,26 @@ packages: dependency: transitive description: name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861 url: "https://pub.dev" source: hosted - version: "0.12.17" + version: "0.12.19" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.13.0" meta: dependency: transitive description: name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.0" mime: dependency: transitive description: @@ -1510,10 +1510,10 @@ packages: dependency: transitive description: name: test_api - sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a" url: "https://pub.dev" source: hosted - version: "0.7.4" + version: "0.7.10" time: dependency: transitive description: @@ -1646,10 +1646,10 @@ packages: dependency: transitive description: name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.0" vm_service: dependency: transitive description: @@ -1731,5 +1731,5 @@ packages: source: hosted version: "3.1.3" sdks: - dart: ">=3.8.1 <4.0.0" + dart: ">=3.9.0-0 <4.0.0" flutter: ">=3.29.0"