NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

import 'package:intl/intl.dart';

import '../../components/custom_alert_dialog.dart';
import '../../components/custom_line.dart';
import '../../components/custom_modal_bottom_sheet.dart';
import '../../components/loading.dart';
import '../../components/logo.dart';
import '../../components/money_formatter.dart';
import '../../constants/styles/custom_colors.dart';
import '../../constants/styles/styles.dart';
import '../../models/ordermodels/order_detail_model.dart';
import '../../utils/screen.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';

import '../../models/ordermodels/order_model.dart';
import '../../providers/order_state.dart';

import 'package:flutter/material.dart';

class Order extends StatefulWidget {
@override
_OrderState createState() => _OrderState();
}

var controller = PageController();
final dateFormat=new DateFormat("dd/MM/yyyy HH:mm");
class _OrderState extends State<Order> {
@override
Widget build(BuildContext context) {
var _orderState = Provider.of<OrderState>(context);

return Scaffold(
backgroundColor: CustomColors.red,
body: SafeArea(
child: Padding(
padding: EdgeInsets.fromLTRB(8, 15, 8, 20),
child: _orderState.activeOrder != null
? _orderState.activeOrder.length > 0
? _orderAvailable(_orderState.activeOrder)
: _orderNotAvailable()
: _orderNotAvailable(),
),
),
);
}

_orderAvailable(List<OrderModel> model) {
var _orderState = Provider.of<OrderState>(context);
return PageView(
scrollDirection: Axis.horizontal,
controller: controller,
children: model.map(
(item) {
return SingleChildScrollView(
child: Container(
padding: EdgeInsets.fromLTRB(8, 0, 8, 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Logo(),
SizedBox(height: Screen.height(4)),
Text(
"Siparişini Aldık!",
style: TextStyle(
color: Colors.white,
fontSize: Screen.size(30),
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
SizedBox(height: Screen.height(2)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconButton(
icon: Icon(Icons.arrow_back_ios),
color: CustomColors.yellow,
onPressed: () {
controller.previousPage(
duration: Duration(milliseconds: 700),
curve: Curves.ease,
);
},
),
Text(
item.restaurant.name + 'n' + item.relativeDate,
style: TextStyle(
color: CustomColors.yellow,
fontSize: Screen.size(20),
),
textAlign: TextAlign.center,
),
IconButton(
icon: Icon(Icons.arrow_forward_ios),
color: CustomColors.yellow,
onPressed: () {
controller.nextPage(
duration: Duration(milliseconds: 700),
curve: Curves.ease,
);
},
),
],
),
SizedBox(height: Screen.height(2)),
Padding(
padding: EdgeInsets.only(top: 5, bottom: 5),
child: Row(
children: <Widget>[
Expanded(
child: FloatingActionButton.extended(
onPressed: () async {
CustomModalBottomSheet.show(
context: context,
widget: buildOrderDetail(
model:
await _orderState.get(id: item.id)));
},
label: Text("Sipariş Detayı",
style: TextStyle(color: Colors.black)),
backgroundColor: CustomColors.yellow,
),
),
SizedBox(width: 10),
Expanded(
child: FloatingActionButton.extended(
onPressed: () {
launch(
"https://www.google.com/maps/search/?api=1&query=${item.restaurant.latitude + "," + item.restaurant.longitude}");
},
label: Text("Yol Tarifi",
style: TextStyle(color: Colors.black)),
backgroundColor: CustomColors.yellow,
),
),
],
),
),
SizedBox(height: Screen.height(2)),
Text(
"Sipariş adımlarını buradan takip edebilirsin. n Aşağıdaki sipariş kodunu senin n için saklayacağız :) ",
style: TextStyle(
color: Colors.white,
fontSize: Screen.size(16),
),
textAlign: TextAlign.center,
),
SizedBox(height: Screen.height(4)),
SvgPicture.asset(
"assets/images/order.svg",
height: Screen.height(20),
),
SizedBox(height: Screen.height(3)),
Text(
item.orderNo,
style: TextStyle(
fontSize: Screen.size(50),
color: Colors.white,
),
textAlign: TextAlign.center,
),
SizedBox(height: Screen.height(3)),
Text(
"Siparişini yalnızca bu adımda iptal edebilirsin.",
style: TextStyle(
color: Colors.white,
fontSize: Screen.size(15),
),
textAlign: TextAlign.center,
),
SizedBox(height: Screen.height(2)),
ButtonTheme(
height: Screen.height(9),
child: FlatButton(
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
child: Text(
"Siparişi İptal Et",
style: TextStyle(
color: Colors.white,
fontSize: Screen.size(22),
decoration: TextDecoration.underline),
),
onPressed: () async {
var _result = await CustomAlertDialog(
title: 'Sipariş İptali',
content:
"Şiparişi iptal etmek istediğinize emin misiniz ?",
confirmText: 'Evet',
cancelText: 'Hayır',
).show(context);
if (_result) {
var _cancelOrder = await _orderState.cancelOrder(
orderNo: item.orderNo);
if (!_cancelOrder.success) {
CustomAlertDialog(
title: 'Uyarı',
content: _cancelOrder.data.toString(),
confirmText: 'Kapat',
).show(context);
}
}
},
),
),
],
),
),
);
},
).toList(),
);
}

_orderNotAvailable() {
return SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Logo(),
SizedBox(height: Screen.height(10)),
SvgPicture.asset(
"assets/images/noorder.svg",
height: Screen.height(25),
),
SizedBox(height: Screen.height(5)),
Text(
"Henüz Bir Sipariş Yok.",
style: TextStyle(
color: Colors.white,
fontSize: Screen.size(34),
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
SizedBox(height: Screen.height(1)),
Text(
"Siparişini verdiğin anda n sipariş durumunu bu ekrandan n kontrol edebilirsin.",
style: TextStyle(
color: Colors.white,
fontSize: Screen.size(22),
),
textAlign: TextAlign.center,
),
],
),
);
}

ListView buildOrderDetail({@required OrderDetailModel model}) {
EasyLoading.dismiss();
return model != null
? ListView(
padding: Styles.defaultPadding,
children: <Widget>[
Text(
model.restaurant.name,
style: TextStyle(
color: CustomColors.red,
fontWeight: FontWeight.bold,
fontSize: Screen.size(30),
),
textAlign: TextAlign.center,
),
SizedBox(height: 50),
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Ödeme Tipi",
style: TextStyle(
fontSize: Screen.size(16),
fontWeight: FontWeight.w500),
),
Text(
model.paymentType,
style: TextStyle(
fontSize: Screen.size(16),
fontWeight: FontWeight.w500,
color: CustomColors.red,
),
)
],
),
SizedBox(height: 8),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Sipariş Durumu",
style: TextStyle(
fontSize: Screen.size(16),
fontWeight: FontWeight.w500),
),
Text(
model.orderStatusDisplayName,
style: TextStyle(
fontSize: Screen.size(16),
fontWeight: FontWeight.w500,
color: CustomColors.red,
),
)
],
),
SizedBox(height: 20),
Visibility(
visible: model.smokingArea == "SmokingArea",
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
"Sigara İçilebilir Alan",
style: TextStyle(
fontSize: Screen.size(16),
),
),
],
),
),
],
),
SizedBox(height: 25),
Line(height: 1.5),
SizedBox(height: 25),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Sipariş Tarihi",
style: TextStyle(
fontSize: Screen.size(16),
fontWeight: FontWeight.w500),
),
Text(
dateFormat.format(model.dateCreated),
style: TextStyle(
fontSize: Screen.size(16),
fontWeight: FontWeight.w500,
color: CustomColors.red,
),
)
],
),
SizedBox(height: 25),
Line(height: 1.5),
SizedBox(height: 25),
Column(
children: model.cart.cartItems
.map(
(item) => Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
item.meal.name,
style: TextStyle(
fontSize: Screen.size(16),
fontWeight: FontWeight.w500),
),
SizedBox(height: Screen.height(1)),
Money(
value: item.price,
style: TextStyle(
color: CustomColors.red,
fontSize: Screen.size(16),
fontWeight: FontWeight.bold,
),
),
],
),
),
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
"Adet ",
style: TextStyle(
fontSize: Screen.size(16),
fontWeight: FontWeight.w500),
),
SizedBox(height: Screen.height(1)),
Text(
item.quantity.toString(),
style: TextStyle(
color: CustomColors.red,
fontSize: Screen.size(16),
fontWeight: FontWeight.bold,
),
),
],
),
),
],
),
SizedBox(height: 10),
Visibility(
visible: model.cart.cartItems.last.meal.id !=
item.meal.id,
child: Column(
children: [
Line(),
SizedBox(height: 15),
],
),
),
],
),
)
.toList(),
),
SizedBox(height: 35),
SizedBox(height: 15),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Sipariş Notu : ",
style: TextStyle(
fontSize: Screen.size(16), fontWeight: FontWeight.w500),
),
Flexible(
child: Text(
model.orderNote,
style: TextStyle(
fontSize: Screen.size(16),
fontWeight: FontWeight.w500,
color: CustomColors.red,
),
),
)
],
),
SizedBox(height: 15),
Line(height: 1.5),
SizedBox(height: 15),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Tolam Fiyat",
style: TextStyle(
fontSize: Screen.size(18),
fontWeight: FontWeight.bold,
),
),
Money(
value: model.orderTotal,
style: TextStyle(
color: CustomColors.red,
fontSize: Screen.size(20),
fontWeight: FontWeight.bold,
),
),
],
),
SizedBox(height: 15),
Line(height: 1.8),
],
)
: Loading();
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.