import 'package:car_for_her/config/palette.dart'; import 'package:car_for_her/models/Driver/trips.dart'; import 'package:flutter/material.dart'; class DriverMissions extends StatefulWidget { int index; String history; DriverMissions(this.index,this.history); @override _DriverMissionsState createState() => _DriverMissionsState(); } class _DriverMissionsState extends State { List tripsList=[]; void initState() { // TODO: implement initState super.initState(); setState(() { if(this.widget.history=="today"){ tripsList=todayTrips; } else if(this.widget.history=="last week"){ tripsList=lastWeekTrips; } else { tripsList=lastMonthTrips; } }); } @override Widget build(BuildContext context) { return Container( margin: EdgeInsets.only(bottom: 10), height: 103, decoration: BoxDecoration(border: Border.all(color: Colors.grey)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( children: [ Container( /** ****************** Image container***************************** **/ width:90, height: 101, child: Image(image: AssetImage(tripsList[this.widget.index].profileImage),fit: BoxFit.fill,), ), ], ), /** ****************** Rigt Column for Texts***************************** **/ Padding( padding: const EdgeInsets.fromLTRB(0, 2, 60, 0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(tripsList[this.widget.index].clientName,style: TextStyle(fontFamily: 'MontHeavy',fontSize: 14),), SizedBox( height: 8, ), Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( margin: EdgeInsets.only(top: 3), height:10, width: 10, decoration: BoxDecoration( color: Color(0xff2D46B9), borderRadius: BorderRadius.circular(100), ), child: Center( child: Container( height:4, width: 4, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(100), ), ), ), ), SizedBox( width: 5, ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(tripsList[this.widget.index].startPosition,style: TextStyle(fontWeight: FontWeight.bold,fontFamily: 'MontExtraLight',fontSize: 12),), SizedBox( height: 3, ), Text(tripsList[this.widget.index].startTime,style: TextStyle(fontWeight: FontWeight.bold,fontFamily: 'MontExtraLight',fontSize: 12),), ], ), ], ), SizedBox( height: 5, ), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( margin: EdgeInsets.only(top: 3), height:10, width: 10, decoration: BoxDecoration( color: Color(0xff2D46B9), borderRadius: BorderRadius.circular(100), ), child: Center( child: Container( height:4, width: 4, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(100), ), ), ), ), SizedBox( width: 5, ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(tripsList[this.widget.index].endPosition,style: TextStyle(fontWeight: FontWeight.bold,fontFamily: 'MontExtraLight',fontSize: 12),), SizedBox( height: 3, ), Text(tripsList[this.widget.index].endTime,style: TextStyle(fontWeight: FontWeight.bold,fontFamily: 'MontExtraLight',fontSize: 12),), ], ), ], ), ], ), ), /** ****************** Left Column for buttons and price***************************** **/ Column( crossAxisAlignment: CrossAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Padding( padding: const EdgeInsets.fromLTRB(0, 5, 10, 0), child: Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ Text("\$${tripsList[this.widget.index].price}",textAlign: TextAlign.end,style: TextStyle(fontWeight: FontWeight.bold,fontSize:12 ),), Text("${tripsList[this.widget.index].distance}",textAlign: TextAlign.end,style: TextStyle(fontSize: 12,fontWeight: FontWeight.bold ,color: Color.fromRGBO(0, 0, 0, 0.5)),), ], ), ), ], ), ], ), ); } }