You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
diplomatic-quarter/lib/pages/pharmacy/order/Order.dart

782 lines
33 KiB
Dart

import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart';
class OrderPage extends StatefulWidget {
@override
_OrderPageState createState() => _OrderPageState();
}
class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMixin{
TabController _tabController;
AppSharedPreferences sharedPref = AppSharedPreferences();
@override
void initState() {
WidgetsBinding.instance.addPostFrameCallback((_) => getOrder());
super.initState();
_tabController = new TabController(length: 4, vsync: this,);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text(TranslationBase.of(context).order, style: TextStyle(color:Colors.white)),
backgroundColor: Colors.green,
),
body: Container(
child: Column(
children: [
TabBar(
tabs: [
Tab(text: TranslationBase.of(context).delivered),
Tab(text: TranslationBase.of(context).processing),
Tab(text: TranslationBase.of(context).pending),
Tab(text: TranslationBase.of(context).cancelled),
],
controller: _tabController,
),
Divider(
color: Colors.grey[350],
height: 10,
thickness: 6,
indent: 0,
endIndent: 0,
),
Expanded(
child: new TabBarView(
physics: NeverScrollableScrollPhysics(),
children: [
getDeliveredOrder(),
getProcessingOrder(),
getPendingOrder(),
getCancelledOrder(),
],
controller: _tabController,
),
),
],
),
),
);
}
Widget getDeliveredOrder(){
return Container(
width: MediaQuery.of(context).size.width,
child: SingleChildScrollView(
child: Column(
children:<Widget> [
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
itemCount: 2 ,
itemBuilder: (context, index){
return Container(
child: Column(
children:<Widget> [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children:<Widget> [
Container(
margin: EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [
Row(
children: [
Container(
margin: EdgeInsets.only(right: 5),
child: Text('Order#:',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
Container(
child: Text('3183',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
],
),
SizedBox(
height: 5,),
Row(
children: [
Container(
margin: EdgeInsets.only(right: 5),
child: Text('Date',
style: TextStyle(fontSize: 14.0,
),
),
),
Container(
child: Text('Aug 12, 2020',
style: TextStyle(fontSize: 14.0,
),
),
),
],
),
],
),
),
Container(
margin: EdgeInsets.all(8.0),
child: InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderDetailsPage()));
},
child: SvgPicture.asset(
'assets/images/pharmacy/arrow_right.svg',
height: 20,
width: 20,),
),
),
],
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
padding: EdgeInsets.only(left: 13.0, right: 13.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.blue[700],
style: BorderStyle.solid,
width: 5.0,
),
color: Colors.blue[700],
borderRadius: BorderRadius.circular(30.0)
),
child: Text(
TranslationBase.of(context).delivered,
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
),
Container(
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
child: Column(
// crossAxisAlignment: CrossAxisAlignment.end,
children:<Widget> [
Row(
children: [
Container(
margin: EdgeInsets.only(left: 5),
child: Text('564',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
Container(
margin: EdgeInsets.only(left: 5),
child: Text('SAR',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
],
),
SizedBox(
height: 5,),
Row(
children: [
Container(
child: Text('12',
style: TextStyle(fontSize: 14.0,
),
),
),
Container(
margin: EdgeInsets.only(left: 5),
child: Text('items(s)',
style: TextStyle(fontSize: 14.0,
),
),
),
],
),
],
),
),
],
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 8,
indent: 0,
endIndent: 0,
),
],
),
);
}
)
],
),
),
);
}
Widget getProcessingOrder(){
return Container(
child: SingleChildScrollView(
child: Column(
children:<Widget> [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children:<Widget> [
Container(
margin: EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [
Row(
children: [
Container(
margin: EdgeInsets.only(right: 5),
child: Text('Order#:',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
Container(
child: Text('3183',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
],
),
SizedBox(
height: 5,),
Row(
children: [
Container(
margin: EdgeInsets.only(right: 5),
child: Text('Date',
style: TextStyle(fontSize: 14.0,
),
),
),
Container(
child: Text('Aug 12, 2020',
style: TextStyle(fontSize: 14.0,
),
),
),
],
),
],
),
),
Container(
margin: EdgeInsets.all(8),
child: InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderDetailsPage()));
},
child: SvgPicture.asset(
'assets/images/pharmacy/arrow_right.svg',
height: 20,
width: 20,),
),
),
],
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
padding: EdgeInsets.only(left: 13.0, right: 13.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.green,
style: BorderStyle.solid,
width: 5.0,
),
color: Colors.green,
borderRadius: BorderRadius.circular(30.0)
),
child: Text(
TranslationBase.of(context).processing,
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
),
Container(
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
child: Column(
// crossAxisAlignment: CrossAxisAlignment.end,
children:<Widget> [
Row(
children: [
Container(
margin: EdgeInsets.only(left: 5),
child: Text('564',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
Container(
margin: EdgeInsets.only(left: 5),
child: Text('SAR',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
],
),
SizedBox(
height: 5,),
Row(
children: [
Container(
child: Text('12',
style: TextStyle(fontSize: 14.0,
),
),
),
Container(
margin: EdgeInsets.only(left: 5),
child: Text('items(s)',
style: TextStyle(fontSize: 14.0,
),
),
),
],
),
],
),
),
],
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 8,
indent: 0,
endIndent: 0,
),
],
),
),
);
}
Widget getPendingOrder(){
return Container(
child: SingleChildScrollView(
child: Column(
children:<Widget> [
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
itemCount: 2 ,
itemBuilder: (context, index){
return Container(
child: SingleChildScrollView(
child: Column(
children:<Widget> [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children:<Widget> [
Container(
margin: EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [
Row(
children: [
Container(
margin: EdgeInsets.only(right: 5),
child: Text('Order#:',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
Container(
child: Text('3183',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
],
),
SizedBox(
height: 5,),
Row(
children: [
Container(
margin: EdgeInsets.only(right: 5),
child: Text('Date',
style: TextStyle(fontSize: 14.0,
),
),
),
Container(
child: Text('Aug 12, 2020',
style: TextStyle(fontSize: 14.0,
),
),
),
],
),
],
),
),
Container(
margin: EdgeInsets.all( 8.0),
child: InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderDetailsPage()));
},
child: SvgPicture.asset(
'assets/images/pharmacy/arrow_right.svg',
height: 20,
width: 20,),
),
),
],
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: EdgeInsets.all(8.0),
padding: EdgeInsets.only(left: 13.0, right: 13.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.orange[300],
style: BorderStyle.solid,
width: 5.0,
),
color: Colors.orange[300],
borderRadius: BorderRadius.circular(30.0)
),
child: Text(
TranslationBase.of(context).pending,
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
),
Container(
margin: EdgeInsets.all(8.0),
child: Column(
// crossAxisAlignment: CrossAxisAlignment.end,
children:<Widget> [
Row(
children: [
Container(
margin: EdgeInsets.only(left: 5),
child: Text('564',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
Container(
margin: EdgeInsets.only(left: 5),
child: Text('SAR',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
],
),
SizedBox(
height: 5,),
Row(
children: [
Container(
child: Text('12',
style: TextStyle(fontSize: 14.0,
),
),
),
Container(
margin: EdgeInsets.only(left: 5),
child: Text('items(s)',
style: TextStyle(fontSize: 14.0,
),
),
),
],
),
],
),
),
],
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 8,
indent: 0,
endIndent: 0,
),
],
),
),
);
}
)
],
),
),
);
}
Widget getCancelledOrder(){
return Container(
child: SingleChildScrollView(
child: Column(
children:<Widget> [
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
itemCount: 2 ,
itemBuilder: (context, index){
return Container(
child: SingleChildScrollView(
child: Column(
children:<Widget> [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children:<Widget> [
Container(
margin: EdgeInsets.all( 8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [
Row(
children: [
Container(
margin: EdgeInsets.only(right: 5),
child: Text('Order#:',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
Container(
child: Text('3183',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
],
),
SizedBox(
height: 5,),
Row(
children: [
Container(
margin: EdgeInsets.only(right: 5),
child: Text('Date',
style: TextStyle(fontSize: 14.0,
),
),
),
Container(
child: Text('Aug 12, 2020',
style: TextStyle(fontSize: 14.0,
),
),
),
],
),
],
),
),
Container(
margin: EdgeInsets.all(8.0),
child: InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => OrderDetailsPage()));
},
child: SvgPicture.asset(
'assets/images/pharmacy/arrow_right.svg',
height: 20,
width: 20,),
),
),
],
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 1,
indent: 0,
endIndent: 0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
padding: EdgeInsets.only(left: 10.0, right: 10.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.red[900],
style: BorderStyle.solid,
width: 5.0,
),
color: Colors.red[900],
borderRadius: BorderRadius.circular(30.0)
),
child: Text(
TranslationBase.of(context).cancelled,
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
),
Container(
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
child: Column(
// crossAxisAlignment: CrossAxisAlignment.end,
children:<Widget> [
Row(
children: [
Container(
margin: EdgeInsets.only(left: 5),
child: Text('564',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
Container(
margin: EdgeInsets.only(left: 5),
child: Text('SAR',
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
],
),
SizedBox(
height: 5,),
Row(
children: [
Container(
child: Text('12',
style: TextStyle(fontSize: 14.0,
),
),
),
Container(
margin: EdgeInsets.only(left: 5),
child: Text('items(s)',
style: TextStyle(fontSize: 14.0,
),
),
),
],
),
],
),
),
],
),
Divider(
color: Colors.grey[350],
height: 20,
thickness: 8,
indent: 0,
endIndent: 0,
),
],
),
),
);
}
)
],
),
),
);
}
}
getOrder() {
print("getOrder no4665");
OrderService service = new OrderService();
service.getOrder(AppGlobal.context).then((res) {
print(res);
});
}
// filterOrders() {
// for () {
// if (order.order_status_id === 30 || order.order_status_id === 997 || order.order_status_id === 994) { // complete
// this.delivered.push(order);
// } else if (order.order_status_id === 40 || order.order_status_id === 200 || order.order_status_id === 996) { // cancelled & order refunded
// this.cancelled.push(order);
// } else if (order.order_status_id === 10) { // Pending
// this.pending.push(order);
// } else if (order.order_status_id === 20 || order.order_status_id === 995 || order.order_status_id === 998 || order.order_status_id === 999) { // Processing
// this.processing.push(order);
// } else { // Processing & other all other status
// this.other.push(order);
// }
// }
//}