import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/pages/delivery/information_page.dart'; import 'package:driverapp/widgets/data_display/circle-container.dart'; import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; import 'package:driverapp/widgets/others/rounded_container.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:driverapp/uitl/translations_delegate_base.dart'; import '../base/base_view.dart'; class OrdersListScreen extends StatefulWidget { @override _OrdersListScreenState createState() => _OrdersListScreenState(); } class _OrdersListScreenState extends State { @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getPendingOrders(), builder: (BuildContext context, OrdersViewModel model, Widget child) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).yourDeliveryQue, titleColor: Colors.black, body: Column( children: [ Expanded( child: ListView.builder( shrinkWrap: true, scrollDirection: Axis.vertical, itemCount: model.orders == null ? 0 : model.orders.length, itemBuilder: (BuildContext context, int index) { return Padding( padding: EdgeInsets.symmetric(horizontal: 12.2), child: InkWell( child: RoundedContainer( raduis: 25.0, height: MediaQuery.of(context).orientation == Orientation.portrait ? MediaQuery.of(context).size.height * 0.120 : MediaQuery.of(context).size.height * 0.209, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( flex: 1, child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: EdgeInsets.only(left: 15.0, top: 14.0), child: Image.asset( 'assets/images/location.png', height: MediaQuery.of(context) .orientation == Orientation.portrait ? MediaQuery.of(context).size.height * 0.06 : MediaQuery.of(context).size.height * 0.11, width: MediaQuery.of(context) .orientation == Orientation.portrait ? MediaQuery.of(context).size.width * 0.05 : MediaQuery.of(context).size.width * 0.09, ), ) ], ), ), if (model.orders.length != 0) Expanded( flex: 5, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: EdgeInsets.only(top: 20.0), child: Text( model.orders[index].firstName + ' ' + model.orders[index].lastName, style: TextStyle(fontSize: 18.0), ), ), Text( model.orders[index].mobileNumber, style: TextStyle( color: Color(0xff30B7B9), fontWeight: FontWeight.w600, fontSize: 15.0, ), ), Expanded( child: Text( model.orders[index].orderID.toString(), style: TextStyle( fontSize: 18.0, fontWeight: FontWeight.w400, letterSpacing: 8.0), ), ), ], ), ), Padding( padding: EdgeInsets.all(8.0), child: CircleContainer( borderWidth: 0.8, child: Text( model.orders[index].distanceInKilometers .toString() + ' K.m\naway', style: TextStyle( color: Color(0xff42B6AD), fontWeight: FontWeight.w800, fontStyle: FontStyle.normal), ), ), ), ], ), ), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => InformationPage(model.orders[index]))); }, ), ); }, ), ), ], ), ), ); } }