update the app
This commit is contained in:
@@ -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,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user