Skip to content

Commit

Permalink
fix: test from release (#207)
Browse files Browse the repository at this point in the history
* using system language as default value

* allow setup menu from tutorial

* fix test

* set up example menu

* add order attributes tutorial
  • Loading branch information
evan361425 committed Jul 6, 2024
1 parent 0a9ee67 commit bcab49e
Show file tree
Hide file tree
Showing 33 changed files with 761 additions and 300 deletions.
41 changes: 36 additions & 5 deletions assets/l10n/en/menu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,48 @@ subtitle: Categories, Products
tutorial:
title: Create Your Menu
content: Let's start by creating a menu!
createExample: Help create an example menu to test.
search:
hint: Search for products, ingredients, quantities
notFound: Couldn't find relevant information. Did you misspell something?
example:
catalog:
burger: Burgers
drink: Drinks
side: Side
other: Others
product:
cheeseBurger: Cheese Burger
veggieBurger: Veggie Burger
hamBurger: Ham Burger
cola: Cola
coffee: Coffee
fries: Fries
straw: Straw
plasticBag: Plastic Bag
ingredient:
cheese: Cheese
lettuce: Lettuce
tomato: Tomato
bun: Bun
chili: Chili Sauce
ham: Ham
cola: Can of Cola
coffee: Drip Coffee
fries: Bag of Fries
straw: Straw
plasticBag: Plastic Bag
quantity:
small: Small
large: Large
none: None
catalog:
headerInfo:
- Categories
- Displayed on the upper rectangle in homepage
tutorial:
title: Create First Catalog
emptyBody: |-
Similar "products" will be grouped under "categories",
making it convenient for ordering, such as:
Similar products will be grouped under categories,
making ordering convenient, such as:
• "Cheese Burger", "Veggie Burger" > "Burgers"
• "Plastic Bag", "Eco Cup" > "Others"
title:
Expand All @@ -26,7 +56,8 @@ catalog:
reorder: Reorder Categories
dialogDeletionContent:
- =0: No products inside
other: Will delete {count} products together
=1: Will also delete {count} related product
other: Will also delete {count} related products
- Warning message when deleting product categories on the menu page
- count: {type: int, mode: plural}
name:
Expand Down
5 changes: 5 additions & 0 deletions assets/l10n/en/order.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
$prefix: order
title: Ordering
btn: Order
tutorial:
title: Ordering!
content: |
Once you have set up your menu, you can start ordering!
Let's tap and go see what's available!
snackbar:
cashier:
notEnough: Insufficient cash in the cashier!
Expand Down
18 changes: 18 additions & 0 deletions assets/l10n/en/order_attribute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@ tutorial:
content: |-
This is where you set customer information, such as dine-in, takeout, office worker, etc.
This information helps us track who comes to consume and make better business strategies.
createExample: Help create an example to test.
example:
age: Age
_age:
$prefix: age
child: Child
adult: Adult
senior: Senior
place: Place
_place:
$prefix: place
takeout: Takeout
dineIn: Dine-in
ecoFriendly: Eco-Friendly
_ecoFriendly:
$prefix: ecoFriendly
reusableBottle: Reusable Bottle
reusableBag: Reusable Bag
meta:
mode:
- 'Mode: {name}'
Expand Down
10 changes: 2 additions & 8 deletions assets/l10n/en/transit.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
$prefix: transit
title: Data Transfer
description: Importing and Exporting Store Information and Orders
tutorial:
title: Sync Multiple Devices
content: |-
This is where you can import/export menu, inventory, order records, and other information.
We provide two methods: Google Sheets and plain text, making it convenient to sync data across different devices.
method:
title: Please Select Transfer Method
name:
Expand Down Expand Up @@ -67,7 +61,7 @@ export:
preview:
btn: Preview
title: Preview Output Result
btn: Import
btn: Export
import:
preview:
btn: Preview
Expand All @@ -86,7 +80,7 @@ import:
header: After import, old ingredients won't be removed to avoid affecting the "Menu" status.
quantity:
header: After import, old quantities won't be removed to avoid affecting the "Menu" status.
btn: Export
btn: Import
error:
columnCount:
- Insufficient data, {columns} columns required
Expand Down
34 changes: 32 additions & 2 deletions assets/l10n/zh/menu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,43 @@ subtitle: 產品種類、產品
tutorial:
title: 建立屬於你的菜單
content: 首先我們來開始建立一份菜單吧!
createExample: 幫助建立一份範例菜單以供測試。
search:
hint: 搜尋產品、成分、份量
notFound: 搜尋不到相關資訊,打錯字了嗎?
example:
catalog:
burger: 漢堡
drink: 飲品
side: 點心
other: 其他
product:
cheeseBurger: 起司漢堡
veggieBurger: 蔬菜漢堡
hamBurger: 火腿漢堡
cola: 可樂
coffee: 咖啡
fries: 薯條
straw: 吸管
plasticBag: 塑膠袋
ingredient:
cheese: 起司
lettuce: 萵苣
tomato: 番茄
bun: 麵包
chili: 醬料
ham: 火腿
cola: 可樂罐
coffee: 濾掛咖啡包
fries: 薯條(300g)
straw: 吸管(根)
plasticBag: 塑膠袋(個)
quantity:
small: 少量
large: 增量
none:
catalog:
headerInfo: 種類
tutorial:
title: Create First Catalog
emptyBody: |-
我們會把相似「產品」放在「產品種類」中,
到時候點餐會比較方便,例如:
Expand Down
5 changes: 5 additions & 0 deletions assets/l10n/zh/order.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
$prefix: order
title: 點餐
btn: 點餐
tutorial:
title: 開始點餐!
content: |
一旦設定好菜單,就可以開始點餐囉
讓我們趕緊進去看看有什麼吧!
snackbar:
cashier:
notEnough: 收銀機錢不夠找囉!
Expand Down
18 changes: 18 additions & 0 deletions assets/l10n/zh/order_attribute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ tutorial:
content: |-
這裡是用來設定顧客的資訊,例如:內用、外帶、上班族等。
這些資訊可以幫助我們統計哪些人來消費,進而做出更好的經營策略。
createExample: 幫助建立一份範例以供測試。
example:
age: 年齡
_age:
$prefix: age
child: 小孩
adult: 成人
senior: 長者
place: 位置
_place:
$prefix: place
takeout: 外帶
dineIn: 內用
ecoFriendly: 環保
_ecoFriendly:
$prefix: ecoFriendly
reusableBottle: 環保杯
reusableBag: 環保袋
meta:
mode: 種類:{name}
default: 預設:{name}
Expand Down
10 changes: 2 additions & 8 deletions assets/l10n/zh/transit.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
$prefix: "transit"
title: 資料轉移
description: 匯入、匯出店家資訊和訂單
tutorial:
title: 同步多台裝置
content: |-
這裡是用來匯入匯出菜單、庫存、訂單記錄等資訊的地方。
我們提供了 Google 試算表和純文字兩種方式,讓您可以方便地在不同裝置間同步資料。
method:
title: 請選擇欲轉移的方式
name:
Expand Down Expand Up @@ -51,7 +45,7 @@ export:
preview:
btn: 預覽
title: 預覽輸出結果
btn: 匯入
btn: 匯出
import:
preview:
btn: 預覽
Expand All @@ -66,7 +60,7 @@ import:
header: 匯入後,為了避免影響「菜單」的狀況,並不會把舊的成分移除。
quantity:
header: 匯入後,為了避免影響「菜單」的狀況,並不會把舊的份量移除。
btn: 匯出
btn: 匯入
error:
columnCount: 資料量不足,需要 {columns} 個欄位
duplicate: 將忽略本行,相同的項目已於前面出現
Expand Down
2 changes: 1 addition & 1 deletion lib/components/style/date_range_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Future<DateTimeRange?> showMyDateRangePicker(BuildContext context, DateTimeRange
initialEntryMode: DatePickerEntryMode.calendarOnly,
firstDate: DateTime(2021, 1),
lastDate: DateTime.now(),
locale: LanguageSetting.instance.value.locale,
locale: LanguageSetting.instance.language.locale,

/// TODO: should fix this bug
/// Wrapping the design, because the background will use a slightly
Expand Down
46 changes: 24 additions & 22 deletions lib/components/tutorial.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:possystem/services/cache.dart';
import 'package:spotlight_ant/spotlight_ant.dart';

Expand Down Expand Up @@ -31,45 +30,49 @@ class TutorialWrapper extends StatelessWidget {
class Tutorial extends StatelessWidget {
final String id;

final String? title;

/// index of the tutorial
///
/// 0-based index, if not provided, the tutorial will be ordered by
/// the time of the widget built.
final int? index;

final String? title;

final String message;

/// widget to be placed below the [message]
final Widget? below;

final SpotlightBuilder spotlightBuilder;

final EdgeInsets padding;

/// force disabling tutorial
final bool disable;

/// if true, the tutorial will only be shown when the widget is 100% visible
final bool monitorVisibility;

final Widget child;

final SpotlightDurationConfig duration;
/// action to be executed after the tutorial is dismissed
final Future<void> Function()? action;

final String? route;
static bool debug = false;

const Tutorial({
super.key,
required this.id,
this.index,
this.title,
required this.message,
this.index,
this.below,
this.spotlightBuilder = const SpotlightCircularBuilder(),
this.padding = const EdgeInsets.all(8),
this.disable = false,
this.monitorVisibility = false,
this.route,
this.action,
required this.child,
this.duration = const SpotlightDurationConfig(
bump: Duration(milliseconds: 500),
zoomIn: Duration(milliseconds: 600),
zoomOut: Duration(milliseconds: 600),
contentFadeIn: Duration(milliseconds: 200),
),
});

@override
Expand All @@ -78,31 +81,30 @@ class Tutorial extends StatelessWidget {
return child;
}

final theme = Theme.of(context);
SpotlightAnt.debug = true;
return SpotlightAnt(
enable: enabled,
index: index,
duration: duration,
duration: debug ? SpotlightDurationConfig.zero : const SpotlightDurationConfig(),
monitorId: monitorVisibility ? 'tutorial.$id' : null,
onDismiss: _onDismiss,
onDismissed: route != null ? () => context.goNamed(route!) : null,
onDismissed: action,
spotlight: SpotlightConfig(
builder: spotlightBuilder,
padding: padding,
onTap: route != null ? () async => SpotlightAntAction.skip : null,
),
backdrop: SpotlightBackdropConfig(silent: route != null),
backdrop: const SpotlightBackdropConfig(),
action: const SpotlightActionConfig(
enabled: [SpotlightAntAction.prev, SpotlightAntAction.next],
),
content: SpotlightContent(
fontSize: theme.textTheme.titleMedium!.fontSize,
child: Column(children: [
if (title != null)
Text(
title!,
style: Theme.of(context).textTheme.headlineMedium?.copyWith(color: Colors.white),
),
if (title != null) Text(title!, style: theme.textTheme.headlineMedium!.copyWith(color: Colors.white)),
const SizedBox(height: 16),
Text(message),
if (below != null) below!,
]),
),
child: child,
Expand Down
Loading

0 comments on commit bcab49e

Please sign in to comment.