Skip to content

Commit da7bd65

Browse files
authored
Order statuses (#8)
* Order card status designed * Order status legend
1 parent aff4f54 commit da7bd65

17 files changed

Lines changed: 454 additions & 64 deletions

assets/translations/en.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,31 @@
135135
"create_order_edit_shipping_data": "Location details",
136136
"create_order_shipping_me": "My address",
137137
"create_order_shipping_other": "Another address",
138+
"order_status_draft": "Draft",
139+
"order_status_failed": "Failed",
140+
"order_status_refunded": "Refunded",
141+
"order_status_canceled": "Canceled",
142+
"order_status_completed": "Completed",
143+
"order_status_hold": "On hold",
144+
"order_status_pending": "New",
145+
"order_status_processing": "Processing",
146+
"order_status_dialog_title": "Order status information",
147+
"order_status_draft_title": "Draft order",
148+
"order_status_draft_desc": "Our managers are creating your order right now.",
149+
"order_status_failed_title": "The order could not be fulfilled",
150+
"order_status_failed_desc": "The order could not be fulfilled for certain reasons, for example, if our managers could not contact you.",
151+
"order_status_refunded_title": "Order refund",
152+
"order_status_refunded_desc": "The ordered product(s) has been returned to our store and the customer has been reimbursed for the cost of the product(s).",
153+
"order_status_canceled_title": "The order has been cancelled",
154+
"order_status_canceled_desc": "The order was canceled by the buyer on the website, in the application, or by phone.",
155+
"order_status_completed_title": "Order completed",
156+
"order_status_completed_desc": "The order was successfully completed, the goods were delivered to the buyer.",
157+
"order_status_hold_title": "Clarification of information",
158+
"order_status_hold_desc": "The order has been put on hold to clarify additional information on the product, its configuration, or the client's data.",
159+
"order_status_pending_title": "New order",
160+
"order_status_pending_desc": "We have received your order, our managers will contact you soon.",
161+
"order_status_processing_title": "In progress",
162+
"order_status_processing_desc": "We have confirmed the order and received all the necessary information from you, we are working hard to get your order as soon as possible.",
138163
"search": "Search",
139164
"error": "Error",
140165
"error_validation_first_name": "Please, enter valid first name",

assets/translations/ru.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,31 @@
135135
"create_order_edit_shipping_data": "Подробное расположение",
136136
"create_order_shipping_me": "Мой адрес",
137137
"create_order_shipping_other": "Другой адрес",
138+
"order_status_draft": "Черновик",
139+
"order_status_failed": "Неудавшийся",
140+
"order_status_refunded": "Возмещен",
141+
"order_status_canceled": "Отменен",
142+
"order_status_completed": "Выполнен",
143+
"order_status_hold": "На удержании",
144+
"order_status_pending": "Новый",
145+
"order_status_processing": "Обработка",
146+
"order_status_dialog_title": "Информация о статусах заказов",
147+
"order_status_draft_title": "Черновик заказа",
148+
"order_status_draft_desc": "Наши менеджеры создают ваш заказ прямо сейчас.",
149+
"order_status_failed_title": "Не удалось выполнить заказ",
150+
"order_status_failed_desc": "Заказ не удалось выполнить по определенным причинам, например, если наши менеджеры не смогли с вами связаться.",
151+
"order_status_refunded_title": "Возврат средств",
152+
"order_status_refunded_desc": "Заказанный товар(ы) был возвращен в наш магазин, а покупателю возмещена стоимость данного товара(ов).",
153+
"order_status_canceled_title": "Заказ был отменен",
154+
"order_status_canceled_desc": "Заказ был отменен покупателем на сайте, в приложении или в телефонном режиме.",
155+
"order_status_completed_title": "Заказ выполнен",
156+
"order_status_completed_desc": "Заказ успешно выполнен, товар доставлен покупателю.",
157+
"order_status_hold_title": "Уточнение информации",
158+
"order_status_hold_desc": "Заказ поставлен на паузу для уточнения дополнительной информации по товару, его комплектации или данным клиента.",
159+
"order_status_pending_title": "Новый заказ",
160+
"order_status_pending_desc": "Мы получили ваш заказ, наши менеджеры свяжутся с вами в ближайшее время.",
161+
"order_status_processing_title": "В процессе выполнения",
162+
"order_status_processing_desc": "Мы подтвердили заказ и получили от вас всю необходимую информацию, мы упорно работаем, чтобы вы получили заказ как можно быстрее.",
138163
"search": "Поиск",
139164
"error": "Ошибка",
140165
"error_validation_first_name": "Заполните имя",

assets/translations/uk.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,31 @@
135135
"create_order_edit_shipping_data": "Детальне місцезнаходження",
136136
"create_order_shipping_me": "Моя адреса",
137137
"create_order_shipping_other": "Інша адреса",
138+
"order_status_draft": "Чернетка",
139+
"order_status_failed": "Невдале",
140+
"order_status_refunded": "Відшкодовано",
141+
"order_status_canceled": "Скасовано",
142+
"order_status_completed": "Виконано",
143+
"order_status_hold": "На утриманні",
144+
"order_status_pending": "Нове",
145+
"order_status_processing": "Обробка",
146+
"order_status_dialog_title": "Інформація щодо статусів замовлень",
147+
"order_status_draft_title": "Чернетка замовлення",
148+
"order_status_draft_desc": "Наші менеджери створюють ваше замолення прямо зараз.",
149+
"order_status_failed_title": "Не вдалося виконати замовлення",
150+
"order_status_failed_desc": "Замовленя не вдалося виконати з певних причин, наприклад якщо наші менеджери не змогли з вами зв'язатися.",
151+
"order_status_refunded_title": "Повернення коштів",
152+
"order_status_refunded_desc": "Замовлений товар(и) було повернуто до нашого магазину, а покупцю відшкодовано вартісь даного товару(ів).",
153+
"order_status_canceled_title": "Замовлення було скасовано",
154+
"order_status_canceled_desc": "Замовлення було скасовано покупцем на сайті, в додатку, або в телефонному режимі.",
155+
"order_status_completed_title": "Замовлення виконано",
156+
"order_status_completed_desc": "Замовлення успішно виконано, товар доставлено до покупця.",
157+
"order_status_hold_title": "Уточнення інформації",
158+
"order_status_hold_desc": "Замовлення поставлено на паузу для уточнення додаткової інформації по товару, його комплектації, або даних клієнта.",
159+
"order_status_pending_title": "Нове замовлення",
160+
"order_status_pending_desc": "Ми отримали ваше замовлення, наші менеджери зв'яжуться з вами найближчим часом.",
161+
"order_status_processing_title": "В процесі виконання",
162+
"order_status_processing_desc": "Ми підтвердили замовлення та отримали від вас всю необхідну інформацію, ми наполегливо працюємо щоб ви отримали замовлення якнайшвидше.",
138163
"search": "Пошук",
139164
"error": "Помилка",
140165
"error_validation_first_name": "Необхідно заповнити Ім'я",

lib/config/theme.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
77
class WooAppTheme {
88
static const Color colorCommonBackground = Color(0xFFfdfcff);
99
static const Color colorCommonText = Color(0xFF1a1c1e);
10+
static const Color colorCommonText2 = Color(0xda001d35);
1011

1112
static const Color colorCommonSectionBackground = Color(0xccd6e4f7);
1213
static const Color colorCommonSectionForeground = Color(0xFF0f1d2a);
@@ -53,6 +54,21 @@ class WooAppTheme {
5354
static const Color colorProductStatusBgDefault = Color(0xFFFFF3F3);
5455
static const Color colorProductStatusTextDefault = Colors.redAccent;
5556

57+
static const Color colorOrderStatusBgBlue = Color(0xFF9ccaff);
58+
static const Color colorOrderStatusTextBlue = Color(0xFF003256);
59+
static const Color colorOrderStatusBgGray2 = Color(0xFF3b4857);
60+
static const Color colorOrderStatusTextGray2 = Color(0xFFd6e4f7);
61+
static const Color colorOrderStatusBgGray = Color(0xFFdfe3eb);
62+
static const Color colorOrderStatusTextGray = Color(0xFF42474e);
63+
static const Color colorOrderStatusBgPink = Color(0xFFf1daff);
64+
static const Color colorOrderStatusTextPink = Color(0xFF241432);
65+
static const Color colorOrderStatusBgRed = Color(0xFF93000a);
66+
static const Color colorOrderStatusTextRed = Color(0xFFffdad6);
67+
static const Color colorOrderStatusBgYellow = Color(0xfff8dda7);
68+
static const Color colorOrderStatusTextYellow = Color(0xff9c6e1a);
69+
static const Color colorOrderStatusBgGreen = Color(0xffc0eaaf);
70+
static const Color colorOrderStatusTextGreen = Color(0xff42650c);
71+
5672
static const Color colorCardOrderBackground = colorCardProductBackground;
5773
static const Color colorCardOrderForeground = colorCardProductText;
5874

lib/extensions/extensions_context.dart

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void hideKeyboardForce(BuildContext context) {
1313
FocusScope.of(context).requestFocus(new FocusNode());
1414
}
1515

16-
void showBottomOptions(BuildContext context, Widget child) {
16+
void showWooBottomSheet(BuildContext context, Widget child) {
1717
hideKeyboardForce(context);
1818
showModalBottomSheet(
1919
shape: RoundedRectangleBorder(
@@ -35,3 +35,48 @@ void showBottomOptions(BuildContext context, Widget child) {
3535
),
3636
);
3737
}
38+
39+
void showWooScrollableBottomSheet(
40+
BuildContext context, {
41+
required Widget Function(ScrollController) builder,
42+
}) {
43+
showModalBottomSheet(
44+
context: context,
45+
isScrollControlled: true,
46+
backgroundColor: Colors.transparent,
47+
builder: (context) {
48+
return GestureDetector(
49+
onTap: () => Navigator.of(context).pop(),
50+
child: Container(
51+
color: Color.fromRGBO(0, 0, 0, 0.001),
52+
child: GestureDetector(
53+
onTap: () {},
54+
child: DraggableScrollableSheet(
55+
initialChildSize: 0.4,
56+
minChildSize: 0.4,
57+
maxChildSize: 0.85,
58+
builder: (_, controller) => Container(
59+
decoration: BoxDecoration(
60+
color: Colors.white,
61+
borderRadius: BorderRadius.only(
62+
topLeft: const Radius.circular(20.0),
63+
topRight: const Radius.circular(20.0),
64+
),
65+
),
66+
child: Column(
67+
children: [
68+
SizedBox(height: 10),
69+
BottomSheetHeading(),
70+
Expanded(
71+
child: builder(controller),
72+
),
73+
],
74+
),
75+
),
76+
),
77+
),
78+
),
79+
);
80+
},
81+
);
82+
}

lib/extensions/extensions_product.dart

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import 'package:html/parser.dart';
2+
import 'package:intl/intl.dart' as intl;
3+
4+
const _dateFormatSeverDefault = "yyyy-MM-dd'T'HH:mm:SS";
5+
const _dateFormatUiDefault = "dd MMMM yyyy',' HH:mm";
26

37
String parseHtml(String htmlDescription) {
48
final document = parse(htmlDescription);
@@ -14,3 +18,22 @@ String parseTotals(
1418
var partFraction = totals.substring(totals.length - fraction, totals.length);
1519
return '$partBase$delimiter$partFraction';
1620
}
21+
22+
String convertDate(
23+
String? input, {
24+
String inFormat = _dateFormatSeverDefault,
25+
String outFormat = _dateFormatUiDefault,
26+
bool inFormatUTC = false,
27+
bool convertToLocal = false,
28+
String? locale,
29+
}) {
30+
if (input == null || input.isEmpty) return '';
31+
try {
32+
DateTime dateUTC = intl.DateFormat(inFormat).parse(input, inFormatUTC);
33+
return intl
34+
.DateFormat(outFormat, locale)
35+
.format(convertToLocal ? dateUTC.toLocal() : dateUTC);
36+
} catch (e) {
37+
return '';
38+
}
39+
}

lib/screens/catalog/catalog_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class _CatalogScreenState extends State<CatalogScreen> {
3939
backgroundColor: WooAppTheme.colorToolbarBackground,
4040
actions: [
4141
IconButton(
42-
onPressed: () => showBottomOptions(
42+
onPressed: () => showWooBottomSheet(
4343
context,
4444
SortingWidget(_sort, SortingType.catalog, (newSort) {
4545
setState(() {

lib/screens/featured/featured.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class _FeaturedListState extends State<FeaturedListView> {
139139
),
140140
actions: [
141141
IconButton(
142-
onPressed: () => showBottomOptions(
142+
onPressed: () => showWooBottomSheet(
143143
context,
144144
SortingWidget(_sort, SortingType.home, (newSort) {
145145
setState(() {
@@ -155,7 +155,7 @@ class _FeaturedListState extends State<FeaturedListView> {
155155
),
156156
IconButton(
157157
onPressed: () {
158-
showBottomOptions(
158+
showWooBottomSheet(
159159
context,
160160
FeaturedFilterWidget(
161161
_filter,

lib/screens/orders/list/orders_screen.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import 'package:lottie/lottie.dart';
55
import 'package:wooapp/config/theme.dart';
66
import 'package:wooapp/config/config.dart';
77
import 'package:wooapp/datasource/orders_data_source.dart';
8+
import 'package:wooapp/extensions/extensions_context.dart';
89
import 'package:wooapp/locator.dart';
910
import 'package:wooapp/model/order.dart';
11+
import 'package:wooapp/screens/orders/statuses/orders_statuses_screen.dart';
1012
import 'package:wooapp/widget/widget_order_item.dart';
1113

1214
class OrdersScreen extends StatefulWidget {
@@ -30,6 +32,20 @@ class _OrdersScreenState extends State<OrdersScreen> {
3032
),
3133
).tr(),
3234
backgroundColor: WooAppTheme.colorToolbarBackground,
35+
actions: [
36+
IconButton(
37+
onPressed: () => showWooScrollableBottomSheet(
38+
context,
39+
builder: (controller) => OrderStatusesScreen(
40+
scrollController: controller,
41+
),
42+
),
43+
icon: Icon(
44+
Icons.info,
45+
color: WooAppTheme.colorToolbarForeground,
46+
),
47+
),
48+
],
3349
),
3450
backgroundColor: WooAppTheme.colorCommonBackground,
3551
body: SafeArea(

0 commit comments

Comments
 (0)