add all outlet

This commit is contained in:
Efril
2026-05-14 14:11:42 +07:00
parent 6fda0f5636
commit 9f2097a268
4 changed files with 149 additions and 36 deletions
-1
View File
@@ -28,7 +28,6 @@ void main() async {
// Initialize FCM after dependencies are ready
await getIt<FcmService>().initialize(
onMessageTap: (message) {
// TODO: handle navigation when notification is tapped
debugPrint('[FCM] Navigate based on: ${message.data}');
},
);
@@ -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<SelectedOutletBloc>()
.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,