import 'package:flutter/material.dart'; class DriverDetailsPage extends StatefulWidget { var driverDetails; var status; DriverDetailsPage({this.driverDetails, this.status}); @override State createState() => _DriverDetailsPageState(); } class _DriverDetailsPageState extends State { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, appBar: AppBar( backgroundColor: Colors.white, elevation: 0, leading: IconButton( icon: const Icon(Icons.arrow_back_ios, color: Colors.black), onPressed: () => Navigator.pop(context), ), title: Text( widget.driverDetails.driver_name.isNotEmpty ? widget.driverDetails.driver_name[0].toUpperCase() + widget.driverDetails.driver_name.substring(1) : '', style: TextStyle( color: Colors.black, fontSize: 16, fontWeight: FontWeight.w600, ), ), centerTitle: false, actions: [ TextButton( onPressed: () {}, child: const Text( "HELP", style: TextStyle( color: Color(0xFF4F46E5), fontWeight: FontWeight.w600, fontSize: 14, ), ), ), ], ), body: SingleChildScrollView( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // 👤 Driver Profile Card Container( padding: const EdgeInsets.all(16), decoration: BoxDecoration( color: const Color(0xFFF4F0FF), borderRadius: BorderRadius.circular(12), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ const CircleAvatar( radius: 30, backgroundColor: Colors.grey, backgroundImage: AssetImage('images/avatar.png'), ), const SizedBox(width: 12), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // Status Chip Container( padding: const EdgeInsets.symmetric( horizontal: 8, vertical: 2), decoration: BoxDecoration( color: const Color(0xFFE8FFF0), borderRadius: BorderRadius.circular(12), border: Border.all( color: const Color(0xFF0A9E04), width: 0.8), ), child: const Text( "available", style: TextStyle( fontSize: 11, fontWeight: FontWeight.w600, color: Color(0xFF0A9E04), ), ), ), const SizedBox(height: 4), Text( widget.driverDetails.driver_name, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w700, color: Colors.black, ), ), const SizedBox(height: 2), const Text( "+91 789456212 • +91 789456212", style: TextStyle( fontSize: 13, color: Colors.black54, ), ), ], ), ), IconButton( onPressed: () { // 📞 Call action }, icon: const Icon(Icons.call, color: Color(0xFF4F46E5)), ) ], ), const SizedBox(height: 16), // Buttons Row( children: [ Expanded( child: OutlinedButton( onPressed: () {}, style: OutlinedButton.styleFrom( side: const BorderSide(color: Color(0xFF4F46E5)), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(24), ), padding: const EdgeInsets.symmetric(vertical: 12), ), child: const Text( "View Schedule", style: TextStyle( color: Color(0xFF4F46E5), fontWeight: FontWeight.w600, ), ), ), ), const SizedBox(width: 12), Expanded( child: ElevatedButton( onPressed: () {}, style: ElevatedButton.styleFrom( backgroundColor: const Color(0xFF4F46E5), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(24), ), padding: const EdgeInsets.symmetric(vertical: 12), ), child: const Text( "Assign", style: TextStyle( color: Colors.white, fontWeight: FontWeight.w600, ), ), ), ), ], ), ], ), ), const SizedBox(height: 24), // 🪪 License Card ClipRRect( borderRadius: BorderRadius.circular(12), child: Container( width: double.infinity, decoration: const BoxDecoration( color: Colors.black, ), child: Stack( children: [ // background pattern /*Image.asset( 'images/license_bg.png', fit: BoxFit.cover, width: double.infinity, height: 140, ),*/ Container( height: 140, width: double.infinity, padding: const EdgeInsets.all(16), color: Colors.black.withOpacity(0.3), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "DRIVING LICENSE", style: TextStyle( color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500, ), ), Spacer(), Text( widget.driverDetails.driver_name, style: TextStyle( color: Colors.white, fontSize: 14, fontWeight: FontWeight.w600, ), ), Text( "TS84996859930326", style: TextStyle( color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500, ), ), Align( alignment: Alignment.bottomRight, child: Text( "Expires on 29/02/2028", style: TextStyle( color: Colors.white70, fontSize: 12, ), ), ), ], ), ), ], ), ), ), const SizedBox(height: 24), const Text( "RECENT TRIPS", style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, color: Colors.black87, ), ), const SizedBox(height: 12), _buildTripCard("Drinking Water - 10,000 L", "7:02 PM, 28 Jun 2025"), const SizedBox(height: 8), _buildTripCard("Drinking Water - 10,000 L", "7:02 PM, 28 Jun 2025"), const SizedBox(height: 8), _buildTripCard("Drinking Water - 10,000 L", "7:02 PM, 28 Jun 2025"), const SizedBox(height: 30), ], ), ), ), ); } Widget _buildTripCard(String title, String time) { return Container( padding: const EdgeInsets.all(12), decoration: BoxDecoration( color: const Color(0xFFF8F8F8), borderRadius: BorderRadius.circular(12), ), child: Row( children: [ const Icon(Icons.local_shipping, color: Color(0xFF4F46E5), size: 24), const SizedBox(width: 12), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( title, style: const TextStyle( fontSize: 14, fontWeight: FontWeight.w600, color: Colors.black, ), ), const SizedBox(height: 2), Text( time, style: const TextStyle( fontSize: 12, color: Colors.black54, ), ), ], ), ), ], ), ); } }