update the app

This commit is contained in:
root
2026-05-25 15:56:00 -04:00
parent 277db06d26
commit 7ca43ba2f3
19 changed files with 1854 additions and 210 deletions
@@ -0,0 +1,21 @@
import '../../../core/models/marketplace.dart';
class BookingResult {
final String reservationId;
final MarketplaceVehicle vehicle;
final DateTime startDate;
final DateTime endDate;
const BookingResult({
required this.reservationId,
required this.vehicle,
required this.startDate,
required this.endDate,
});
int get days => endDate.difference(startDate).inDays.clamp(1, 9999);
double get total => vehicle.dailyRateCents * days / 100;
String get shortRef => reservationId.length >= 8
? reservationId.substring(0, 8).toUpperCase()
: reservationId.toUpperCase();
}
@@ -0,0 +1,223 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:intl/intl.dart';
import '../models/booking_result.dart';
const _orange = Color(0xFFFF6B00);
const _blue = Color(0xFF1A56DB);
class BookingConfirmationScreen extends StatelessWidget {
final BookingResult result;
const BookingConfirmationScreen({super.key, required this.result});
@override
Widget build(BuildContext context) {
final fmt = DateFormat('MMM d, yyyy');
final cs = Theme.of(context).colorScheme;
return Scaffold(
appBar: AppBar(
title: const Text('Booking Confirmed'),
),
body: SingleChildScrollView(
padding: const EdgeInsets.fromLTRB(24, 32, 24, 40),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// Success badge
Container(
padding: const EdgeInsets.all(28),
decoration: const BoxDecoration(
color: Color(0xFFDEF7EC),
shape: BoxShape.circle,
),
child: const Icon(
Icons.check_circle_outline_rounded,
color: Color(0xFF057A55),
size: 60,
),
),
const SizedBox(height: 24),
const Text(
'Booking Confirmed!',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
Text(
result.vehicle.displayName,
style: TextStyle(color: cs.onSurfaceVariant, fontSize: 16),
textAlign: TextAlign.center,
),
Text(
result.vehicle.company.brand.displayName,
style: TextStyle(color: cs.onSurfaceVariant, fontSize: 13),
),
const SizedBox(height: 32),
// Booking summary card
Container(
width: double.infinity,
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: cs.surfaceContainerHigh,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: cs.outlineVariant),
),
child: Column(
children: [
// Reference number
Container(
padding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 10,
),
decoration: BoxDecoration(
color: _blue.withValues(alpha: 0.08),
borderRadius: BorderRadius.circular(10),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Booking Reference',
style: TextStyle(
color: cs.onSurfaceVariant,
fontSize: 13,
),
),
Text(
result.shortRef,
style: const TextStyle(
color: _blue,
fontWeight: FontWeight.bold,
fontSize: 17,
letterSpacing: 2,
),
),
],
),
),
const SizedBox(height: 16),
_InfoRow(
label: 'Pick-up date',
value: fmt.format(result.startDate),
),
const SizedBox(height: 10),
_InfoRow(
label: 'Drop-off date',
value: fmt.format(result.endDate),
),
const SizedBox(height: 10),
_InfoRow(
label: 'Duration',
value:
'${result.days} day${result.days == 1 ? '' : 's'}',
),
const Divider(height: 24),
_InfoRow(
label: 'Daily rate',
value:
'${result.vehicle.dailyRate.toStringAsFixed(2)} MAD/day',
),
const SizedBox(height: 10),
_InfoRow(
label: 'Total',
value: '${result.total.toStringAsFixed(2)} MAD',
valueStyle: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 17,
),
),
],
),
),
const SizedBox(height: 16),
// Email notice
Container(
padding: const EdgeInsets.all(14),
decoration: BoxDecoration(
color: const Color(0xFFF0F9FF),
borderRadius: BorderRadius.circular(12),
border: Border.all(color: const Color(0xFFBAE6FD)),
),
child: const Row(
children: [
Icon(
Icons.email_outlined,
color: Color(0xFF0369A1),
size: 18,
),
SizedBox(width: 10),
Expanded(
child: Text(
'A confirmation has been sent to your email.',
style: TextStyle(
color: Color(0xFF0369A1),
fontSize: 13,
),
),
),
],
),
),
const SizedBox(height: 32),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: () => context.go('/client'),
style: ElevatedButton.styleFrom(
backgroundColor: _orange,
foregroundColor: Colors.white,
minimumSize: const Size.fromHeight(52),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(14),
),
elevation: 0,
),
child: const Text(
'Search More Cars',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
),
),
],
),
),
);
}
}
class _InfoRow extends StatelessWidget {
final String label;
final String value;
final TextStyle? valueStyle;
const _InfoRow({required this.label, required this.value, this.valueStyle});
@override
Widget build(BuildContext context) {
final cs = Theme.of(context).colorScheme;
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
label,
style: TextStyle(color: cs.onSurfaceVariant, fontSize: 14),
),
Text(
value,
style: valueStyle ??
TextStyle(
color: cs.onSurface,
fontWeight: FontWeight.w600,
fontSize: 14,
),
),
],
);
}
}
+154 -172
View File
@@ -3,8 +3,12 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:intl/intl.dart';
import '../../../core/models/marketplace.dart';
import '../models/booking_result.dart';
import '../providers/client_providers.dart';
const _orange = Color(0xFFFF6B00);
const _blue = Color(0xFF1A56DB);
class BookingScreen extends ConsumerStatefulWidget {
final String vehicleId;
final MarketplaceVehicle? vehicle;
@@ -25,6 +29,7 @@ class _BookingScreenState extends ConsumerState<BookingScreen> {
final _lastNameCtrl = TextEditingController();
final _emailCtrl = TextEditingController();
final _phoneCtrl = TextEditingController();
final _licenseCtrl = TextEditingController();
final _notesCtrl = TextEditingController();
bool _loading = false;
@@ -36,6 +41,7 @@ class _BookingScreenState extends ConsumerState<BookingScreen> {
_lastNameCtrl.dispose();
_emailCtrl.dispose();
_phoneCtrl.dispose();
_licenseCtrl.dispose();
_notesCtrl.dispose();
super.dispose();
}
@@ -45,13 +51,13 @@ class _BookingScreenState extends ConsumerState<BookingScreen> {
final params = ref.read(searchParamsProvider);
if (!params.hasDateRange) {
setState(() => _error = 'Please select dates before booking.');
setState(() => _error = 'Please select rental dates before booking.');
return;
}
final vehicle = widget.vehicle;
if (vehicle == null) {
setState(() => _error = 'Vehicle information missing.');
setState(() => _error = 'Vehicle information missing. Please go back and try again.');
return;
}
@@ -61,6 +67,9 @@ class _BookingScreenState extends ConsumerState<BookingScreen> {
});
try {
final locale = Localizations.localeOf(context).languageCode;
final lang = ['en', 'fr', 'ar'].contains(locale) ? locale : 'en';
final reservationId =
await ref.read(marketplaceServiceProvider).createReservation(
vehicleId: vehicle.id,
@@ -68,110 +77,43 @@ class _BookingScreenState extends ConsumerState<BookingScreen> {
firstName: _firstNameCtrl.text.trim(),
lastName: _lastNameCtrl.text.trim(),
email: _emailCtrl.text.trim(),
phone: _phoneCtrl.text.trim().isEmpty
? null
: _phoneCtrl.text.trim(),
phone: _phoneCtrl.text.trim(),
driverLicense: _licenseCtrl.text.trim(),
startDate: params.startDate!,
endDate: params.endDate!,
notes: _notesCtrl.text.trim().isEmpty
? null
: _notesCtrl.text.trim(),
language: lang,
);
if (mounted) _showSuccess(reservationId, vehicle, params);
if (mounted) {
context.pushReplacement(
'/booking-confirmation',
extra: BookingResult(
reservationId: reservationId,
vehicle: vehicle,
startDate: params.startDate!,
endDate: params.endDate!,
),
);
}
} catch (e) {
setState(() =>
_error = 'Booking failed. Please check your details and try again.');
setState(() => _error = _parseError(e));
} finally {
if (mounted) setState(() => _loading = false);
}
}
void _showSuccess(
String reservationId, MarketplaceVehicle v, SearchParams params) {
final fmt = DateFormat('MMM d, yyyy');
final days = params.endDate!.difference(params.startDate!).inDays;
final total = v.dailyRateCents * days / 100;
showDialog(
context: context,
barrierDismissible: false,
builder: (_) => AlertDialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 8),
Container(
padding: const EdgeInsets.all(16),
decoration: const BoxDecoration(
color: Color(0xFFDEF7EC),
shape: BoxShape.circle,
),
child: const Icon(Icons.check,
color: Color(0xFF057A55), size: 32),
),
const SizedBox(height: 16),
const Text('Booking Confirmed!',
style: TextStyle(
fontSize: 18, fontWeight: FontWeight.bold)),
const SizedBox(height: 8),
Text(
v.displayName,
style: const TextStyle(
color: Color(0xFF6B7280), fontSize: 14),
),
const SizedBox(height: 12),
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: const Color(0xFFF9FAFB),
borderRadius: BorderRadius.circular(10),
),
child: Column(
children: [
_ConfirmRow(
label: 'Dates',
value:
'${fmt.format(params.startDate!)}${fmt.format(params.endDate!)}'),
const SizedBox(height: 6),
_ConfirmRow(
label: 'Duration', value: '$days days'),
const SizedBox(height: 6),
_ConfirmRow(
label: 'Total',
value: '\$${total.toStringAsFixed(2)}'),
const SizedBox(height: 6),
_ConfirmRow(
label: 'Reference',
value: reservationId.substring(0, 8).toUpperCase(),
),
],
),
),
const SizedBox(height: 8),
const Text(
'A confirmation has been sent\nto your email.',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12, color: Color(0xFF9CA3AF)),
),
],
),
actions: [
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: () {
Navigator.pop(context);
context.go('/client');
},
child: const Text('Back to Search'),
),
),
],
),
);
String _parseError(Object e) {
final s = e.toString().toLowerCase();
if (s.contains('unavailable') || s.contains('409')) {
return 'This vehicle is not available for the selected dates.';
}
if (s.contains('socket') || s.contains('connection')) {
return 'Could not reach the server. Check your connection and try again.';
}
return 'Booking failed. Please check your details and try again.';
}
@override
@@ -180,7 +122,7 @@ class _BookingScreenState extends ConsumerState<BookingScreen> {
final params = ref.watch(searchParamsProvider);
final hasDates = params.hasDateRange;
final days = hasDates
? params.endDate!.difference(params.startDate!).inDays
? params.endDate!.difference(params.startDate!).inDays.clamp(1, 9999)
: 0;
final fmt = DateFormat('MMM d, yyyy');
final total = vehicle != null && hasDates
@@ -192,52 +134,55 @@ class _BookingScreenState extends ConsumerState<BookingScreen> {
body: Form(
key: _formKey,
child: ListView(
padding: const EdgeInsets.all(16),
padding: const EdgeInsets.fromLTRB(16, 0, 16, 40),
children: [
// Vehicle summary
if (vehicle != null)
// ── Vehicle summary ───────────────────────────────────────────
if (vehicle != null) ...[
const SizedBox(height: 16),
Card(
margin: const EdgeInsets.only(bottom: 16),
margin: EdgeInsets.zero,
child: Padding(
padding: const EdgeInsets.all(14),
child: Row(
children: [
const Icon(Icons.directions_car,
color: Color(0xFF1A56DB), size: 28),
const Icon(Icons.directions_car, color: _blue, size: 28),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(vehicle.displayName,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 15)),
Text(vehicle.company.brand.displayName,
style: const TextStyle(
color: Color(0xFF6B7280),
fontSize: 12)),
Text(
vehicle.displayName,
style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 15),
),
Text(
vehicle.company.brand.displayName,
style: const TextStyle(
color: Color(0xFF6B7280), fontSize: 12),
),
],
),
),
if (total != null)
Text(
'\$${total.toStringAsFixed(0)}',
'${total.toStringAsFixed(0)} MAD',
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Color(0xFF1A56DB),
color: _blue,
),
),
],
),
),
),
],
// Date summary
if (hasDates)
// ── Date summary ──────────────────────────────────────────────
if (hasDates) ...[
const SizedBox(height: 10),
Container(
margin: const EdgeInsets.only(bottom: 16),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: const Color(0xFFEBF5FF),
@@ -246,23 +191,24 @@ class _BookingScreenState extends ConsumerState<BookingScreen> {
),
child: Row(
children: [
const Icon(Icons.calendar_today,
color: Color(0xFF1A56DB), size: 16),
const Icon(Icons.calendar_today, color: _blue, size: 16),
const SizedBox(width: 10),
Text(
'${fmt.format(params.startDate!)}${fmt.format(params.endDate!)} · $days day${days == 1 ? '' : 's'}',
style: const TextStyle(
color: Color(0xFF1A56DB),
fontWeight: FontWeight.w600,
fontSize: 13,
Expanded(
child: Text(
'${fmt.format(params.startDate!)}${fmt.format(params.endDate!)} · $days day${days == 1 ? '' : 's'}',
style: const TextStyle(
color: _blue,
fontWeight: FontWeight.w600,
fontSize: 13,
),
),
),
],
),
)
else
),
] else ...[
const SizedBox(height: 10),
Container(
margin: const EdgeInsets.only(bottom: 16),
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: const Color(0xFFFDF6B2),
@@ -273,19 +219,23 @@ class _BookingScreenState extends ConsumerState<BookingScreen> {
Icon(Icons.warning_amber,
color: Color(0xFFB45309), size: 16),
SizedBox(width: 8),
Text(
'No dates selected — go back and pick dates',
style: TextStyle(
color: Color(0xFF92400E), fontSize: 13),
Expanded(
child: Text(
'No dates selected — go back and pick dates',
style: TextStyle(
color: Color(0xFF92400E), fontSize: 13),
),
),
],
),
),
],
// ── Error ─────────────────────────────────────────────────────
if (_error != null) ...[
const SizedBox(height: 12),
Container(
padding: const EdgeInsets.all(12),
margin: const EdgeInsets.only(bottom: 16),
decoration: BoxDecoration(
color: const Color(0xFFFDE8E8),
borderRadius: BorderRadius.circular(10),
@@ -295,8 +245,10 @@ class _BookingScreenState extends ConsumerState<BookingScreen> {
),
],
// Personal info
// ── Your information ──────────────────────────────────────────
const SizedBox(height: 24),
const _SectionLabel('Your Information'),
const SizedBox(height: 14),
Row(
children: [
Expanded(
@@ -306,8 +258,7 @@ class _BookingScreenState extends ConsumerState<BookingScreen> {
textInputAction: TextInputAction.next,
decoration:
const InputDecoration(labelText: 'First Name'),
validator: (v) =>
v == null || v.trim().isEmpty ? 'Required' : null,
validator: _required,
),
),
const SizedBox(width: 12),
@@ -318,8 +269,7 @@ class _BookingScreenState extends ConsumerState<BookingScreen> {
textInputAction: TextInputAction.next,
decoration:
const InputDecoration(labelText: 'Last Name'),
validator: (v) =>
v == null || v.trim().isEmpty ? 'Required' : null,
validator: _required,
),
),
],
@@ -333,9 +283,8 @@ class _BookingScreenState extends ConsumerState<BookingScreen> {
labelText: 'Email',
prefixIcon: Icon(Icons.email_outlined),
),
validator: (v) => (v == null || !v.contains('@'))
? 'Enter a valid email'
: null,
validator: (v) =>
(v == null || !v.contains('@')) ? 'Enter a valid email' : null,
),
const SizedBox(height: 14),
TextFormField(
@@ -343,14 +292,26 @@ class _BookingScreenState extends ConsumerState<BookingScreen> {
keyboardType: TextInputType.phone,
textInputAction: TextInputAction.next,
decoration: const InputDecoration(
labelText: 'Phone (optional)',
labelText: 'Phone',
prefixIcon: Icon(Icons.phone_outlined),
),
validator: _required,
),
const SizedBox(height: 14),
TextFormField(
controller: _licenseCtrl,
textCapitalization: TextCapitalization.characters,
textInputAction: TextInputAction.next,
decoration: const InputDecoration(
labelText: "Driver's License Number",
prefixIcon: Icon(Icons.credit_card_outlined),
),
validator: _required,
),
const SizedBox(height: 14),
TextFormField(
controller: _notesCtrl,
maxLines: 2,
maxLines: 3,
textInputAction: TextInputAction.done,
decoration: const InputDecoration(
labelText: 'Notes (optional)',
@@ -358,29 +319,69 @@ class _BookingScreenState extends ConsumerState<BookingScreen> {
alignLabelWithHint: true,
),
),
// ── Info note ─────────────────────────────────────────────────
const SizedBox(height: 16),
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: const Color(0xFFF0F9FF),
borderRadius: BorderRadius.circular(10),
border: Border.all(color: const Color(0xFFBAE6FD)),
),
child: const Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(Icons.info_outline, size: 16, color: Color(0xFF0369A1)),
SizedBox(width: 8),
Expanded(
child: Text(
'Full identity and license details will be collected when you pick up the vehicle.',
style: TextStyle(
color: Color(0xFF0369A1), fontSize: 12),
),
),
],
),
),
// ── Submit ────────────────────────────────────────────────────
const SizedBox(height: 28),
ElevatedButton(
onPressed: (_loading || !hasDates) ? null : _submit,
style: ElevatedButton.styleFrom(
minimumSize: const Size.fromHeight(52)),
backgroundColor: _orange,
foregroundColor: Colors.white,
minimumSize: const Size.fromHeight(52),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(14),
),
elevation: 0,
),
child: _loading
? const SizedBox(
height: 22,
width: 22,
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor:
AlwaysStoppedAnimation<Color>(Colors.white)),
strokeWidth: 2,
valueColor:
AlwaysStoppedAnimation<Color>(Colors.white),
),
)
: const Text('Confirm Booking',
style: TextStyle(fontSize: 16)),
: const Text(
'Confirm Booking',
style: TextStyle(
fontSize: 16, fontWeight: FontWeight.bold),
),
),
const SizedBox(height: 24),
],
),
),
);
}
static String? _required(String? v) =>
v == null || v.trim().isEmpty ? 'Required' : null;
}
class _SectionLabel extends StatelessWidget {
@@ -388,31 +389,12 @@ class _SectionLabel extends StatelessWidget {
const _SectionLabel(this.text);
@override
Widget build(BuildContext context) => Padding(
padding: const EdgeInsets.only(bottom: 12),
child: Text(text,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 15,
color: Color(0xFF374151))),
);
}
class _ConfirmRow extends StatelessWidget {
final String label;
final String value;
const _ConfirmRow({required this.label, required this.value});
@override
Widget build(BuildContext context) => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(label,
style: const TextStyle(
fontSize: 13, color: Color(0xFF6B7280))),
Text(value,
style: const TextStyle(
fontSize: 13, fontWeight: FontWeight.w600)),
],
Widget build(BuildContext context) => Text(
text,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 15,
color: Color(0xFF374151),
),
);
}
@@ -214,7 +214,7 @@ class _ClientHomeScreenState extends ConsumerState<ClientHomeScreen> {
: '${_selectedTypes.length} types';
final priceLabel = _priceFilterActive
? '\$${(_minPriceCents / 100).toStringAsFixed(0)} \$${(_maxPriceCents / 100).toStringAsFixed(0)}/day'
? '${(_minPriceCents / 100).toStringAsFixed(0)} ${(_maxPriceCents / 100).toStringAsFixed(0)} MAD/day'
: l10n.anyPrice;
return ClientShell(
@@ -995,8 +995,8 @@ class _PriceSheetState extends State<_PriceSheet> {
}
String _fmt(double v) => v >= _PriceSheet._cap
? '\$${v.toStringAsFixed(0)}+'
: '\$${v.toStringAsFixed(0)}';
? '${v.toStringAsFixed(0)}+ MAD'
: '${v.toStringAsFixed(0)} MAD';
@override
Widget build(BuildContext context) {
@@ -42,8 +42,6 @@ class _DetailView extends StatelessWidget {
? searchParams.endDate!.difference(searchParams.startDate!).inDays
: null;
final fmt = DateFormat('MMM d, yyyy');
final baseUrl = AppConstants.baseUrl.replaceAll('/api/v1', '');
return Scaffold(
body: CustomScrollView(
slivers: [
@@ -53,9 +51,8 @@ class _DetailView extends StatelessWidget {
flexibleSpace: FlexibleSpaceBar(
background: vehicle.primaryPhoto != null
? CachedNetworkImage(
imageUrl: vehicle.primaryPhoto!.startsWith('http')
? vehicle.primaryPhoto!
: '$baseUrl${vehicle.primaryPhoto!}',
imageUrl:
AppConstants.resolveMediaUrl(vehicle.primaryPhoto!),
fit: BoxFit.cover,
errorWidget: (_, _, _) => _placeholder(),
)
@@ -135,7 +132,7 @@ class _DetailView extends StatelessWidget {
fontSize: 13)),
const Spacer(),
Text(
'\$${vehicle.dailyRate.toStringAsFixed(2)}/day',
'${vehicle.dailyRate.toStringAsFixed(2)} MAD/day',
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
@@ -173,7 +170,7 @@ class _DetailView extends StatelessWidget {
fontWeight: FontWeight.w600)),
const Spacer(),
Text(
'\$${(vehicle.dailyRateCents * days / 100).toStringAsFixed(2)}',
'${(vehicle.dailyRateCents * days / 100).toStringAsFixed(2)} MAD',
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
@@ -1,5 +1,3 @@
import 'dart:io';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import '../../../../core/models/marketplace.dart';
@@ -142,7 +140,7 @@ class MarketplaceVehicleCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
'\$${vehicle.dailyRate.toStringAsFixed(0)}',
'${vehicle.dailyRate.toStringAsFixed(0)} MAD',
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
@@ -166,7 +164,7 @@ class MarketplaceVehicleCard extends StatelessWidget {
color: cs.onSurfaceVariant),
),
Text(
'\$${(totalCents / 100).toStringAsFixed(0)} total',
'${(totalCents / 100).toStringAsFixed(0)} MAD total',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 14,
@@ -211,15 +209,7 @@ class _VehicleImage extends StatelessWidget {
);
}
String _resolveUrl(String photo) {
if (!photo.startsWith('http')) {
return '${AppConstants.baseUrl.replaceAll('/api/v1', '')}$photo';
}
if (Platform.isAndroid) {
return photo.replaceFirst('localhost', '10.0.2.2');
}
return photo;
}
String _resolveUrl(String photo) => AppConstants.resolveMediaUrl(photo);
Widget _placeholder() => Container(
height: 180,