feat: merchant page
This commit is contained in:
parent
627de219cb
commit
d86c38e77c
@ -3,3 +3,4 @@ import 'package:flutter/material.dart';
|
|||||||
import '../../../common/theme/theme.dart';
|
import '../../../common/theme/theme.dart';
|
||||||
|
|
||||||
part 'text_form_field.dart';
|
part 'text_form_field.dart';
|
||||||
|
part 'search_text_form_field.dart';
|
||||||
|
|||||||
@ -0,0 +1,58 @@
|
|||||||
|
part of 'field.dart';
|
||||||
|
|
||||||
|
class SearchTextField extends StatelessWidget {
|
||||||
|
final String hintText;
|
||||||
|
final IconData prefixIcon;
|
||||||
|
final TextEditingController? controller;
|
||||||
|
final Function()? onClear;
|
||||||
|
|
||||||
|
const SearchTextField({
|
||||||
|
super.key,
|
||||||
|
required this.hintText,
|
||||||
|
required this.prefixIcon,
|
||||||
|
this.controller,
|
||||||
|
this.onClear,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
margin: EdgeInsets.fromLTRB(16, 0, 16, 16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColor.white,
|
||||||
|
borderRadius: BorderRadius.circular(25),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.05),
|
||||||
|
blurRadius: 10,
|
||||||
|
offset: Offset(0, 2),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: TextField(
|
||||||
|
cursorColor: AppColor.primary,
|
||||||
|
controller: controller,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: hintText,
|
||||||
|
hintStyle: TextStyle(color: AppColor.textLight, fontSize: 14),
|
||||||
|
disabledBorder: InputBorder.none,
|
||||||
|
enabledBorder: InputBorder.none,
|
||||||
|
errorBorder: InputBorder.none,
|
||||||
|
focusedBorder: InputBorder.none,
|
||||||
|
prefixIcon: Container(
|
||||||
|
margin: EdgeInsets.all(12),
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColor.primary,
|
||||||
|
borderRadius: BorderRadius.circular(6),
|
||||||
|
),
|
||||||
|
child: Icon(prefixIcon, color: AppColor.white, size: 14),
|
||||||
|
),
|
||||||
|
border: InputBorder.none,
|
||||||
|
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -43,7 +43,7 @@ class ImagePlaceholder extends StatelessWidget {
|
|||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: minDimension < 100
|
child: minDimension < 150
|
||||||
? _buildSimpleVersion(minDimension)
|
? _buildSimpleVersion(minDimension)
|
||||||
: _buildDetailedVersion(minDimension),
|
: _buildDetailedVersion(minDimension),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import '../../../../../router/app_router.gr.dart';
|
||||||
import 'feature_card.dart';
|
import 'feature_card.dart';
|
||||||
|
|
||||||
class HomeFeatureSection extends StatelessWidget {
|
class HomeFeatureSection extends StatelessWidget {
|
||||||
@ -27,7 +29,7 @@ class HomeFeatureSection extends StatelessWidget {
|
|||||||
icon: Icons.store,
|
icon: Icons.store,
|
||||||
title: 'Merchant',
|
title: 'Merchant',
|
||||||
iconColor: const Color(0xFF388E3C),
|
iconColor: const Color(0xFF388E3C),
|
||||||
onTap: () => print('Navigate to Merchant'),
|
onTap: () => context.router.push(MerchantRoute()),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../../../../common/theme/theme.dart';
|
import '../../../../../../common/theme/theme.dart';
|
||||||
|
import '../../../../../router/app_router.gr.dart';
|
||||||
import 'popular_merchant_card.dart';
|
import 'popular_merchant_card.dart';
|
||||||
|
|
||||||
class HomePopularMerchantSection extends StatelessWidget {
|
class HomePopularMerchantSection extends StatelessWidget {
|
||||||
@ -19,22 +21,25 @@ class HomePopularMerchantSection extends StatelessWidget {
|
|||||||
style: AppStyle.xl.copyWith(fontWeight: FontWeight.bold),
|
style: AppStyle.xl.copyWith(fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
Row(
|
InkWell(
|
||||||
children: [
|
onTap: () => context.router.push(MerchantRoute()),
|
||||||
Text(
|
child: Row(
|
||||||
'Lihat Semua',
|
children: [
|
||||||
style: AppStyle.sm.copyWith(
|
Text(
|
||||||
fontWeight: FontWeight.w500,
|
'Lihat Semua',
|
||||||
|
style: AppStyle.sm.copyWith(
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: AppColor.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 4),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_forward_ios,
|
||||||
|
size: 12,
|
||||||
color: AppColor.primary,
|
color: AppColor.primary,
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
SizedBox(width: 4),
|
),
|
||||||
Icon(
|
|
||||||
Icons.arrow_forward_ios,
|
|
||||||
size: 12,
|
|
||||||
color: AppColor.primary,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../../../common/theme/theme.dart';
|
import '../../../../../common/theme/theme.dart';
|
||||||
@ -46,8 +47,9 @@ class OrderItem {
|
|||||||
|
|
||||||
enum OrderStatus { pending, processing, completed, cancelled }
|
enum OrderStatus { pending, processing, completed, cancelled }
|
||||||
|
|
||||||
|
@RoutePage()
|
||||||
class OrderPage extends StatefulWidget {
|
class OrderPage extends StatefulWidget {
|
||||||
const OrderPage({Key? key}) : super(key: key);
|
const OrderPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<OrderPage> createState() => _OrderPageState();
|
State<OrderPage> createState() => _OrderPageState();
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:auto_route/auto_route.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../../../common/theme/theme.dart';
|
import '../../../../../common/theme/theme.dart';
|
||||||
|
import '../../../../components/field/field.dart';
|
||||||
import 'widgets/voucher_card.dart';
|
import 'widgets/voucher_card.dart';
|
||||||
|
|
||||||
@RoutePage()
|
@RoutePage()
|
||||||
@ -16,49 +17,9 @@ class VoucherPage extends StatelessWidget {
|
|||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
bottom: PreferredSize(
|
bottom: PreferredSize(
|
||||||
preferredSize: Size.fromHeight(70),
|
preferredSize: Size.fromHeight(70),
|
||||||
child: Container(
|
child: SearchTextField(
|
||||||
margin: EdgeInsets.fromLTRB(16, 0, 16, 16),
|
hintText: 'Punya kode promo? Masukkan disini',
|
||||||
decoration: BoxDecoration(
|
prefixIcon: Icons.local_offer,
|
||||||
color: AppColor.white,
|
|
||||||
borderRadius: BorderRadius.circular(25),
|
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: Colors.black.withOpacity(0.05),
|
|
||||||
blurRadius: 10,
|
|
||||||
offset: Offset(0, 2),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
child: TextField(
|
|
||||||
cursorColor: AppColor.primary,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: 'Punya kode promo? Masukkan disini',
|
|
||||||
hintStyle: TextStyle(color: AppColor.textLight, fontSize: 14),
|
|
||||||
disabledBorder: InputBorder.none,
|
|
||||||
enabledBorder: InputBorder.none,
|
|
||||||
errorBorder: InputBorder.none,
|
|
||||||
focusedBorder: InputBorder.none,
|
|
||||||
prefixIcon: Container(
|
|
||||||
margin: EdgeInsets.all(12),
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColor.primary,
|
|
||||||
borderRadius: BorderRadius.circular(6),
|
|
||||||
),
|
|
||||||
child: Icon(
|
|
||||||
Icons.local_offer,
|
|
||||||
color: AppColor.white,
|
|
||||||
size: 14,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
border: InputBorder.none,
|
|
||||||
contentPadding: EdgeInsets.symmetric(
|
|
||||||
horizontal: 16,
|
|
||||||
vertical: 16,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
193
lib/presentation/pages/merchant/merchant_page.dart
Normal file
193
lib/presentation/pages/merchant/merchant_page.dart
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
import 'package:auto_route/auto_route.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../../common/theme/theme.dart';
|
||||||
|
import '../../components/field/field.dart';
|
||||||
|
import 'widgets/empty_merchant_card.dart';
|
||||||
|
import 'widgets/merchant_card.dart';
|
||||||
|
|
||||||
|
@RoutePage()
|
||||||
|
class MerchantPage extends StatefulWidget {
|
||||||
|
const MerchantPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MerchantPage> createState() => _MerchantPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MerchantPageState extends State<MerchantPage> {
|
||||||
|
final TextEditingController _searchController = TextEditingController();
|
||||||
|
final List<MerchantModel> _allMerchants = _generateMockMerchants();
|
||||||
|
List<MerchantModel> _filteredMerchants = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_filteredMerchants = _allMerchants;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_searchController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _filterMerchants(String query) {
|
||||||
|
setState(() {
|
||||||
|
if (query.isEmpty) {
|
||||||
|
_filteredMerchants = _allMerchants;
|
||||||
|
} else {
|
||||||
|
_filteredMerchants = _allMerchants
|
||||||
|
.where(
|
||||||
|
(merchant) =>
|
||||||
|
merchant.name.toLowerCase().contains(query.toLowerCase()) ||
|
||||||
|
merchant.category.toLowerCase().contains(query.toLowerCase()),
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColor.background,
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text('Merchants'),
|
||||||
|
bottom: PreferredSize(
|
||||||
|
preferredSize: const Size.fromHeight(70),
|
||||||
|
child: SearchTextField(
|
||||||
|
hintText: 'Search merchants...',
|
||||||
|
prefixIcon: Icons.search,
|
||||||
|
controller: _searchController,
|
||||||
|
onClear: () {
|
||||||
|
_searchController.clear();
|
||||||
|
_filterMerchants('');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: _filteredMerchants.isEmpty
|
||||||
|
? _buildEmptyState()
|
||||||
|
: Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: GridView.builder(
|
||||||
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 2,
|
||||||
|
crossAxisSpacing: 16,
|
||||||
|
mainAxisSpacing: 16,
|
||||||
|
childAspectRatio: 0.85,
|
||||||
|
),
|
||||||
|
itemCount: _filteredMerchants.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return _buildMerchantCard(_filteredMerchants[index]);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildMerchantCard(MerchantModel merchant) {
|
||||||
|
return MerchantCard(
|
||||||
|
merchant: merchant,
|
||||||
|
onTap: () {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text('Selected ${merchant.name}'),
|
||||||
|
backgroundColor: AppColor.primary,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildEmptyState() {
|
||||||
|
return const EmptyMerchantCard();
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<MerchantModel> _generateMockMerchants() {
|
||||||
|
return [
|
||||||
|
MerchantModel(
|
||||||
|
id: '1',
|
||||||
|
name: 'Warung Makan Sederhana',
|
||||||
|
category: 'Food & Beverage',
|
||||||
|
rating: 4.5,
|
||||||
|
isOpen: true,
|
||||||
|
imageUrl: 'https://via.placeholder.com/150',
|
||||||
|
),
|
||||||
|
MerchantModel(
|
||||||
|
id: '2',
|
||||||
|
name: 'Toko Elektronik',
|
||||||
|
category: 'Electronics',
|
||||||
|
rating: 4.2,
|
||||||
|
isOpen: true,
|
||||||
|
imageUrl: 'https://via.placeholder.com/150',
|
||||||
|
),
|
||||||
|
MerchantModel(
|
||||||
|
id: '3',
|
||||||
|
name: 'Apotek Sehat',
|
||||||
|
category: 'Healthcare',
|
||||||
|
rating: 4.8,
|
||||||
|
isOpen: false,
|
||||||
|
imageUrl: 'https://via.placeholder.com/150',
|
||||||
|
),
|
||||||
|
MerchantModel(
|
||||||
|
id: '4',
|
||||||
|
name: 'Fashion Store',
|
||||||
|
category: 'Clothing',
|
||||||
|
rating: 4.1,
|
||||||
|
isOpen: true,
|
||||||
|
imageUrl: 'https://via.placeholder.com/150',
|
||||||
|
),
|
||||||
|
MerchantModel(
|
||||||
|
id: '5',
|
||||||
|
name: 'Bengkel Motor',
|
||||||
|
category: 'Automotive',
|
||||||
|
rating: 4.3,
|
||||||
|
isOpen: true,
|
||||||
|
imageUrl: 'https://via.placeholder.com/150',
|
||||||
|
),
|
||||||
|
MerchantModel(
|
||||||
|
id: '6',
|
||||||
|
name: 'Minimarket 24',
|
||||||
|
category: 'Retail',
|
||||||
|
rating: 4.0,
|
||||||
|
isOpen: true,
|
||||||
|
imageUrl: 'https://via.placeholder.com/150',
|
||||||
|
),
|
||||||
|
MerchantModel(
|
||||||
|
id: '7',
|
||||||
|
name: 'Salon Kecantikan',
|
||||||
|
category: 'Beauty',
|
||||||
|
rating: 4.6,
|
||||||
|
isOpen: false,
|
||||||
|
imageUrl: 'https://via.placeholder.com/150',
|
||||||
|
),
|
||||||
|
MerchantModel(
|
||||||
|
id: '8',
|
||||||
|
name: 'Laundry Express',
|
||||||
|
category: 'Service',
|
||||||
|
rating: 4.4,
|
||||||
|
isOpen: true,
|
||||||
|
imageUrl: 'https://via.placeholder.com/150',
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MerchantModel {
|
||||||
|
final String id;
|
||||||
|
final String name;
|
||||||
|
final String category;
|
||||||
|
final double rating;
|
||||||
|
final bool isOpen;
|
||||||
|
final String imageUrl;
|
||||||
|
|
||||||
|
MerchantModel({
|
||||||
|
required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.category,
|
||||||
|
required this.rating,
|
||||||
|
required this.isOpen,
|
||||||
|
required this.imageUrl,
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -0,0 +1,80 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../../../common/theme/theme.dart';
|
||||||
|
|
||||||
|
class EmptyMerchantCard extends StatelessWidget {
|
||||||
|
final String? title;
|
||||||
|
final String? subtitle;
|
||||||
|
final IconData? icon;
|
||||||
|
|
||||||
|
const EmptyMerchantCard({super.key, this.title, this.subtitle, this.icon});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 120,
|
||||||
|
height: 120,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColor.primaryWithOpacity(0.1),
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
icon ?? Icons.search_off,
|
||||||
|
size: 64,
|
||||||
|
color: AppColor.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
Text(
|
||||||
|
title ?? 'No merchants found',
|
||||||
|
style: AppStyle.xl.copyWith(
|
||||||
|
color: AppColor.textPrimary,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 32),
|
||||||
|
child: Text(
|
||||||
|
subtitle ??
|
||||||
|
'Try adjusting your search terms or check back later for new merchants',
|
||||||
|
style: AppStyle.md.copyWith(color: AppColor.textSecondary),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColor.primaryWithOpacity(0.1),
|
||||||
|
borderRadius: BorderRadius.circular(24),
|
||||||
|
border: Border.all(
|
||||||
|
color: AppColor.primary.withOpacity(0.2),
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.refresh, size: 18, color: AppColor.primary),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
'Refresh',
|
||||||
|
style: AppStyle.sm.copyWith(
|
||||||
|
color: AppColor.primary,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
175
lib/presentation/pages/merchant/widgets/merchant_card.dart
Normal file
175
lib/presentation/pages/merchant/widgets/merchant_card.dart
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../../../common/theme/theme.dart';
|
||||||
|
import '../../../components/image/image.dart';
|
||||||
|
import '../merchant_page.dart';
|
||||||
|
|
||||||
|
class MerchantCard extends StatelessWidget {
|
||||||
|
final MerchantModel merchant;
|
||||||
|
final VoidCallback? onTap;
|
||||||
|
|
||||||
|
const MerchantCard({super.key, required this.merchant, this.onTap});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColor.surface,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
border: Border.all(color: AppColor.borderLight, width: 0.5),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: AppColor.textSecondary.withOpacity(0.08),
|
||||||
|
blurRadius: 6,
|
||||||
|
offset: const Offset(0, 1),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: onTap,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
// Merchant Image/Icon - Made more compact
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 100,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(8),
|
||||||
|
topRight: Radius.circular(8),
|
||||||
|
),
|
||||||
|
child: Image.network(
|
||||||
|
merchant.imageUrl,
|
||||||
|
width: double.infinity,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
loadingBuilder: (context, child, loadingProgress) {
|
||||||
|
if (loadingProgress == null) return child;
|
||||||
|
return Center(
|
||||||
|
child: SizedBox(
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 2,
|
||||||
|
color: AppColor.primary,
|
||||||
|
value: loadingProgress.expectedTotalBytes != null
|
||||||
|
? loadingProgress.cumulativeBytesLoaded /
|
||||||
|
loadingProgress.expectedTotalBytes!
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
errorBuilder: (context, error, stackTrace) {
|
||||||
|
return ImagePlaceholder(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 100,
|
||||||
|
showBorderRadius: false,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
// Merchant Name - Flexible to prevent overflow
|
||||||
|
Flexible(
|
||||||
|
child: Text(
|
||||||
|
merchant.name,
|
||||||
|
style: AppStyle.md.copyWith(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: AppColor.textPrimary,
|
||||||
|
height: 1.2,
|
||||||
|
),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 3),
|
||||||
|
|
||||||
|
// Category - More compact
|
||||||
|
Text(
|
||||||
|
merchant.category,
|
||||||
|
style: AppStyle.xs.copyWith(
|
||||||
|
color: AppColor.textSecondary,
|
||||||
|
height: 1.2,
|
||||||
|
),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
|
||||||
|
// Rating and Status - Compact layout
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
// Rating
|
||||||
|
Flexible(
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.star_rounded,
|
||||||
|
size: 14,
|
||||||
|
color: AppColor.warning,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 3),
|
||||||
|
Text(
|
||||||
|
merchant.rating.toStringAsFixed(1),
|
||||||
|
style: AppStyle.xs.copyWith(
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: AppColor.textPrimary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Status Badge - More compact
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 6,
|
||||||
|
vertical: 2,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: merchant.isOpen
|
||||||
|
? AppColor.successWithOpacity(0.12)
|
||||||
|
: AppColor.errorWithOpacity(0.12),
|
||||||
|
borderRadius: BorderRadius.circular(6),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
merchant.isOpen ? 'Open' : 'Closed',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 10,
|
||||||
|
color: merchant.isOpen
|
||||||
|
? AppColor.success
|
||||||
|
: AppColor.error,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
height: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -27,5 +27,8 @@ class AppRouter extends RootStackRouter {
|
|||||||
AutoRoute(page: ProfileRoute.page),
|
AutoRoute(page: ProfileRoute.page),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Merchant
|
||||||
|
AutoRoute(page: MerchantRoute.page),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,35 +9,36 @@
|
|||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
|
|
||||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
import 'package:auto_route/auto_route.dart' as _i12;
|
import 'package:auto_route/auto_route.dart' as _i13;
|
||||||
import 'package:enaklo/presentation/pages/auth/login/login_page.dart' as _i2;
|
import 'package:enaklo/presentation/pages/auth/login/login_page.dart' as _i2;
|
||||||
import 'package:enaklo/presentation/pages/auth/otp/otp_page.dart' as _i6;
|
import 'package:enaklo/presentation/pages/auth/otp/otp_page.dart' as _i7;
|
||||||
import 'package:enaklo/presentation/pages/auth/pin/pin_page.dart' as _i7;
|
import 'package:enaklo/presentation/pages/auth/pin/pin_page.dart' as _i8;
|
||||||
import 'package:enaklo/presentation/pages/auth/register/register_page.dart'
|
import 'package:enaklo/presentation/pages/auth/register/register_page.dart'
|
||||||
as _i9;
|
as _i10;
|
||||||
import 'package:enaklo/presentation/pages/main/main_page.dart' as _i3;
|
import 'package:enaklo/presentation/pages/main/main_page.dart' as _i3;
|
||||||
import 'package:enaklo/presentation/pages/main/pages/home/home_page.dart'
|
import 'package:enaklo/presentation/pages/main/pages/home/home_page.dart'
|
||||||
as _i1;
|
as _i1;
|
||||||
import 'package:enaklo/presentation/pages/main/pages/order/order_page.dart'
|
import 'package:enaklo/presentation/pages/main/pages/order/order_page.dart'
|
||||||
as _i5;
|
as _i6;
|
||||||
import 'package:enaklo/presentation/pages/main/pages/profile/profile_page.dart'
|
import 'package:enaklo/presentation/pages/main/pages/profile/profile_page.dart'
|
||||||
as _i8;
|
as _i9;
|
||||||
import 'package:enaklo/presentation/pages/main/pages/voucher/voucher_page.dart'
|
import 'package:enaklo/presentation/pages/main/pages/voucher/voucher_page.dart'
|
||||||
as _i11;
|
as _i12;
|
||||||
|
import 'package:enaklo/presentation/pages/merchant/merchant_page.dart' as _i4;
|
||||||
import 'package:enaklo/presentation/pages/onboarding/onboarding_page.dart'
|
import 'package:enaklo/presentation/pages/onboarding/onboarding_page.dart'
|
||||||
as _i4;
|
as _i5;
|
||||||
import 'package:enaklo/presentation/pages/splash/splash_page.dart' as _i10;
|
import 'package:enaklo/presentation/pages/splash/splash_page.dart' as _i11;
|
||||||
import 'package:flutter/material.dart' as _i13;
|
import 'package:flutter/material.dart' as _i14;
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i1.HomePage]
|
/// [_i1.HomePage]
|
||||||
class HomeRoute extends _i12.PageRouteInfo<void> {
|
class HomeRoute extends _i13.PageRouteInfo<void> {
|
||||||
const HomeRoute({List<_i12.PageRouteInfo>? children})
|
const HomeRoute({List<_i13.PageRouteInfo>? children})
|
||||||
: super(HomeRoute.name, initialChildren: children);
|
: super(HomeRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'HomeRoute';
|
static const String name = 'HomeRoute';
|
||||||
|
|
||||||
static _i12.PageInfo page = _i12.PageInfo(
|
static _i13.PageInfo page = _i13.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i1.HomePage();
|
return const _i1.HomePage();
|
||||||
@ -47,13 +48,13 @@ class HomeRoute extends _i12.PageRouteInfo<void> {
|
|||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i2.LoginPage]
|
/// [_i2.LoginPage]
|
||||||
class LoginRoute extends _i12.PageRouteInfo<void> {
|
class LoginRoute extends _i13.PageRouteInfo<void> {
|
||||||
const LoginRoute({List<_i12.PageRouteInfo>? children})
|
const LoginRoute({List<_i13.PageRouteInfo>? children})
|
||||||
: super(LoginRoute.name, initialChildren: children);
|
: super(LoginRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'LoginRoute';
|
static const String name = 'LoginRoute';
|
||||||
|
|
||||||
static _i12.PageInfo page = _i12.PageInfo(
|
static _i13.PageInfo page = _i13.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i2.LoginPage();
|
return const _i2.LoginPage();
|
||||||
@ -63,13 +64,13 @@ class LoginRoute extends _i12.PageRouteInfo<void> {
|
|||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i3.MainPage]
|
/// [_i3.MainPage]
|
||||||
class MainRoute extends _i12.PageRouteInfo<void> {
|
class MainRoute extends _i13.PageRouteInfo<void> {
|
||||||
const MainRoute({List<_i12.PageRouteInfo>? children})
|
const MainRoute({List<_i13.PageRouteInfo>? children})
|
||||||
: super(MainRoute.name, initialChildren: children);
|
: super(MainRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'MainRoute';
|
static const String name = 'MainRoute';
|
||||||
|
|
||||||
static _i12.PageInfo page = _i12.PageInfo(
|
static _i13.PageInfo page = _i13.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i3.MainPage();
|
return const _i3.MainPage();
|
||||||
@ -78,61 +79,77 @@ class MainRoute extends _i12.PageRouteInfo<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i4.OnboardingPage]
|
/// [_i4.MerchantPage]
|
||||||
class OnboardingRoute extends _i12.PageRouteInfo<void> {
|
class MerchantRoute extends _i13.PageRouteInfo<void> {
|
||||||
const OnboardingRoute({List<_i12.PageRouteInfo>? children})
|
const MerchantRoute({List<_i13.PageRouteInfo>? children})
|
||||||
|
: super(MerchantRoute.name, initialChildren: children);
|
||||||
|
|
||||||
|
static const String name = 'MerchantRoute';
|
||||||
|
|
||||||
|
static _i13.PageInfo page = _i13.PageInfo(
|
||||||
|
name,
|
||||||
|
builder: (data) {
|
||||||
|
return const _i4.MerchantPage();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// generated route for
|
||||||
|
/// [_i5.OnboardingPage]
|
||||||
|
class OnboardingRoute extends _i13.PageRouteInfo<void> {
|
||||||
|
const OnboardingRoute({List<_i13.PageRouteInfo>? children})
|
||||||
: super(OnboardingRoute.name, initialChildren: children);
|
: super(OnboardingRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'OnboardingRoute';
|
static const String name = 'OnboardingRoute';
|
||||||
|
|
||||||
static _i12.PageInfo page = _i12.PageInfo(
|
static _i13.PageInfo page = _i13.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i4.OnboardingPage();
|
return const _i5.OnboardingPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i5.OrderPage]
|
/// [_i6.OrderPage]
|
||||||
class OrderRoute extends _i12.PageRouteInfo<void> {
|
class OrderRoute extends _i13.PageRouteInfo<void> {
|
||||||
const OrderRoute({List<_i12.PageRouteInfo>? children})
|
const OrderRoute({List<_i13.PageRouteInfo>? children})
|
||||||
: super(OrderRoute.name, initialChildren: children);
|
: super(OrderRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'OrderRoute';
|
static const String name = 'OrderRoute';
|
||||||
|
|
||||||
static _i12.PageInfo page = _i12.PageInfo(
|
static _i13.PageInfo page = _i13.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i5.OrderPage();
|
return const _i6.OrderPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i6.OtpPage]
|
/// [_i7.OtpPage]
|
||||||
class OtpRoute extends _i12.PageRouteInfo<void> {
|
class OtpRoute extends _i13.PageRouteInfo<void> {
|
||||||
const OtpRoute({List<_i12.PageRouteInfo>? children})
|
const OtpRoute({List<_i13.PageRouteInfo>? children})
|
||||||
: super(OtpRoute.name, initialChildren: children);
|
: super(OtpRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'OtpRoute';
|
static const String name = 'OtpRoute';
|
||||||
|
|
||||||
static _i12.PageInfo page = _i12.PageInfo(
|
static _i13.PageInfo page = _i13.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i6.OtpPage();
|
return const _i7.OtpPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i7.PinPage]
|
/// [_i8.PinPage]
|
||||||
class PinRoute extends _i12.PageRouteInfo<PinRouteArgs> {
|
class PinRoute extends _i13.PageRouteInfo<PinRouteArgs> {
|
||||||
PinRoute({
|
PinRoute({
|
||||||
_i13.Key? key,
|
_i14.Key? key,
|
||||||
bool isCreatePin = true,
|
bool isCreatePin = true,
|
||||||
String? title,
|
String? title,
|
||||||
List<_i12.PageRouteInfo>? children,
|
List<_i13.PageRouteInfo>? children,
|
||||||
}) : super(
|
}) : super(
|
||||||
PinRoute.name,
|
PinRoute.name,
|
||||||
args: PinRouteArgs(key: key, isCreatePin: isCreatePin, title: title),
|
args: PinRouteArgs(key: key, isCreatePin: isCreatePin, title: title),
|
||||||
@ -141,13 +158,13 @@ class PinRoute extends _i12.PageRouteInfo<PinRouteArgs> {
|
|||||||
|
|
||||||
static const String name = 'PinRoute';
|
static const String name = 'PinRoute';
|
||||||
|
|
||||||
static _i12.PageInfo page = _i12.PageInfo(
|
static _i13.PageInfo page = _i13.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
final args = data.argsAs<PinRouteArgs>(
|
final args = data.argsAs<PinRouteArgs>(
|
||||||
orElse: () => const PinRouteArgs(),
|
orElse: () => const PinRouteArgs(),
|
||||||
);
|
);
|
||||||
return _i7.PinPage(
|
return _i8.PinPage(
|
||||||
key: args.key,
|
key: args.key,
|
||||||
isCreatePin: args.isCreatePin,
|
isCreatePin: args.isCreatePin,
|
||||||
title: args.title,
|
title: args.title,
|
||||||
@ -159,7 +176,7 @@ class PinRoute extends _i12.PageRouteInfo<PinRouteArgs> {
|
|||||||
class PinRouteArgs {
|
class PinRouteArgs {
|
||||||
const PinRouteArgs({this.key, this.isCreatePin = true, this.title});
|
const PinRouteArgs({this.key, this.isCreatePin = true, this.title});
|
||||||
|
|
||||||
final _i13.Key? key;
|
final _i14.Key? key;
|
||||||
|
|
||||||
final bool isCreatePin;
|
final bool isCreatePin;
|
||||||
|
|
||||||
@ -172,65 +189,65 @@ class PinRouteArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i8.ProfilePage]
|
/// [_i9.ProfilePage]
|
||||||
class ProfileRoute extends _i12.PageRouteInfo<void> {
|
class ProfileRoute extends _i13.PageRouteInfo<void> {
|
||||||
const ProfileRoute({List<_i12.PageRouteInfo>? children})
|
const ProfileRoute({List<_i13.PageRouteInfo>? children})
|
||||||
: super(ProfileRoute.name, initialChildren: children);
|
: super(ProfileRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'ProfileRoute';
|
static const String name = 'ProfileRoute';
|
||||||
|
|
||||||
static _i12.PageInfo page = _i12.PageInfo(
|
static _i13.PageInfo page = _i13.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i8.ProfilePage();
|
return const _i9.ProfilePage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i9.RegisterPage]
|
/// [_i10.RegisterPage]
|
||||||
class RegisterRoute extends _i12.PageRouteInfo<void> {
|
class RegisterRoute extends _i13.PageRouteInfo<void> {
|
||||||
const RegisterRoute({List<_i12.PageRouteInfo>? children})
|
const RegisterRoute({List<_i13.PageRouteInfo>? children})
|
||||||
: super(RegisterRoute.name, initialChildren: children);
|
: super(RegisterRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'RegisterRoute';
|
static const String name = 'RegisterRoute';
|
||||||
|
|
||||||
static _i12.PageInfo page = _i12.PageInfo(
|
static _i13.PageInfo page = _i13.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i9.RegisterPage();
|
return const _i10.RegisterPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i10.SplashPage]
|
/// [_i11.SplashPage]
|
||||||
class SplashRoute extends _i12.PageRouteInfo<void> {
|
class SplashRoute extends _i13.PageRouteInfo<void> {
|
||||||
const SplashRoute({List<_i12.PageRouteInfo>? children})
|
const SplashRoute({List<_i13.PageRouteInfo>? children})
|
||||||
: super(SplashRoute.name, initialChildren: children);
|
: super(SplashRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'SplashRoute';
|
static const String name = 'SplashRoute';
|
||||||
|
|
||||||
static _i12.PageInfo page = _i12.PageInfo(
|
static _i13.PageInfo page = _i13.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i10.SplashPage();
|
return const _i11.SplashPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i11.VoucherPage]
|
/// [_i12.VoucherPage]
|
||||||
class VoucherRoute extends _i12.PageRouteInfo<void> {
|
class VoucherRoute extends _i13.PageRouteInfo<void> {
|
||||||
const VoucherRoute({List<_i12.PageRouteInfo>? children})
|
const VoucherRoute({List<_i13.PageRouteInfo>? children})
|
||||||
: super(VoucherRoute.name, initialChildren: children);
|
: super(VoucherRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'VoucherRoute';
|
static const String name = 'VoucherRoute';
|
||||||
|
|
||||||
static _i12.PageInfo page = _i12.PageInfo(
|
static _i13.PageInfo page = _i13.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i11.VoucherPage();
|
return const _i12.VoucherPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user