import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; dynamic languageID; class OrderPage extends StatefulWidget { // orderList({this.customerId, this.pageId}); String customerID; OrderPage({@required this.customerID}); @override _OrderPageState createState() => _OrderPageState(); } class _OrderPageState extends State with SingleTickerProviderStateMixin { String pageID = "1"; String customerId = ""; String order = ""; List orderList = []; List deliveredOrderList = []; List processingOrderList = []; List cancelledOrderList = []; List pendingOrderList = []; TabController _tabController; // AppSharedPreferences sharedPref = AppSharedPreferences(); getLanguageID() async { languageID = await sharedPref.getString(APP_LANGUAGE); } @override void initState() { getLanguageID(); super.initState(); _tabController = new TabController( length: 4, vsync: this, ); } @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getOrder(widget.customerID, pageID), builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).order, baseViewModel: model, isShowAppBar: true, isPharmacy: true, body: Container( child: Column( children: [ TabBar( labelPadding: EdgeInsets.only(left: 3.0, right: 3.0), labelColor: Colors.black, 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(model), getProcessingOrder(model), getPendingOrder(model), getCancelledOrder(model), ], controller: _tabController, ), ), ], ), ), ), ); } Widget getDeliveredOrder(OrderModelViewModel model) { for (int i = 0; i < model.orders.length; i++) { if (model.orders[i].orderStatusId == 30 || model.orders[i].orderStatusId == 997 || model.orders[i].orderStatusId == 994) { deliveredOrderList.add(model.orders[i]); } } return Container( width: MediaQuery.of(context).size.width, child: model.orders.length != 0 ? SingleChildScrollView( child: Column( children: [ ListView.builder( scrollDirection: Axis.vertical, shrinkWrap: true, physics: ScrollPhysics(), itemCount: deliveredOrderList.length, itemBuilder: (context, index) { return Container( child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( margin: EdgeInsets.all(8.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Container( margin: EdgeInsets.only(right: 5), child: Text( TranslationBase.of(context) .orderNumber, style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), Container( child: Text( deliveredOrderList[index] .id .toString(), style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), ], ), SizedBox( height: 5, ), Row( children: [ Container( margin: EdgeInsets.only(right: 5), child: Text( TranslationBase.of(context) .orderDate, style: TextStyle( fontSize: 14.0, ), ), ), Container( child: Text( deliveredOrderList[index] .createdOnUtc .toString() .substring(0, 10), style: TextStyle( fontSize: 14.0, ), ), ), ], ), ], ), ), Container( margin: EdgeInsets.all(8.0), child: InkWell( onTap: () { Navigator.push( context, FadePage( page: OrderDetailsPage( orderModel: deliveredOrderList[ index]), )); }, child: SvgPicture.asset( languageID == "ar" ? 'assets/images/pharmacy/arrow_left.svg' : '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: [ 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: deliveredOrderList[index] .orderStatusId == 30 ? Text( // deliveredOrderList[0].orderStatus.toString().substring(12), TranslationBase.of(context) .deliveredOrder, style: TextStyle( color: Colors.white, fontSize: 15.0, fontWeight: FontWeight.bold, ), ) : Text( languageID == "ar" ? deliveredOrderList[index] .orderStatusn .toString() : deliveredOrderList[index] .orderStatus .toString(), 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: [ Row( children: [ Container( margin: EdgeInsets.only(left: 5), child: Text( deliveredOrderList[index] .orderTotal .toString(), style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), Container( margin: EdgeInsets.only(left: 5), child: Text( TranslationBase.of(context).sar, style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), ], ), SizedBox( height: 5, ), Row( children: [ Container( child: Text( deliveredOrderList[index] .productCount .toString(), style: TextStyle( fontSize: 14.0, ), ), ), Container( margin: EdgeInsets.only(left: 5), child: Text( TranslationBase.of(context) .itemsNo, style: TextStyle( fontSize: 14.0, ), ), ), ], ), ], ), ), ], ), Divider( color: Colors.grey[350], height: 20, thickness: 8, indent: 0, endIndent: 0, ), ], ), ); }) ], ), ) : Container( child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ SvgPicture.asset('assets/images/pharmacy/empty_box.svg'), Container( margin: EdgeInsets.only(top: 10.0), child: Text(TranslationBase.of(context).noOrder, style: TextStyle( fontSize: 16.0, )), ), ], ), ), ), ); } Widget getProcessingOrder(OrderModelViewModel model) { for (int i = 0; i < model.orders.length; i++) { if (model.orders[i].orderStatusId == 20 || model.orders[i].orderStatusId == 995 || model.orders[i].orderStatusId == 998 || model.orders[i].orderStatusId == 999) { processingOrderList.add(model.orders[i]); } } return Container( width: MediaQuery.of(context).size.width, child: model.orders.length != 0 ? SingleChildScrollView( child: Column( children: [ ListView.builder( scrollDirection: Axis.vertical, shrinkWrap: true, physics: ScrollPhysics(), itemCount: processingOrderList.length, itemBuilder: (context, index) { return Container( child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( margin: EdgeInsets.all(8.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Container( margin: EdgeInsets.only(right: 5), child: Text( TranslationBase.of(context) .orderNumber, style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), Container( child: Text( processingOrderList[index] .id .toString(), style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), ], ), SizedBox( height: 5, ), Row( children: [ Container( margin: EdgeInsets.only(right: 5), child: Text( TranslationBase.of(context) .orderDate, style: TextStyle( fontSize: 14.0, ), ), ), Container( child: Text( processingOrderList[index] .createdOnUtc .toString() .substring(0, 10), style: TextStyle( fontSize: 14.0, ), ), ), ], ), ], ), ), Container( margin: EdgeInsets.all(8.0), child: InkWell( onTap: () { Navigator.push( context, FadePage( page: OrderDetailsPage( orderModel: processingOrderList[ index]))); }, child: SvgPicture.asset( languageID == "ar" ? 'assets/images/pharmacy/arrow_left.svg' : '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: [ 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: processingOrderList[index] .orderStatusId == 20 ? Text( // deliveredOrderList[0].orderStatus.toString().substring(12), TranslationBase.of(context) .processingOrder, style: TextStyle( color: Colors.white, fontSize: 15.0, fontWeight: FontWeight.bold, ), ) : Text( languageID == "ar" ? processingOrderList[index] .orderStatusn .toString() : processingOrderList[index] .orderStatus .toString(), 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: [ Row( children: [ Container( margin: EdgeInsets.only(left: 5), child: Text( processingOrderList[index] .orderTotal .toString(), style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), Container( margin: EdgeInsets.only(left: 5), child: Text( TranslationBase.of(context).sar, style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), ], ), SizedBox( height: 5, ), Row( children: [ Container( child: Text( processingOrderList[index] .productCount .toString(), style: TextStyle( fontSize: 14.0, ), ), ), Container( margin: EdgeInsets.only(left: 5), child: Text( TranslationBase.of(context) .itemsNo, style: TextStyle( fontSize: 14.0, ), ), ), ], ), ], ), ), ], ), Divider( color: Colors.grey[350], height: 20, thickness: 8, indent: 0, endIndent: 0, ), ], ), ); }) ], ), ) : Container( child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ SvgPicture.asset('assets/images/pharmacy/empty_box.svg'), Container( margin: EdgeInsets.only(top: 10.0), child: Text(TranslationBase.of(context).noOrder, style: TextStyle( fontSize: 16.0, )), ), ], ), ), ), ); // return Container( // child: model.order.length != 0 // ? SingleChildScrollView( // child: Column( // children: [ // ListView.builder( // child: Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, // children: [ // Container( // margin: EdgeInsets.all(8), // child: Column( // crossAxisAlignment: CrossAxisAlignment.start, // children: [ // Row( // children: [ // Container( // margin: EdgeInsets.only(right: 5), // child: Text(TranslationBase.of(context).orderNumber, // style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, // ), // ), // ), // Container( // child: Text(processingOrderList[0].id.toString(), // style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, // ), // ), // ), // ], // ), // SizedBox( // height: 5,), // Row( // children: [ // Container( // margin: EdgeInsets.only(right: 5), // child: Text(TranslationBase.of(context).orderDate, // style: TextStyle(fontSize: 14.0, // ), // ), // ), // Container( // child: Text(processingOrderList[0].createdOnUtc.toString().substring(0,11), // style: TextStyle(fontSize: 14.0, // ), // ), // ), // ], // ), // ], // ), // ), // Container( // margin: EdgeInsets.all(8), // child: InkWell( // onTap: () { // Navigator.push(context, // FadePage(page: OrderDetailsPage(orderModel:processingOrderList[0]))); // }, // 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: [ // 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( widget.languageID == "ar" // ? processingOrderList[0].orderStatusn.toString() // : processingOrderList[0].orderStatus.toString().substring(12), //// 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: [ // Row( // children: [ // Container( // margin: EdgeInsets.only(left: 5), // child: Text(processingOrderList[0].orderTotal.toString(), // style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, // ), // ), // ), // Container( // margin: EdgeInsets.only(left: 5), // child: Text(TranslationBase.of(context).sar, // style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, // ), // ), // ), // ], // ), // SizedBox( // height: 5,), // Row( // children: [ // Container( // child: Text(processingOrderList[0].orderItems[0].quantity.toString(), // style: TextStyle(fontSize: 14.0, // ), // ), // ), // Container( // margin: EdgeInsets.only(left: 5), // child: Text(TranslationBase.of(context).itemsNo, // style: TextStyle(fontSize: 14.0, // ), // ), // ), // ], // ), // ], // ), // ), // ], // ), // Divider( // color: Colors.grey[350], // height: 20, // thickness: 8, // indent: 0, // endIndent: 0, // ), // ], // ), // ) // : Container( // child: Center( // child: Column( // mainAxisAlignment: MainAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.center, // children: [ // SvgPicture.asset( // 'assets/images/pharmacy/empty_box.svg'), // Container( // margin: EdgeInsets.only(top: 10.0), // child: Text(TranslationBase.of(context).noOrder, // style: TextStyle( // fontSize: 16.0, // )), // ), // ], // ), // ), // ), // ); } Widget getPendingOrder(OrderModelViewModel model) { for (int i = 0; i < model.orders.length; i++) { if (model.orders[i].orderStatusId == 10) { pendingOrderList.add(model.orders[i]); } } return Container( child: model.orders.length != 0 ? SingleChildScrollView( child: Column( children: [ ListView.builder( scrollDirection: Axis.vertical, shrinkWrap: true, physics: ScrollPhysics(), itemCount: pendingOrderList.length, itemBuilder: (context, index) { return Container( child: SingleChildScrollView( child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( margin: EdgeInsets.all(8.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Container( margin: EdgeInsets.only(right: 5), child: Text( TranslationBase.of(context) .orderNumber, style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), Container( child: Text( pendingOrderList[index] .id .toString(), style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), ], ), SizedBox( height: 5, ), Row( children: [ Container( margin: EdgeInsets.only(right: 5), child: Text( TranslationBase.of(context) .orderDate, style: TextStyle( fontSize: 14.0, ), ), ), Container( child: Text( pendingOrderList[index] .createdOnUtc .toString() .substring(0, 10), style: TextStyle( fontSize: 14.0, ), ), ), ], ), ], ), ), Container( margin: EdgeInsets.all(8.0), child: InkWell( onTap: () { Navigator.push( context, FadePage( page: OrderDetailsPage( orderModel: pendingOrderList[ index]))); }, child: SvgPicture.asset( languageID == "ar" ? 'assets/images/pharmacy/arrow_left.svg' : '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: [ 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: pendingOrderList[index] .orderStatusId == 10 ? Text( // deliveredOrderList[0].orderStatus.toString().substring(12), TranslationBase.of(context) .pendingOrder, style: TextStyle( color: Colors.white, fontSize: 15.0, fontWeight: FontWeight.bold, ), ) : Text( languageID == "ar" ? pendingOrderList[index] .orderStatusn .toString() : pendingOrderList[index] .orderStatus .toString(), style: TextStyle( color: Colors.white, fontSize: 15.0, fontWeight: FontWeight.bold, ), )), Container( margin: EdgeInsets.all(8.0), child: Column( // crossAxisAlignment: CrossAxisAlignment.end, children: [ Row( children: [ Container( margin: EdgeInsets.only(left: 5), child: Text( pendingOrderList[index] .orderTotal .toString(), style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), Container( margin: EdgeInsets.only(left: 5), child: Text( TranslationBase.of(context) .sar, style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), ], ), SizedBox( height: 5, ), Row( children: [ Container( child: Text( pendingOrderList[index] .productCount .toString(), style: TextStyle( fontSize: 14.0, ), ), ), Container( margin: EdgeInsets.only(left: 5), child: Text( TranslationBase.of(context) .itemsNo, style: TextStyle( fontSize: 14.0, ), ), ), ], ), ], ), ), ], ), Divider( color: Colors.grey[350], height: 20, thickness: 8, indent: 0, endIndent: 0, ), ], ), ), ); }) ], ), ) : Container( child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ SvgPicture.asset('assets/images/pharmacy/empty_box.svg'), Container( margin: EdgeInsets.only(top: 10.0), child: Text(TranslationBase.of(context).noOrder, style: TextStyle( fontSize: 16.0, )), ), ], ), ), ), ); } Widget getCancelledOrder(OrderModelViewModel model) { for (int i = 0; i < model.orders.length; i++) { if (model.orders[i].orderStatusId == 40 || model.orders[i].orderStatus == 996 || model.orders[i].orderStatusId == 200) { cancelledOrderList.add(model.orders[i]); } } return Container( child: model.orders.length != 0 ? SingleChildScrollView( child: Column( children: [ ListView.builder( scrollDirection: Axis.vertical, shrinkWrap: true, physics: ScrollPhysics(), itemCount: cancelledOrderList.length, itemBuilder: (context, index) { return Container( child: SingleChildScrollView( child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( margin: EdgeInsets.all(8.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Container( margin: EdgeInsets.only(right: 5), child: Text( TranslationBase.of(context) .orderNumber, style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), Container( child: Text( cancelledOrderList[index] .id .toString(), style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), ], ), SizedBox( height: 5, ), Row( children: [ Container( margin: EdgeInsets.only(right: 5), child: Text( TranslationBase.of(context) .orderDate, style: TextStyle( fontSize: 14.0, ), ), ), Container( child: Text( cancelledOrderList[index] .createdOnUtc .toString() .substring(0, 10), style: TextStyle( fontSize: 14.0, ), ), ), ], ), ], ), ), Container( margin: EdgeInsets.all(8.0), child: InkWell( onTap: () { Navigator.push( context, FadePage( page: OrderDetailsPage( orderModel: cancelledOrderList[ index]))); }, child: SvgPicture.asset( languageID == "ar" ? 'assets/images/pharmacy/arrow_left.svg' : '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: [ 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: cancelledOrderList[index] .orderStatusId == 40 ? Text( // deliveredOrderList[0].orderStatus.toString().substring(12), TranslationBase.of(context) .cancelledOrder, style: TextStyle( color: Colors.white, fontSize: 15.0, fontWeight: FontWeight.bold, ), ) : Text( languageID == "ar" ? cancelledOrderList[index] .orderStatusn .toString() : cancelledOrderList[index] .orderStatus .toString(), 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: [ Row( children: [ Container( margin: EdgeInsets.only(left: 5), child: Text( cancelledOrderList[index] .orderTotal .toString(), style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), Container( margin: EdgeInsets.only(left: 5), child: Text( TranslationBase.of(context) .sar, style: TextStyle( fontSize: 16.0, fontWeight: FontWeight.bold, ), ), ), ], ), SizedBox( height: 5, ), Row( children: [ Container( child: Text( cancelledOrderList[index] .productCount .toString(), style: TextStyle( fontSize: 14.0, ), ), ), Container( margin: EdgeInsets.only(left: 5), child: Text( TranslationBase.of(context) .itemsNo, style: TextStyle( fontSize: 14.0, ), ), ), ], ), ], ), ), ], ), Divider( color: Colors.grey[350], height: 20, thickness: 8, indent: 0, endIndent: 0, ), ], ), ), ); }) ], ), ) : Container( child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ SvgPicture.asset('assets/images/pharmacy/empty_box.svg'), Container( margin: EdgeInsets.only(top: 10.0), child: Text(TranslationBase.of(context).noOrder, style: TextStyle( fontSize: 16.0, )), ), ], ), ), ), ); int test = Test()["1"]; } } class Test { static const values = {"1": 1, "2": 2, "3": 3}; int operator [](String key) => values[key]; }