QueenFruits/Mobile Operasional/lib/features/customer/presentation/screens/customer_addresses_screen.dart

154 lines
6.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:niogu_app/core/components/top_back_bar_app.dart';
import 'package:niogu_app/core/constants/app_color.dart';
import 'package:niogu_app/core/constants/app_font_size.dart';
import 'package:niogu_app/core/router/app_route.dart';
import 'package:niogu_app/features/customer/domain/entities/customer.dart';
import 'package:sizer/sizer.dart';
class CustomerAddressesScreen extends ConsumerWidget {
final List<CustomerAddress> addresses;
const CustomerAddressesScreen({super.key, required this.addresses});
@override
Widget build(BuildContext context, WidgetRef ref) {
return LayoutBuilder(
builder: (context, constraints) {
final bool isTablet = 100.w >= 600;
return SafeArea(
top: false,
bottom: true,
right: false,
left: false,
child: Scaffold(
backgroundColor: const Color(0xFFF9FAFB),
appBar: TopBackBarApp(
title: "Alamat",
onTap: () => context.pop(),
),
body: ListView.builder(
padding: EdgeInsets.all(4.w),
itemCount: addresses.length,
itemBuilder: (context, index) {
final address = addresses[index];
return Container(
margin: EdgeInsets.only(bottom: 2.h),
padding: EdgeInsets.all(4.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(2.5.w),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.03),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
border: Border.all(color: Colors.grey.shade100),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
padding: EdgeInsets.all(2.w),
decoration: BoxDecoration(
color: AppColor.primaryColor.withOpacity(0.1),
shape: BoxShape.circle,
),
child: Icon(
Icons.location_on,
color: AppColor.primaryColor,
size: 5.w,
),
),
SizedBox(width: 3.w),
Text(
address.label,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: isTablet
? (AppFontSize.medium - 1.25).sp
: (AppFontSize.small - 1.25).sp,
),
),
],
),
SizedBox(height: 1.5.h),
Text(
address.fullAddress,
style: TextStyle(
fontSize: isTablet
? (AppFontSize.medium - 1.25).sp
: (AppFontSize.small - 1.25).sp,
color: Colors.grey[700],
height: 1.4,
),
),
SizedBox(height: 1.5.h),
Divider(color: Colors.grey[100]),
SizedBox(height: 1.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Icon(
Icons.straighten_rounded,
size: 5.w,
color: Colors.grey,
),
SizedBox(width: 1.5.w),
Text(
"16.50 km",
style: TextStyle(
fontSize: isTablet
? (AppFontSize.medium - 1.25).sp
: (AppFontSize.small - 1.25).sp,
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
],
),
TextButton.icon(
onPressed: () {
context.pushNamed(
AppRoute.mapCustomerAddressScreen,
extra: address,
);
},
icon: Icon(
Icons.map_outlined,
color: AppColor.primaryColor,
size: 5.w,
),
label: Text(
"Lihat di Peta",
style: TextStyle(
color: AppColor.primaryColor,
fontSize: AppFontSize.small.sp,
fontWeight: FontWeight.bold,
),
),
),
],
),
],
),
);
},
),
),
);
},
);
}
}