import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:diplomaticquarterapp/widgets//pharmacy/product_tile.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/orderDetails_service.dart'; class OrderDetailsPage extends StatefulWidget { @override _OrderDetailsPageState createState() => _OrderDetailsPageState(); } class _OrderDetailsPageState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); String customerId=""; String page_id=""; String orderId="3516"; @override void initState() { WidgetsBinding.instance.addPostFrameCallback((_) => getOrderDetails()); super.initState(); } @override Widget build(BuildContext context) { return BaseView( onModelReady:(model) => model.getOrderDetails(orderId), builder: (_,model, wi )=> AppScaffold( appBarTitle: (TranslationBase.of(context).orderDetail), // title: Text(TranslationBase.of(context).orderDetail, style: TextStyle(color:Colors.white)), // backgroundColor: Colors.green, isShowAppBar: true, isPharmacy:true , body: Container( color: Colors.white, child: SingleChildScrollView( child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( margin: EdgeInsets.fromLTRB(10.0, 15.0, 1.0, 5.0), child: Row( children: [ SvgPicture.asset( 'assets/images/pharmacy/shipping_mark_icon.svg', width: 28, height: 28,), Text(TranslationBase.of(context).shippingAddress, style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold, ), ), ], ), ), Container( margin: EdgeInsets.only(top: 15.0, right: 10.0), padding: EdgeInsets.only(left: 11.0, right: 11.0), decoration: BoxDecoration( border: Border.all( color: Colors.blue, style: BorderStyle.solid, width: 5.0, ), color: Colors.blue, borderRadius: BorderRadius.circular(30.0) ), child: Text( TranslationBase.of(context).delivered, style: TextStyle( color: Colors.white, fontSize: 13.0, fontWeight: FontWeight.bold, ), ), ), ], ), Container( margin: EdgeInsets.only(left: 10.0, top: 13.0), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('NAME', style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, ), ), ], ), ), Container( margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('Cloud Solutions', style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, color: Colors.grey, ), ), ], ), ), Row( children: [ Container( margin: EdgeInsets.fromLTRB(10.0, 5.0, 8.0, 5.0), child: SvgPicture.asset( 'assets/images/pharmacy/mobile_number_icon.svg', height: 13,), ), Container( margin: EdgeInsets.only(top: 5.0, bottom: 5.0), child: Text('588888778', style: TextStyle(fontSize: 15.0, ), ), ), ], ), Divider( color: Colors.grey[350], height: 20, thickness: 1, indent: 0, endIndent: 0, ), Row( children: [ Container( margin: EdgeInsets.fromLTRB(10.0, 10.0, 5.0, 10.0), child: SvgPicture.asset( 'assets/images/pharmacy/shipping_truck_icon.svg', height: 20, width: 20,), ), Container( margin: EdgeInsets.all(10.0), child:Text(TranslationBase.of(context).shippedMethod, style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold, ), ), ), Container( margin: EdgeInsets.only(bottom: 10.0, top: 10.0), child: SvgPicture.asset( 'assets/images/pharmacy/hmg_shipping_logo.svg', height: 25, width: 25,), ), ], ), Divider( color: Colors.grey[350], height: 20, thickness: 8, indent: 0, endIndent: 0, ), Row( children: [ Container( margin: EdgeInsets.fromLTRB(10.0, 10.0, 1.0, 10.0), child: SvgPicture.asset( 'assets/images/pharmacy/credit_card_icon.svg', height: 20, width: 20,), ), Container( margin: EdgeInsets.all(10.0), child: SvgPicture.asset( 'assets/images/pharmacy/credit_card_icon.svg', height: 20, width: 20,), ), Container( margin: EdgeInsets.only(bottom: 10.0, top: 10.0), child:Text('Mada', style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold, ), ), ), ], ), Divider( color: Colors.grey[350], height: 20, thickness: 8, indent: 0, endIndent: 0, ), Container( padding: EdgeInsets.only(bottom: 15.0), margin: EdgeInsets.only(left: 10.0), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(TranslationBase.of(context).orderDetail, style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, ), ), ], ), ), Container( child: productTile(productName: 'Panadol Extra 500 MG', productPrice: '10.00', productRate: 3.00, productReviews:4, totalPrice: '10.00', qyt: '3',), ), Container( padding: EdgeInsets.only(bottom: 10.0), margin: EdgeInsets.only(left: 10.0, top: 5.0), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(TranslationBase.of(context).orderSummary, style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, ), ), ], ), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( padding: EdgeInsets.only(bottom: 10.0), margin: EdgeInsets.only(top: 5.0, left: 10.0 ), child: Text( TranslationBase.of(context).subtotal, style: TextStyle( fontSize: 13.0, ), ), ), Container( padding: EdgeInsets.only(bottom: 10.0), margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), child: Row( children: [ Container( margin: EdgeInsets.only(right: 5.0), child: Text(TranslationBase.of(context).sar, style: TextStyle(fontSize: 13.0, ), ), ), Text('343.55', style: TextStyle(fontSize: 13.0, ), ), ], ), ), ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( padding: EdgeInsets.only(bottom: 10.0), margin: EdgeInsets.only(top: 5.0, left: 10.0 ), child: Text( TranslationBase.of(context).shipping, style: TextStyle( fontSize: 13.0, ), ), ), Container( padding: EdgeInsets.only(bottom: 10.0), margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), child: Row( children: [ Container( margin: EdgeInsets.only(right: 5.0), child: Text(TranslationBase.of(context).sar, style: TextStyle(fontSize: 13.0, ), ), ), Text('343.55', style: TextStyle(fontSize: 13.0, ), ), ], ), ), ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( padding: EdgeInsets.only(bottom: 10.0), margin: EdgeInsets.only(top: 5.0,left: 10.0 ), child: Text( TranslationBase.of(context).vat, style: TextStyle( fontSize: 13.0, ), ), ), Container( padding: EdgeInsets.only(bottom: 10.0), margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), child: Row( children: [ Container( margin: EdgeInsets.only(right: 5.0), child: Text(TranslationBase.of(context).sar, style: TextStyle(fontSize: 13.0, ), ), ), Text('343.55', style: TextStyle(fontSize: 13.0, ), ), ], ), ), ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( margin: EdgeInsets.only(top: 5.0,left: 10.0 ), child: Text( TranslationBase.of(context).total, style: TextStyle( fontSize: 15.0,fontWeight: FontWeight.bold, ), ), ), Container( margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), child: Row( children: [ Container( margin: EdgeInsets.only(right: 5.0), child: Text(TranslationBase.of(context).sar, style: TextStyle(fontSize: 15.0,fontWeight: FontWeight.bold, ), ), ), Text('343.55', style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, ), ), ], ), ), ], ), InkWell( onTap: (){ }, child: Container( margin: EdgeInsets.only(top: 20.0), height: 50.0, color: Colors.transparent, child: Container( decoration: BoxDecoration( border: Border.all( color: Colors.green, style: BorderStyle.solid, width: 1.0 ), color: Colors.green, borderRadius: BorderRadius.circular(5.0) ), child: Center( child: Text( TranslationBase.of(context).payOnline, style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, ), ), ), ), ), ), InkWell( onTap: () { // confirmDelete(snapshot.data[index]["id"]); cancelOrder("id"); }, child: Container( height: 50.0, color: Colors.transparent, child: Center( child: Text( TranslationBase.of(context).cancelOrder, style: TextStyle( color: Colors.red[900], fontWeight: FontWeight.bold, decoration: TextDecoration.underline ), ), ), ), ), ], ), ), ), ), ); } cancelOrder(id){ showDialog( context: context, builder: (BuildContext context)=> AlertDialog( title: Text(TranslationBase.of(context).confirm, style: TextStyle( fontWeight: FontWeight.bold, ),), content: Text(TranslationBase.of(context).confirmCancellation, style: TextStyle( color: Colors.grey, ),), actions:[ FlatButton( child: Text(TranslationBase.of(context).cancel, style: TextStyle( color: Colors.red, fontWeight: FontWeight.bold, fontSize: 16, ),), onPressed: (){ Navigator.pop(context); }, ), FlatButton( child: Text(TranslationBase.of(context).ok, style: TextStyle( color: Colors.grey, fontWeight: FontWeight.bold, fontSize: 16, ),), onPressed: (){ // http.delete(""https://uat.hmgwebservices.com/epharmacy/api/orders/$id"); Navigator.push(context, MaterialPageRoute(builder: (context)=> OrderDetailsPage())); }, ), ], ) ); } } getOrderDetails() { print("getOrderDetails 5466"); OrderDetailsService service = new OrderDetailsService(); service.getOrderDetails(AppGlobal.context).then((res) { print(res); }); } getPayOrder(){ }