Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94138ba7f4 | ||
|
|
33b54fe454 | ||
|
|
901e42a41b | ||
|
|
af8934fe7f | ||
|
|
048c5a9ff4 | ||
|
|
1d4028f486 | ||
|
|
944493a39b | ||
|
|
6d08db54a5 | ||
|
|
3f9256491d | ||
|
|
95e40f31cc | ||
|
|
639d2033f0 | ||
|
|
4da7fb32de | ||
|
|
147ab866e1 | ||
|
|
0526baa3c8 | ||
|
|
b49fb59db4 | ||
|
|
9608e8b9fb | ||
|
|
5ccc06b0f7 | ||
|
|
7c69197396 | ||
|
|
137eca4c69 | ||
|
|
b8b70a87f9 | ||
|
|
3053246bb8 | ||
|
|
5cb5ef6396 | ||
|
|
a6d5b9cd2d | ||
|
|
18abf4eb82 | ||
|
|
70076d71c1 | ||
|
|
6487c0db54 | ||
|
|
ab06fadea8 | ||
|
|
1aa7cf3477 | ||
|
|
3ed58e1596 | ||
|
|
97e4908126 | ||
|
|
154d696e70 | ||
|
|
36f36b815f | ||
|
|
6d789c7b19 | ||
|
|
cdaaa63d67 | ||
|
|
f1d7dbb423 | ||
|
|
a76b872966 | ||
|
|
c21ccbd54d | ||
|
|
fce670664b | ||
|
|
8f3d3509ea | ||
|
|
e2f0d37edd | ||
|
|
1f85ae1e63 | ||
|
|
e2f815e141 | ||
|
|
f831fd1405 | ||
|
|
7e8182259f | ||
|
|
88dd90ed7c | ||
|
|
ae4c4046c3 | ||
|
|
cef00db911 | ||
|
|
4f9aa4f683 | ||
|
|
1a578c925d | ||
|
|
7ffcc848d0 |
@@ -0,0 +1,250 @@
|
||||
# TODO — Flutter Wisetronic Dart 3 空安全迁移
|
||||
|
||||
> ## ✅ Web 构建已成功!(2026-08-01)
|
||||
> **`flutter build web --no-tree-shake-icons` → ✓ Built build/web/(main.dart.js 4.5M)**
|
||||
> - `dart analyze lib`: 仅剩 **6 error**,全部在 `utils/util_io.dart`(原生路径,Web 已排除,见 §5 延后)。
|
||||
> - Web 可达错误: **0**。
|
||||
> - 峰值 2374 → 6(全部 util_io 原生)。0 语法损坏。分支 `dev2`。
|
||||
> - 构建脚本: `./build_web.sh`(构建)/ `./build_web.sh run`(Chrome 运行)。
|
||||
> - **关键修复**: `cross_file` override 到 `0.3.4+2`(旧版 0.3.1+4 用了 Dart3 移除的 `UnmodifiableUint8ListView`;0.3.5+ 需 Dart 3.10)。
|
||||
|
||||
---
|
||||
|
||||
## 0. 快速恢复(Resume 起点)
|
||||
|
||||
```bash
|
||||
cd /Users/peima/StudioProjects/flutter_wisetronic
|
||||
git log --oneline -1 # 确认在最新提交
|
||||
dart analyze lib | tail -5 # 当前: 仅 6 error(util_io.dart)
|
||||
./build_web.sh # 构建: ✓ Built build/web/
|
||||
./build_web.sh run # Chrome 运行调试
|
||||
|
||||
# 重跑自动修复脚本(安全,带损坏自检,可随时跑)—— 已无 web 可达错误,通常无需再跑
|
||||
python3 tools/nullfix.py --max-rounds 12
|
||||
```
|
||||
|
||||
**核心原则**:每次改动后用 `dart analyze lib | grep -cE '\s+error\s+-'` 数错误;脚本若报"检测到语法损坏"会自动中止,`git checkout -- lib` 回滚。
|
||||
|
||||
---
|
||||
|
||||
## 1. 剩余错误分布(118 个)
|
||||
|
||||
| 规则 | 数量 | 说明 |
|
||||
|------|------|------|
|
||||
| `unchecked_use_of_nullable_value` | 44 | 可空值当非空用(方法调用/条件/迭代器,多为多行) |
|
||||
| `invalid_assignment` | 34 | 赋值类型不匹配(复杂表达式) |
|
||||
| `argument_type_not_assignable` | 22 | 参数类型不匹配(三元/比较/Map字面量) |
|
||||
| `return_of_invalid_type_from_closure` | 4 | 闭包返回类型 |
|
||||
| `undefined_getter` | 3 | 多为 `.buttonColor`(Flutter 3 移除) |
|
||||
| `return_of_invalid_type` | 3 | 函数 `return null` 但返回类型非空 |
|
||||
| `undefined_named_parameter` | 2 | |
|
||||
| `undefined_method` | 2 | |
|
||||
| `creation_with_non_type` | 2 | 类名拼错(util_io 内) |
|
||||
| `extra_positional_arguments_could_be_named` | 1 | |
|
||||
| `body_might_complete_normally` | 1 | |
|
||||
|
||||
**错误最多的文件**(详细见 `dart analyze lib`):
|
||||
|
||||
```
|
||||
6 utils/util_io.dart ← 延后(仅原生,Web 构建已排除)
|
||||
5 widgets/desktop/desktop_edit_address.dart ← .trim() 多行(见 §3,已知修法)
|
||||
5 widgets/mobile/mobile_edit_address.dart ← 同上
|
||||
5 widgets/general/add_remove_button.dart
|
||||
5 widgets/general/parabolic_animation_widget.dart
|
||||
5 widgets/general/sliding_up_panel.dart
|
||||
4 widgets/desktop/desktop_me.dart
|
||||
4 widgets/mobile/mobile_attribute_selection.dart
|
||||
4 widgets/mobile/mobile_order_detail.dart
|
||||
3 widgets/desktop/desktop_coupons.dart / desktop_my_support / desktop_order_detail / shop_products
|
||||
3 widgets/general/animation_point_manager / popup_animation_widget
|
||||
3 widgets/mobile/mobile_coupons / mobile_me / mobile_my_support / mobile_orders / shopping_cart_bar
|
||||
2 约 12 个文件(blog/orders/product_item/shopping_cart 等)
|
||||
1 约 25 个文件(单点错误)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. 推荐处理顺序
|
||||
|
||||
1. **edit_address(5+5)** — 已知修法,见 §3,最快。
|
||||
2. **parabolic/popup_animation(5+3)** — `late` 字段已修,可能还有 unchecked_use(offset 计算方法调用),手动看。
|
||||
3. **sliding_up_panel(5)** — 第三方面板 widget 适配,手动。
|
||||
4. **add_remove_button(5)** — badges 相关,手动。
|
||||
5. **散落的 2-error / 1-error 文件** — 用 `dart analyze lib/<file>` 逐个看,多为加 `!`。
|
||||
6. **util_io.dart(6)** — 最后处理(见 §5),不影响 Web 构建。
|
||||
|
||||
**目标**:先清掉 Web 可达错误(`flutter build web` 的 112),让 Web 能跑;`util_io` 原生路径可延后。
|
||||
|
||||
---
|
||||
|
||||
## 3. 已知具体修法(直接套用)
|
||||
|
||||
### 3.1 edit_address `.trim()` 多行(desktop + mobile,各 5 处)
|
||||
错误:`A nullable expression can't be used to invoke 'trim'`。代码结构:
|
||||
```dart
|
||||
validator: (String? value) {
|
||||
if (value // ← value 是 String?
|
||||
.trim()
|
||||
.isEmpty) {
|
||||
```
|
||||
**修法**:把 `if (value` 行改成 `if (value!`。
|
||||
```python
|
||||
# 上次脚本 bug:用了 rstrip() 应该用 strip()。正确版:
|
||||
for p in ['lib/widgets/desktop/desktop_edit_address.dart','lib/widgets/mobile/mobile_edit_address.dart']:
|
||||
lines=open(p).read().split('\n'); n=0
|
||||
for i in range(len(lines)):
|
||||
if lines[i].strip()=='if (value' and lines[i+1].lstrip().startswith('.trim()'):
|
||||
lines[i]=lines[i].rstrip()+'!'; n+=1 # 注意 rstrip() 保留前导缩进
|
||||
open(p,'w').write('\n'.join(lines))
|
||||
```
|
||||
(`.buttonColor`→`.colorScheme.primary` 已在两个文件修好。)
|
||||
|
||||
### 3.2 通用模式(手动加 `!` / `?? 默认` / `== true`)
|
||||
- `String? → String` 参数:`field` → `field!`(确认运行时非空)。
|
||||
- `num?/int?/double?` 比较:`subtotal > minPrice` → `subtotal > minPrice!` 或 `(minPrice ?? 0)`。
|
||||
- `bool?` 当条件:`if (x)` → `if (x == true)`;`if (!x)` → `if (x != true)`。
|
||||
- `return null;` 但返回类型非空:把函数返回类型加 `?`(如 `CategoryProducts? foo()`)。
|
||||
- 局部变量赋值 nullable:声明加 `?`(如 `Map<String,dynamic>? x = ...`),下游 nullfix 会补 `!`。
|
||||
- 多行方法调用 `.toUpperCase()` / `.trim()`:接收者在上一行末尾,在该行末尾加 `!`。
|
||||
|
||||
### 3.3 可复用的定向脚本(一次性,贴进 bash 跑)
|
||||
|
||||
**a) 条件修复(analyzer 驱动,只修简单 `if (chain)`)** — 已用过,安全:
|
||||
```python
|
||||
python3 -c "
|
||||
import re,subprocess
|
||||
ERR=re.compile(r'\s+error\s+-\s+([\w/.\-]+):(\d+):(\d+)\s+-\s+(.*?)\s+-\s+([a-z_]+)\s*\$')
|
||||
pat=re.compile(r'^(\s*if \()(!?)([\w.!\[\]]+)(\)\s*\{?\s*)\$')
|
||||
out=subprocess.run(['dart','analyze','lib'],capture_output=True,text=True).stdout
|
||||
tg={}
|
||||
for ln in out.splitlines():
|
||||
m=ERR.match(ln)
|
||||
if m and 'used as a condition' in m.group(4): tg.setdefault('lib/'+m.group(1),set()).add(int(m.group(2)))
|
||||
n=0
|
||||
for p,ls in tg.items():
|
||||
L=open(p).read().split('\n');ch=False
|
||||
for i,x in enumerate(L,1):
|
||||
if i in ls:
|
||||
m=pat.match(x.rstrip('\n'))
|
||||
if m: L[i-1]=m.group(1)+m.group(3)+(' != true' if m.group(2) else ' == true')+m.group(4);ch=True;n+=1
|
||||
if ch: open(p,'w').write('\n'.join(L))
|
||||
print('fixed',n)
|
||||
"
|
||||
```
|
||||
|
||||
**b) 局部变量改可空(严格类型,已验证安全)** — 跑完再 `python3 tools/nullfix.py` 吃级联:
|
||||
```python
|
||||
python3 -c "
|
||||
import re,subprocess
|
||||
ERR=re.compile(r'\s+error\s+-\s+([\w/.\-]+):(\d+):(\d+)\s+-\s+(.*?)\s+-\s+([a-z_]+)\s*\$')
|
||||
NAMEQ=re.compile(r\"'([^']+)'\"); TYPE=r'(?:[A-Z]\w*(?:<[^;]*>)?|int|double|String|bool|num|dynamic|List<[^;]*>|Map<[^;]*>|Set<[^;]*>)'
|
||||
out=subprocess.run(['dart','analyze','lib'],capture_output=True,text=True).stdout;tg={}
|
||||
for ln in out.splitlines():
|
||||
m=ERR.match(ln)
|
||||
if m and m.group(5)=='not_assigned_potentially_non_nullable_local_variable':
|
||||
nm=NAMEQ.search(m.group(4))
|
||||
if nm: tg.setdefault('lib/'+m.group(1),[]).append((int(m.group(2)),nm.group(1)))
|
||||
dp=re.compile(r'^(\s+(?:final\s+|const\s+)?)('+TYPE+r')\s+(\w+)\s*;\s*\$');n=0
|
||||
for p,it in tg.items():
|
||||
L=open(p).read().split('\n');ch=False;done=set()
|
||||
for ul,nm in it:
|
||||
if (ul,nm) in done: continue
|
||||
done.add((ul,nm))
|
||||
for i in range(ul-2,-1,-1):
|
||||
m=dp.match(L[i])
|
||||
if m and m.group(3)==nm and '?' not in m.group(2): L[i]=m.group(1)+m.group(2)+'? '+nm+';';ch=True;n+=1;break
|
||||
if ch: open(p,'w').write('\n'.join(L))
|
||||
print('fixed',n)
|
||||
"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. 工具脚本说明(`tools/`)
|
||||
|
||||
### `tools/nullfix.py` — 主力自动修复
|
||||
```bash
|
||||
python3 tools/nullfix.py # 修整个 lib,默认 5 轮
|
||||
python3 tools/nullfix.py --max-rounds 12
|
||||
python3 tools/nullfix.py lib/widgets/mobile/shop.dart # 只修单文件
|
||||
```
|
||||
- 每轮重新 `dart analyze lib`,按 error 的 (file,line,col) 精确定位修改。
|
||||
- **带腐败自检**:每轮后检测 `expected_token`/`missing_identifier`,一旦 >0 立即中止并提示 `git diff`。
|
||||
- 已实现的 handler:
|
||||
- `insert_bang`:成员访问/方法调用/迭代器/return 加 `!`(按 analyzer 分类)
|
||||
- `insert_arg_bang`:`argument_type`/`invalid_assignment` 在参数值末尾加 `!`(值必须是简单标识符链 `[\w.\[\]()!]`,含运算符/空格跳过)
|
||||
- `late` 实例字段、参数空安全、field-formal 字段空安全
|
||||
- `missing_default_value_for_parameter`、`@required`→`required` 已并入
|
||||
- **已禁用的危险 handler**:基于正则的 `if(x)`→`if(x==true)`(曾破坏 89 文件)。条件修复改用 §3.3a 的 analyzer 驱动版。
|
||||
- **已知边界**:多行表达式(接收者跨行)、含空格/逗号的函数调用参数、三元/比较表达式 → 跳过,需手动。
|
||||
|
||||
### `tools/badge_migrate.py` — 未验证,**已不需要**
|
||||
badges 3.x 迁移已手动完成(`badgeStyle`/`badgeAnimation`),此脚本可忽略/删除。
|
||||
|
||||
---
|
||||
|
||||
## 5. 延后项
|
||||
|
||||
### `lib/utils/util_io.dart`(6 error,仅原生)
|
||||
- 通过 `dart.library.html` 条件导入从 **Web 构建中排除**,不影响 `flutter build web`。
|
||||
- 错误来自 `flutter_local_notifications` v17 API 变更:
|
||||
- `IOSInitializationSettings` / `IOSNotificationDetails` → v17 改名(`DarwinInitializationSettings` / `DarwinNotificationDetails`)
|
||||
- `onSelectNotification` 参数已移除
|
||||
- `extra_positional_arguments`(构造参数变化)
|
||||
- `body_might_complete_normally`(`Future<void>` 缺 return)
|
||||
- 原生(Android/iOS)构建时才需要修。Web 不阻塞。
|
||||
|
||||
---
|
||||
|
||||
## 6. 关键上下文 / 决策(避免踩坑)
|
||||
|
||||
- **`late` 用于实例字段**:避免模型 `fromJson` 初始化列表 + State 类的级联错误。模型字段置为可空,调用点加 `!`。
|
||||
- **脚本必须 analyzer 驱动**:盲目正则会损坏代码(如 `return? item;`、`this.?field`)。`nullfix.py` 用 analyzer 的列/列定位 + 腐败自检是关键。
|
||||
- **badges 实际解析 3.2.0**(不是 2.0.3):参数是 `badgeStyle:`/`badgeAnimation:`(不是 `badgeColor`/`animationType`/`animation`)。
|
||||
- **pinput 实际 5.0.2**:类名 `Pinput`(非 `PinPut`),导入 `package:pinput/pinput.dart`,`length`/`onCompleted`/`defaultPinDecoration`。
|
||||
- **youtube_player_iframe 5.2.2**:`YoutubePlayerController.fromVideoId(videoId:, startSeconds:, params:)`。
|
||||
- **BreadCrumb.route 已改可空**:`String? route`,调用点 `BreadCrumb(X, null)` 合法。
|
||||
- **e-Transfer**:Stripe 已全移除,付款走 `payment@wisetronic.com`,备注写 `R#<receipt.id>`。
|
||||
- **搜索框**:自写轻量 `lib/widgets/general/search_bar.dart`(非第三方包)。
|
||||
- **不升级全局 Flutter SDK**:用本地 Flutter 3.29.3 / Dart 3.7.2。
|
||||
|
||||
## 7. 提交历史(基线 f8a90ad 之后)
|
||||
|
||||
```
|
||||
最新 phase3: mobile/shop clean ... 131->118 ← resume 起点
|
||||
phase3: checkout files clean ... 142->131
|
||||
phase3: fix attribute widgets ... ~30 fixed
|
||||
phase3: FIX arg-bang regex (missing \]) ... 235->183 ← 关键 bug 修复
|
||||
...(共约 28 个 phase3 提交)
|
||||
f8a90ad 基线
|
||||
```
|
||||
|
||||
## 8. 最终验收
|
||||
|
||||
```bash
|
||||
flutter build web # 目标:无 error,生成 build/web
|
||||
flutter run -d chrome # 目标:能打开、首页/商品/购物车/结账流程跑通
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 9. 运行时问题(应用已能运行,以下为后续优化,非阻塞)
|
||||
|
||||
应用 `flutter run -d chrome` 已成功启动并加载首页/API 数据/数据库。控制台有以下运行时警告/异常:
|
||||
|
||||
### 9.1 Scrollbar 缺 ScrollPosition(真实,影响滚动条显示)
|
||||
4 个 `Scrollbar(` 未配 `controller`,新版 Flutter 的 Scrollbar 找不到 ScrollPosition:
|
||||
- `lib/pages/home.dart:101` — ✅ 已修:给 `SingleChildScrollView` 加 `primary: true`
|
||||
- `lib/pages/blog.dart:24` — 子是 `DesktopBlog`(自定义组件)
|
||||
- `lib/pages/download.dart:63` — 子是 `DesktopDownloadApps`(自定义组件)
|
||||
- `lib/widgets/desktop/shop.dart:137` — 包裹 `NotificationListener`
|
||||
|
||||
后 3 处的子是自定义组件,需让内部 ListView/ScrollView 暴露 controller(设 `primary: true`)或 Scrollbar 改用 `NotificationListener` 关联。**仅影响滚动条渲染,不影响内容加载/显示。**
|
||||
|
||||
### 9.2 CustomersLogo setState-after-dispose(小 bug)
|
||||
`lib/widgets/desktop/desktop_customers_logo.dart` 的 `Timer.periodic`(每 10s 刷新 logo)未在 `dispose()` 里 `cancel()`,组件卸载后 timer 仍触发 `setState`。建议在 `dispose` 里 `timer?.cancel()`。**热重载时易触发,干净启动偶发。**
|
||||
|
||||
### 9.3 `_business` LateInitializationError(热重载假象)
|
||||
`_business` 是店铺页面组件(`shop_promote.dart`/`shop.dart` 等)的 `late Business` 字段。热重载重建 widget 树时字段状态丢失触发,**干净启动(浏览器刷新 Cmd+R)不会出现**。
|
||||
|
||||
> **验证方式**:在浏览器里 Cmd+R 刷新页面(而非热重载),9.2/9.3 类异常应消失,仅剩 9.1 的滚动条警告。
|
||||
@@ -0,0 +1,55 @@
|
||||
# flutter_wisetronic 升级日志
|
||||
|
||||
## 目标
|
||||
- 升级到 Dart 3 强制空安全(目标 SDK:本机 Flutter 3.29.3 / Dart 3.7.2,不升级全局)
|
||||
- 移除 Stripe 收款,改为页面展示 e-transfer email 让客户自行 e-transfer 付款
|
||||
- 第一阶段:能编译、Web 能跑起来(暂不美化)
|
||||
|
||||
## 关键决策
|
||||
- 目标版本:Flutter 3.29.3 / Dart 3.7.2(钉定本机,不动全局)
|
||||
- e-transfer 邮箱:`payment@wisetronic.com`
|
||||
- 提醒客户在 e-transfer remark 里写 `R#<receipt.id>` 以便自动化处理订单
|
||||
- 搜索框:自写轻量 Web 搜索组件替换 flappy_search_bar
|
||||
- Dart 3 已移除 `dart migrate`,空安全迁移用手工 + IDE 修复
|
||||
|
||||
## 阶段
|
||||
- [x] 阶段 0:基线 & 锁版本
|
||||
- [x] 阶段 1:去掉 Stripe
|
||||
- [x] 阶段 2:依赖替换与升级
|
||||
- [ ] 阶段 3:空安全迁移
|
||||
- [ ] 阶段 4:Web 跑起来
|
||||
|
||||
---
|
||||
|
||||
## 改动记录
|
||||
|
||||
### 阶段 0
|
||||
- 创建 UPGRADE_NOTES.md
|
||||
- pubspec.yaml: environment sdk `>=2.7.0 <3.0.0` → `>=3.0.0 <4.0.0`,flutter `>=3.29.0`
|
||||
|
||||
### 阶段 1 — 去掉 Stripe(已完成)
|
||||
- 删除: stripe_pay_web.dart, stripe_pay.dart, desktop/mobile_stripe_pay_web.dart, stripe_payment_method.dart
|
||||
- pubspec: 移除 stripe_payment + stripe_sdk(git)
|
||||
- user.dart: 移除 stripePaymentMethods 字段与解析
|
||||
- utils.dart: 移除 createOrUpdateStripePaymentMethod / stripePaymentIntent / stripeChargedSuccess
|
||||
- util_web.dart / util_io.dart: goPayment 的 stripe/native 分支 → 跳转 ETransferPay
|
||||
- desktop/mobile_pay_now.dart: 移除“已有卡片”区块与 nativePay 死逻辑,简化列表索引
|
||||
- desktop/mobile_my_cards.dart: 重写为 e-Transfer 说明页(保留路由入口)
|
||||
- constants.dart: 新增 ETRANSFER_EMAIL(payment@wisetronic.com) 与 REMARK_PREFIX(R#)
|
||||
- 新增 lib/widgets/general/e_transfer_pay.dart: 展示邮箱 + 提醒备注写 R#<orderId>
|
||||
- 保留: PAYMENT_METHOD_CODE_STRIPE='stripe'(API 仍返回该 code,路由到 e-Transfer);payment_platform.dart 的 'stripe' 显示名(后续美化时调整)
|
||||
|
||||
### 阶段 2 — 依赖替换与升级(已完成)
|
||||
**flutter pub get 成功解析 178 个依赖。**
|
||||
- 升级到 null-safe 最新版:dio ^5.7、cached_network_image ^3.4、url_launcher ^6.3、path_provider ^2.1、image_picker ^1.1、google_maps_flutter ^2.9、geolocator ^12、youtube_player_iframe ^5.2、flutter_local_notifications ^17、uuid ^4、fluttertoast ^8.2、badges ^3、carousel_slider ^5、percent_indicator ^4.2.3、photo_view ^0.15、toggle_switch ^2.3、pinput ^5、email_validator ^3、responsive_builder ^0.7、flutter_redux ^0.10、fluro ^2.0.5、font_awesome_flutter ^10、flutter_spinkit ^5.2、flutter_markdown ^0.7、url_strategy ^0.3、universal_io/html
|
||||
- 删除(0引用或无 null-safe 版):splashscreen(死代码)、flappy_search_bar、searchable_dropdown、share、platform_detect、flutter_inappwebview、countdown、gender_selection、flutter_dash(死 import)、smooth_star_rating、hovering、ffi
|
||||
- 新增:flutter_rating_bar ^4.0
|
||||
- 停维但有 null-safe 版→暂留(Phase 5 再换):pull_to_refresh(→smart_refresher)、hive/hive_flutter(→hive_ce)、catcher ^0.8(→catcher2)
|
||||
- 新建 null-safe 自定义组件替代废弃包(API 兼容, 调用方仅改 import):
|
||||
- lib/utils/countdown.dart (CountDown.stream)
|
||||
- lib/widgets/general/hover_widget.dart (HoverWidget)
|
||||
- lib/widgets/general/gender_selection.dart (Gender 枚举 + GenderSelection)
|
||||
- lib/widgets/general/smooth_star_rating.dart (SmoothStarRating)
|
||||
- lib/widgets/general/search_bar.dart (轻量 Web 搜索 SearchBar + SearchBarController, 含 replayLastSearch 分页)
|
||||
- main.dart:删除未使用的 _buildBody(SplashScreen) 与 _to 字段
|
||||
- ⚠️ 待 Phase 3:API 升级破坏性变更(dio5/badges3/toggle_switch2/pinput5/geolocator12 等用法适配) + 整库空安全迁移,按 dart analyze 驱动修复
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
# Flutter Wisetronic — Web 构建脚本
|
||||
# 用法:
|
||||
# ./build_web.sh # 构建 release 版本到 build/web/
|
||||
# ./build_web.sh run # 构建并在 Chrome 中运行调试版
|
||||
#
|
||||
# 说明:
|
||||
# - 构建(release)必须 --no-tree-shake-icons: 项目中有 24 处 IconData(codePoint)
|
||||
# 使用来自 JSON/API 的动态 code point(非 const), icon tree-shaking 无法处理。
|
||||
# 注意: --no-tree-shake-icons 仅 build 支持; flutter run(debug)不做 tree-shaking,
|
||||
# 因此 run 分支不带该 flag。
|
||||
# - Dart SDK: 本地 Flutter 3.29.3 / Dart 3.7.2(未升级全局 SDK)。
|
||||
set -e
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
if [ "$1" = "run" ]; then
|
||||
echo ">>> flutter run -d chrome"
|
||||
flutter run -d chrome
|
||||
else
|
||||
echo ">>> flutter build web --no-tree-shake-icons"
|
||||
flutter build web --no-tree-shake-icons
|
||||
echo ""
|
||||
echo "✓ 构建完成: build/web/ (main.dart.js: $(du -h build/web/main.dart.js | cut -f1))"
|
||||
echo " 本地预览: python3 -m http.server --directory build/web 8080"
|
||||
echo " 然后访问 http://localhost:8080/"
|
||||
fi
|
||||
+6
-4
@@ -49,13 +49,15 @@ class Constants {
|
||||
static const String PAYMENT_METHOD_CODE_OTT_ALIPAY = 'ALIPAY';
|
||||
static const String PAYMENT_METHOD_CODE_OTT_WECHATPAY = 'WECHATPAY';
|
||||
static const String PAYMENT_METHOD_CODE_PAYPAL = 'paypal';
|
||||
static const String PAYMENT_METHOD_CODE_STRIPE = 'stripe';
|
||||
static const String PAYMENT_METHOD_CODE_STRIPE = 'stripe'; // API still returns 'stripe' code; now routed to e-Transfer
|
||||
static const String PAYMENT_METHOD_CODE_POD = 'payondeliverypickup';
|
||||
static const String PAYMENT_METHOD_NATIVE_PAY = 'native_pay';
|
||||
|
||||
static const String STRIPE_STATUS_REQUIRES_CONFIRMATION = 'requires_confirmation';
|
||||
static const String STRIPE_CLIENT_SECRET = 'client_secret';
|
||||
static const String STRIPE_STATUS_SUCCEDED = 'succeeded';
|
||||
// e-Transfer (replaces Stripe)
|
||||
static const String ETRANSFER_EMAIL = 'payment@wisetronic.com';
|
||||
static const String ETRANSFER_QA = 'wisetronic'; // security question answer placeholder, if needed
|
||||
// Remark template for auto-processing: R#<receipt id> (= order id)
|
||||
static const String ETRANSFER_REMARK_PREFIX = 'R#';
|
||||
|
||||
static const int STATUS_PENDING = 0;
|
||||
static const int STATUS_ACCEPT = 1;
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:photo_view/photo_view.dart';
|
||||
|
||||
class ImageViewer extends StatefulWidget {
|
||||
final Key key;
|
||||
final Key? key;
|
||||
final ImageProvider imageProvider;
|
||||
|
||||
ImageViewer(this.imageProvider, {this.key}) :
|
||||
|
||||
@@ -87,7 +87,7 @@ class OnProductWillAddToCart {
|
||||
double price;
|
||||
String description;
|
||||
Business business;
|
||||
GlobalKey buttonKey;
|
||||
GlobalKey? buttonKey;
|
||||
OnProductWillAddToCart(this.product, this.selections, this.price, this.description, this.business, {this.buttonKey});
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ Map<String, LibraryLoader> _deferredLibraries = {
|
||||
'zh_CN': () => new Future.value(null),
|
||||
};
|
||||
|
||||
MessageLookupByLibrary _findExact(String localeName) {
|
||||
MessageLookupByLibrary? _findExact(String localeName) {
|
||||
switch (localeName) {
|
||||
case 'en':
|
||||
return messages_en.messages;
|
||||
@@ -59,7 +59,7 @@ bool _messagesExistFor(String locale) {
|
||||
}
|
||||
}
|
||||
|
||||
MessageLookupByLibrary _findGeneratedMessagesFor(String locale) {
|
||||
MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) {
|
||||
var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor,
|
||||
onFailure: (_) => null);
|
||||
if (actualLocale == null) return null;
|
||||
|
||||
@@ -15,7 +15,7 @@ import 'intl/messages_all.dart';
|
||||
class S {
|
||||
S();
|
||||
|
||||
static S current;
|
||||
static S current = S();
|
||||
|
||||
static const AppLocalizationDelegate delegate =
|
||||
AppLocalizationDelegate();
|
||||
@@ -32,7 +32,7 @@ class S {
|
||||
}
|
||||
|
||||
static S of(BuildContext context) {
|
||||
return Localizations.of<S>(context, S);
|
||||
return Localizations.of<S>(context, S) ?? S.current;
|
||||
}
|
||||
|
||||
/// `About`
|
||||
|
||||
+16
-26
@@ -14,7 +14,6 @@ import 'pages/create_online_store_1.dart';
|
||||
import 'pages/download.dart';
|
||||
import 'pages/me.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
import 'package:splashscreen/splashscreen.dart';
|
||||
// import 'package:uni_links/uni_links.dart';
|
||||
|
||||
import 'constants.dart';
|
||||
@@ -34,15 +33,20 @@ import 'utils/utils.dart';
|
||||
|
||||
void main() {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
FlutterError.onError = (details) {
|
||||
FlutterError.presentError(details);
|
||||
print('CK_ERROR: ${details.exceptionAsString()}');
|
||||
print('CK_CTX: ${details.context}');
|
||||
print('CK_STACK: ${details.stack}');
|
||||
};
|
||||
// Enable configureApp will cause route problem.
|
||||
// configureApp();
|
||||
setPathUrlStrategy();
|
||||
runApp(MyApp());
|
||||
Future.delayed(Duration(seconds: 3), () => Util.devAutologin()); // DEV e2e: 延迟 3s 等 Flutter/Hive ready
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
String _to = '/';
|
||||
|
||||
MyApp() {
|
||||
Routes.configure();
|
||||
Utils().init();
|
||||
@@ -95,24 +99,6 @@ class MyApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
Widget _buildBody() {
|
||||
return SplashScreen(
|
||||
seconds: 5,
|
||||
routeName: _to,
|
||||
navigateAfterSeconds: Home(title: Constants.APP_TITLE,),
|
||||
styleTextUnderTheLoader: new TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20.0,
|
||||
),
|
||||
imageBackground: (Image.network(Constants.BASE_API_URL + 'gallery/get-minimanager-splash/')).image,
|
||||
backgroundColor: Colors.white,
|
||||
onClick: () {
|
||||
|
||||
},
|
||||
loaderColor: Colors.blue,
|
||||
);
|
||||
}
|
||||
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: Constants.DEBUG,
|
||||
navigatorKey: kIsWeb ? null : Catcher.navigatorKey,
|
||||
@@ -124,7 +110,11 @@ class MyApp extends StatelessWidget {
|
||||
S.delegate,
|
||||
],
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
localeResolutionCallback: (Locale locale, Iterable<Locale> supportedLocales) {
|
||||
localeResolutionCallback: (Locale? locale, Iterable<Locale> supportedLocales) {
|
||||
if (locale == null) {
|
||||
store.dispatch(UpdateLocale(supportedLocales.first));
|
||||
return supportedLocales.first;
|
||||
}
|
||||
print('Language code: ${locale.languageCode}, Country code: ${locale.countryCode}');
|
||||
for (final supportedLocale in supportedLocales) {
|
||||
if (supportedLocale.languageCode == locale.languageCode) {
|
||||
@@ -136,9 +126,9 @@ class MyApp extends StatelessWidget {
|
||||
return supportedLocales.first;
|
||||
},
|
||||
onGenerateRoute: (RouteSettings settings) {
|
||||
final List<String> pathElements = settings.name.split('/');
|
||||
final List<String> pathElements = settings.name?.split('/') ?? [];
|
||||
print('path elements: $pathElements');
|
||||
if (pathElements[0] != '') {
|
||||
if (pathElements.isEmpty || pathElements[0] != '') {
|
||||
return null;
|
||||
}
|
||||
if (pathElements[1] == 'me') {
|
||||
@@ -182,12 +172,12 @@ class MyApp extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
if (pathElements[1] == 'renew-minioffice') {
|
||||
if (pathElements[1] == 'renew-minioffice' && pathElements.length >= 3) {
|
||||
return MaterialPageRoute(builder: (BuildContext context) =>
|
||||
RenewMiniOffice(int.parse(pathElements[2]))
|
||||
);
|
||||
}
|
||||
if (pathElements[1] == 'buy-service') {
|
||||
if (pathElements[1] == 'buy-service' && pathElements.length >= 4) {
|
||||
return MaterialPageRoute(builder: (BuildContext context) =>
|
||||
BuyService(int.parse(pathElements[2]), pathElements[3])
|
||||
);
|
||||
|
||||
+12
-12
@@ -4,9 +4,9 @@ import 'dart:convert';
|
||||
import 'package:flutter_wisetronic/models/product_attribute.dart';
|
||||
|
||||
class Subproduct {
|
||||
int id;
|
||||
SimpleProduct product;
|
||||
double quantity;
|
||||
int? id;
|
||||
SimpleProduct? product;
|
||||
double? quantity;
|
||||
|
||||
Subproduct.fromJson(Map<String, dynamic> json) :
|
||||
id = json['id'],
|
||||
@@ -26,15 +26,15 @@ class Subproduct {
|
||||
}
|
||||
|
||||
class SimpleProduct {
|
||||
int id;
|
||||
String name;
|
||||
String sku;
|
||||
double price;
|
||||
String description;
|
||||
String image;
|
||||
List<ProductAttribute> productAttributes;
|
||||
double customerLastPrice;
|
||||
String extraData;
|
||||
int? id;
|
||||
String? name;
|
||||
String? sku;
|
||||
double? price;
|
||||
String? description;
|
||||
String? image;
|
||||
List<ProductAttribute>? productAttributes;
|
||||
double? customerLastPrice;
|
||||
String? extraData;
|
||||
|
||||
SimpleProduct.fromJson(Map<String, dynamic> json) :
|
||||
id = json['id'],
|
||||
|
||||
+15
-15
@@ -1,21 +1,21 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class Address {
|
||||
int id;
|
||||
String addressLine1;
|
||||
String addressLine2;
|
||||
String city;
|
||||
String state;
|
||||
String country;
|
||||
String zip;
|
||||
String phone;
|
||||
String fax;
|
||||
String email;
|
||||
String contactName;
|
||||
int gender;
|
||||
String lat;
|
||||
String lng;
|
||||
String fullAddress;
|
||||
int? id;
|
||||
String? addressLine1;
|
||||
String? addressLine2;
|
||||
String? city;
|
||||
String? state;
|
||||
String? country;
|
||||
String? zip;
|
||||
String? phone;
|
||||
String? fax;
|
||||
String? email;
|
||||
String? contactName;
|
||||
int? gender;
|
||||
String? lat;
|
||||
String? lng;
|
||||
String? fullAddress;
|
||||
|
||||
Address.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
|
||||
+10
-10
@@ -2,8 +2,8 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class Section {
|
||||
int id;
|
||||
String name;
|
||||
int? id;
|
||||
String? name;
|
||||
|
||||
Section.fromJson(Map<String, dynamic> json) :
|
||||
id = json['id'],
|
||||
@@ -21,14 +21,14 @@ class Section {
|
||||
}
|
||||
|
||||
class Blog {
|
||||
int id;
|
||||
String title;
|
||||
String body;
|
||||
String createdAt;
|
||||
String thumbUrl;
|
||||
String imageUrl;
|
||||
String videoUrl;
|
||||
Section section;
|
||||
int? id;
|
||||
String? title;
|
||||
String? body;
|
||||
String? createdAt;
|
||||
String? thumbUrl;
|
||||
String? imageUrl;
|
||||
String? videoUrl;
|
||||
Section? section;
|
||||
|
||||
Blog.fromJson(Map<String, dynamic> json) :
|
||||
id = json['id'],
|
||||
|
||||
@@ -4,10 +4,10 @@ import 'dart:convert';
|
||||
import 'booking_time.dart';
|
||||
|
||||
class BookingDateTime {
|
||||
String viewDate;
|
||||
int unixTime;
|
||||
String sendTimeTip;
|
||||
List<BookingTime> bookTimes;
|
||||
String? viewDate;
|
||||
int? unixTime;
|
||||
String? sendTimeTip;
|
||||
List<BookingTime>? bookTimes;
|
||||
|
||||
BookingDateTime(this.viewDate, this.unixTime, this.sendTimeTip, this.bookTimes);
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class BookingTime {
|
||||
String viewTime;
|
||||
int unixTime;
|
||||
String sendTimeTip;
|
||||
String? viewTime;
|
||||
int? unixTime;
|
||||
String? sendTimeTip;
|
||||
|
||||
BookingTime(this.viewTime, this.unixTime, this.sendTimeTip);
|
||||
|
||||
|
||||
+43
-43
@@ -8,7 +8,7 @@ import 'product.dart';
|
||||
import 'waiting_line.dart';
|
||||
|
||||
class QuickInput {
|
||||
String value;
|
||||
String? value;
|
||||
QuickInput.fromJson(Map<String, dynamic> json)
|
||||
: value = json['value'];
|
||||
|
||||
@@ -23,48 +23,48 @@ class QuickInput {
|
||||
}
|
||||
|
||||
class Business {
|
||||
int id;
|
||||
String name;
|
||||
String phone;
|
||||
Address address;
|
||||
String fullAddress;
|
||||
String picUrl;
|
||||
int status;
|
||||
List<BusinessTime> openingTime;
|
||||
double shippingFee;
|
||||
double packageFee;
|
||||
double minPrice;
|
||||
int shippingTime;
|
||||
int monthSales;
|
||||
String bulletin;
|
||||
int category;
|
||||
bool isLike;
|
||||
String description;
|
||||
String policy;
|
||||
String bannerImageUrl;
|
||||
int todayOpen;
|
||||
int todayClose;
|
||||
bool showMonthlySold;
|
||||
List<ImageUrl> slideImages;
|
||||
List<Product> promoProducts;
|
||||
String paypalEmail;
|
||||
bool deliveryCanadaPost;
|
||||
bool deliveryStoreDelivery;
|
||||
bool deliveryPickup;
|
||||
String currency;
|
||||
List<WaitingLine> waitingLine;
|
||||
bool enableWaitingLine;
|
||||
double pointsToCreditsConversionRate;
|
||||
String chaseXLogin;
|
||||
String chaseTransactionKey;
|
||||
String chaseResponseKey;
|
||||
DistanceInfo distanceInfo;
|
||||
int commentsCount;
|
||||
bool forceClose;
|
||||
bool isPublic;
|
||||
double referrerCoupon;
|
||||
bool instanceDelivery;
|
||||
List<QuickInput> quickInputs;
|
||||
int? id;
|
||||
String? name;
|
||||
String? phone;
|
||||
Address? address;
|
||||
String? fullAddress;
|
||||
String? picUrl;
|
||||
int? status;
|
||||
List<BusinessTime>? openingTime;
|
||||
double? shippingFee;
|
||||
double? packageFee;
|
||||
double? minPrice;
|
||||
int? shippingTime;
|
||||
int? monthSales;
|
||||
String? bulletin;
|
||||
int? category;
|
||||
bool? isLike;
|
||||
String? description;
|
||||
String? policy;
|
||||
String? bannerImageUrl;
|
||||
int? todayOpen;
|
||||
int? todayClose;
|
||||
bool? showMonthlySold;
|
||||
List<ImageUrl>? slideImages;
|
||||
List<Product>? promoProducts;
|
||||
String? paypalEmail;
|
||||
bool? deliveryCanadaPost;
|
||||
bool? deliveryStoreDelivery;
|
||||
bool? deliveryPickup;
|
||||
String? currency;
|
||||
List<WaitingLine>? waitingLine;
|
||||
bool? enableWaitingLine;
|
||||
double? pointsToCreditsConversionRate;
|
||||
String? chaseXLogin;
|
||||
String? chaseTransactionKey;
|
||||
String? chaseResponseKey;
|
||||
DistanceInfo? distanceInfo;
|
||||
int? commentsCount;
|
||||
bool? forceClose;
|
||||
bool? isPublic;
|
||||
double? referrerCoupon;
|
||||
bool? instanceDelivery;
|
||||
List<QuickInput>? quickInputs;
|
||||
|
||||
Business.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class BusinessTime {
|
||||
String openTime;
|
||||
String closeTime;
|
||||
String? openTime;
|
||||
String? closeTime;
|
||||
|
||||
BusinessTime.fromJson(Map<String, dynamic> json)
|
||||
: openTime = json['open_time'],
|
||||
|
||||
+19
-19
@@ -7,18 +7,18 @@ import 'cart_line_item.dart';
|
||||
import 'extra_fee.dart';
|
||||
|
||||
class CartInfo {
|
||||
int id;
|
||||
double originPrice;
|
||||
double discountPrice;
|
||||
double totalPrice;
|
||||
Business businessInfo;
|
||||
List<CartLineItem> productList;
|
||||
List<ExtraFee> extraFeeList;
|
||||
List<ExtraFee> discountList;
|
||||
int deliveryMethod;
|
||||
String shippingMethod;
|
||||
double amountPaid;
|
||||
String extraData;
|
||||
int? id;
|
||||
double? originPrice;
|
||||
double? discountPrice;
|
||||
double? totalPrice;
|
||||
Business? businessInfo;
|
||||
List<CartLineItem>? productList;
|
||||
List<ExtraFee>? extraFeeList;
|
||||
List<ExtraFee>? discountList;
|
||||
int? deliveryMethod;
|
||||
String? shippingMethod;
|
||||
double? amountPaid;
|
||||
String? extraData;
|
||||
|
||||
CartInfo.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
@@ -53,7 +53,7 @@ class CartInfo {
|
||||
if (productList == null) {
|
||||
productList = [item];
|
||||
} else {
|
||||
productList.add(item);
|
||||
productList!.add(item);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -74,19 +74,19 @@ class CartInfo {
|
||||
originPrice = 0.0;
|
||||
discountPrice = 0.0;
|
||||
totalPrice = 0.0;
|
||||
for (var i = 0; i < productList.length; i++) {
|
||||
newTotal += productList[i].getTotalPrice();
|
||||
for (var i = 0; i < (productList?.length ?? 0); i++) {
|
||||
newTotal += productList![i].getTotalPrice();
|
||||
}
|
||||
originPrice = newTotal;
|
||||
totalPrice = newTotal;
|
||||
return totalPrice;
|
||||
return totalPrice ?? 0.0;
|
||||
}
|
||||
|
||||
int getProductListTotalQuantity() {
|
||||
int qty = 0;
|
||||
if (productList != null && productList.length > 0) {
|
||||
for (var i = 0; i < productList.length; i++) {
|
||||
qty += productList[i].quantity.round();
|
||||
if (productList != null && productList!.length > 0) {
|
||||
for (var i = 0; i < productList!.length; i++) {
|
||||
qty += (productList![i].quantity ?? 0).round();
|
||||
}
|
||||
}
|
||||
return qty;
|
||||
|
||||
@@ -6,15 +6,15 @@ import 'package:uuid/uuid.dart';
|
||||
import 'product.dart';
|
||||
|
||||
class CartLineItem {
|
||||
int id;
|
||||
double unitPrice;
|
||||
double totalPrice;
|
||||
Product product;
|
||||
String name;
|
||||
String description;
|
||||
double quantity;
|
||||
String uuid;
|
||||
String parentUuid;
|
||||
int? id;
|
||||
double? unitPrice;
|
||||
double? totalPrice;
|
||||
Product? product;
|
||||
String? name;
|
||||
String? description;
|
||||
double? quantity;
|
||||
String? uuid;
|
||||
String? parentUuid;
|
||||
|
||||
CartLineItem() {
|
||||
uuid = Uuid().v4();
|
||||
@@ -48,7 +48,7 @@ class CartLineItem {
|
||||
}
|
||||
|
||||
double getTotalPrice() {
|
||||
totalPrice = unitPrice * quantity;
|
||||
return totalPrice;
|
||||
totalPrice = (unitPrice ?? 0.0) * (quantity ?? 0);
|
||||
return totalPrice ?? 0.0;
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class Category {
|
||||
int id;
|
||||
String name;
|
||||
int? id;
|
||||
String? name;
|
||||
|
||||
Category.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
|
||||
@@ -4,12 +4,12 @@ import 'dart:convert';
|
||||
import 'product.dart';
|
||||
|
||||
class CategoryProducts {
|
||||
int id;
|
||||
int businessId;
|
||||
String name;
|
||||
String description;
|
||||
String iconUrl;
|
||||
List<Product> products;
|
||||
int? id;
|
||||
int? businessId;
|
||||
String? name;
|
||||
String? description;
|
||||
String? iconUrl;
|
||||
List<Product>? products;
|
||||
|
||||
CategoryProducts.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
|
||||
@@ -4,15 +4,15 @@ import 'dart:convert';
|
||||
import 'product_image.dart';
|
||||
|
||||
class Comment {
|
||||
int id;
|
||||
String contact;
|
||||
String content;
|
||||
int rating;
|
||||
List<ProductImage> images;
|
||||
String createdAt;
|
||||
int thumbUp;
|
||||
int thumbDown;
|
||||
String replyFromStore;
|
||||
int? id;
|
||||
String? contact;
|
||||
String? content;
|
||||
int? rating;
|
||||
List<ProductImage>? images;
|
||||
String? createdAt;
|
||||
int? thumbUp;
|
||||
int? thumbDown;
|
||||
String? replyFromStore;
|
||||
|
||||
Comment.fromJson(Map<String, dynamic> json) :
|
||||
id = json['id'],
|
||||
|
||||
@@ -4,14 +4,14 @@ import 'dart:convert';
|
||||
import 'business.dart';
|
||||
|
||||
class Coupon {
|
||||
int id;
|
||||
String code;
|
||||
String description;
|
||||
String expirationDate;
|
||||
double minAmount;
|
||||
Business store;
|
||||
double valueAmount;
|
||||
bool isPercentage;
|
||||
int? id;
|
||||
String? code;
|
||||
String? description;
|
||||
String? expirationDate;
|
||||
double? minAmount;
|
||||
Business? store;
|
||||
double? valueAmount;
|
||||
bool? isPercentage;
|
||||
|
||||
Coupon.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
|
||||
@@ -4,9 +4,9 @@ import 'dart:convert';
|
||||
import 'text_value.dart';
|
||||
|
||||
class DistanceInfo {
|
||||
TextValue duration;
|
||||
TextValue distance;
|
||||
String status;
|
||||
TextValue? duration;
|
||||
TextValue? distance;
|
||||
String? status;
|
||||
|
||||
DistanceInfo.fromJson(Map<String, dynamic> json)
|
||||
: duration = json['duration'] != null ? TextValue.fromJson(json['duration']) : null,
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class ErrorMessage {
|
||||
String code;
|
||||
String string;
|
||||
String? code;
|
||||
String? string;
|
||||
|
||||
ErrorMessage.fromJson(Map<String, dynamic> json)
|
||||
: code = json['code'],
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class ExtraFee {
|
||||
int id;
|
||||
String name;
|
||||
String description;
|
||||
double rate;
|
||||
double price;
|
||||
int? id;
|
||||
String? name;
|
||||
String? description;
|
||||
double? rate;
|
||||
double? price;
|
||||
|
||||
ExtraFee.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class Fulfillment {
|
||||
int id;
|
||||
String shippingMethod;
|
||||
String trackingNumber;
|
||||
String note;
|
||||
String createdAt;
|
||||
int? id;
|
||||
String? shippingMethod;
|
||||
String? trackingNumber;
|
||||
String? note;
|
||||
String? createdAt;
|
||||
|
||||
Fulfillment.fromJson(Map<String, dynamic> json) :
|
||||
id = json['id'],
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class Gallery {
|
||||
int id;
|
||||
String image;
|
||||
String linkUrl;
|
||||
int? id;
|
||||
String? image;
|
||||
String? linkUrl;
|
||||
|
||||
Gallery.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class Group {
|
||||
int id;
|
||||
String name;
|
||||
int? id;
|
||||
String? name;
|
||||
|
||||
Group.fromJson(Map<String, dynamic> json) :
|
||||
id = json['id'],
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class ImageUrl {
|
||||
int id;
|
||||
String imageUrl;
|
||||
int? id;
|
||||
String? imageUrl;
|
||||
|
||||
ImageUrl.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
class KeyValue {
|
||||
String name;
|
||||
dynamic value;
|
||||
String? name;
|
||||
dynamic? value;
|
||||
|
||||
KeyValue(this.name, this.value);
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class LocatedAddress {
|
||||
int storeId;
|
||||
double latitude;
|
||||
double longitude;
|
||||
String streetNumber;
|
||||
String streetName;
|
||||
String city;
|
||||
String locality;
|
||||
String province;
|
||||
String country;
|
||||
String postalCode;
|
||||
String formattedAddress;
|
||||
int? storeId;
|
||||
double? latitude;
|
||||
double? longitude;
|
||||
String? streetNumber;
|
||||
String? streetName;
|
||||
String? city;
|
||||
String? locality;
|
||||
String? province;
|
||||
String? country;
|
||||
String? postalCode;
|
||||
String? formattedAddress;
|
||||
|
||||
LocatedAddress.fromJson(Map<String, dynamic> json)
|
||||
: storeId = json['store_id'],
|
||||
|
||||
+27
-27
@@ -11,33 +11,33 @@ import 'fulfillment.dart';
|
||||
import 'user_position.dart';
|
||||
|
||||
class Order {
|
||||
int id;
|
||||
int userId;
|
||||
int businessId;
|
||||
Business businessInfo;
|
||||
CartInfo cartInfo;
|
||||
int status;
|
||||
double originPrice;
|
||||
double discountPrice;
|
||||
double totalPrice;
|
||||
String consignee;
|
||||
String phone;
|
||||
String address;
|
||||
Address shippingAddress;
|
||||
int payMethod;
|
||||
String remark;
|
||||
String orderNum;
|
||||
int bookedAt;
|
||||
int createdAt;
|
||||
String shippingMethod;
|
||||
int? id;
|
||||
int? userId;
|
||||
int? businessId;
|
||||
Business? businessInfo;
|
||||
CartInfo? cartInfo;
|
||||
int? status;
|
||||
double? originPrice;
|
||||
double? discountPrice;
|
||||
double? totalPrice;
|
||||
String? consignee;
|
||||
String? phone;
|
||||
String? address;
|
||||
Address? shippingAddress;
|
||||
int? payMethod;
|
||||
String? remark;
|
||||
String? orderNum;
|
||||
int? bookedAt;
|
||||
int? createdAt;
|
||||
String? shippingMethod;
|
||||
String paymentStatus; // UNPAID, PAID, PARTIALPAID
|
||||
double amountPaid;
|
||||
List<Fulfillment> fulfillments;
|
||||
String extraData;
|
||||
bool hasComment;
|
||||
double fee;
|
||||
UserPosition shipperPosition;
|
||||
DistanceInfo deliveryDistance;
|
||||
double? amountPaid;
|
||||
List<Fulfillment>? fulfillments;
|
||||
String? extraData;
|
||||
bool? hasComment;
|
||||
double? fee;
|
||||
UserPosition? shipperPosition;
|
||||
DistanceInfo? deliveryDistance;
|
||||
|
||||
Order.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
@@ -100,7 +100,7 @@ class Order {
|
||||
|
||||
double getSubtotal() {
|
||||
double subtotal = 0.0;
|
||||
for (CartLineItem lineItem in cartInfo.productList) {
|
||||
for (CartLineItem lineItem in cartInfo?.productList ?? <CartLineItem>[]) {
|
||||
subtotal += lineItem.getTotalPrice();
|
||||
}
|
||||
return subtotal;
|
||||
|
||||
@@ -6,19 +6,19 @@ import 'package:flutter/cupertino.dart';
|
||||
import '../generated/l10n.dart';
|
||||
|
||||
class PaymentPlatform {
|
||||
int id;
|
||||
String name;
|
||||
String code;
|
||||
String method;
|
||||
String icon;
|
||||
String xLogin;
|
||||
String transactionKey;
|
||||
String responseKey;
|
||||
String squareAppId;
|
||||
String squareAccessToken;
|
||||
String squareLocationId;
|
||||
String publishableKey;
|
||||
String merchantId;
|
||||
int? id;
|
||||
String? name;
|
||||
String? code;
|
||||
String? method;
|
||||
String? icon;
|
||||
String? xLogin;
|
||||
String? transactionKey;
|
||||
String? responseKey;
|
||||
String? squareAppId;
|
||||
String? squareAccessToken;
|
||||
String? squareLocationId;
|
||||
String? publishableKey;
|
||||
String? merchantId;
|
||||
|
||||
PaymentPlatform(this.code);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
class Position {
|
||||
final double latitude;
|
||||
final double longitude;
|
||||
final double? latitude;
|
||||
final double? longitude;
|
||||
|
||||
Position({this.latitude, this.longitude});
|
||||
|
||||
|
||||
+17
-17
@@ -5,23 +5,23 @@ import 'Subproduct.dart';
|
||||
import 'product_attribute.dart';
|
||||
|
||||
class Product {
|
||||
int id;
|
||||
int businessId;
|
||||
int categoryId;
|
||||
String name;
|
||||
double price;
|
||||
double regularPrice;
|
||||
String description;
|
||||
String detailDescription;
|
||||
String imagePath;
|
||||
String secondImagePath;
|
||||
double monthSales;
|
||||
int rate;
|
||||
double leftNum;
|
||||
List<ProductAttribute> productAttributes;
|
||||
bool nonInventory;
|
||||
String extraData;
|
||||
List<Subproduct> subproducts;
|
||||
int? id;
|
||||
int? businessId;
|
||||
int? categoryId;
|
||||
String? name;
|
||||
double? price;
|
||||
double? regularPrice;
|
||||
String? description;
|
||||
String? detailDescription;
|
||||
String? imagePath;
|
||||
String? secondImagePath;
|
||||
double? monthSales;
|
||||
int? rate;
|
||||
double? leftNum;
|
||||
List<ProductAttribute>? productAttributes;
|
||||
bool? nonInventory;
|
||||
String? extraData;
|
||||
List<Subproduct>? subproducts;
|
||||
|
||||
Product(int id, int businessId, String name, double price, String description,
|
||||
String imagePath, List<ProductAttribute> productAttributes) {
|
||||
|
||||
@@ -4,14 +4,14 @@ import 'dart:convert';
|
||||
import 'product_option.dart';
|
||||
|
||||
class ProductAttribute {
|
||||
int id;
|
||||
String name;
|
||||
List<ProductOption> productOptions;
|
||||
bool singleSelection;
|
||||
bool byQuantity;
|
||||
bool required;
|
||||
String extra;
|
||||
bool disabled;
|
||||
int? id;
|
||||
String? name;
|
||||
List<ProductOption>? productOptions;
|
||||
bool? singleSelection;
|
||||
bool? byQuantity;
|
||||
bool? required;
|
||||
String? extra;
|
||||
bool? disabled;
|
||||
|
||||
ProductAttribute.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
|
||||
@@ -8,30 +8,30 @@ import 'product_attribute.dart';
|
||||
import 'product_image.dart';
|
||||
|
||||
class ProductDetail {
|
||||
int id;
|
||||
String image;
|
||||
List<ProductImage> images;
|
||||
String sku;
|
||||
String name;
|
||||
double price;
|
||||
double regularPrice;
|
||||
String description;
|
||||
String description2;
|
||||
String detailDescription;
|
||||
double monthSales;
|
||||
int rate;
|
||||
double leftNum;
|
||||
List<ProductAttribute> productAttributes;
|
||||
bool nonInventory;
|
||||
String extraData;
|
||||
String purchaseNote;
|
||||
double weight;
|
||||
double dimentionsLength;
|
||||
double dimentionsWidth;
|
||||
double dimentionsHeight;
|
||||
bool reviewsAllowed;
|
||||
List<Category> categories;
|
||||
List<Subproduct> subproducts;
|
||||
int? id;
|
||||
String? image;
|
||||
List<ProductImage>? images;
|
||||
String? sku;
|
||||
String? name;
|
||||
double? price;
|
||||
double? regularPrice;
|
||||
String? description;
|
||||
String? description2;
|
||||
String? detailDescription;
|
||||
double? monthSales;
|
||||
int? rate;
|
||||
double? leftNum;
|
||||
List<ProductAttribute>? productAttributes;
|
||||
bool? nonInventory;
|
||||
String? extraData;
|
||||
String? purchaseNote;
|
||||
double? weight;
|
||||
double? dimentionsLength;
|
||||
double? dimentionsWidth;
|
||||
double? dimentionsHeight;
|
||||
bool? reviewsAllowed;
|
||||
List<Category>? categories;
|
||||
List<Subproduct>? subproducts;
|
||||
|
||||
ProductDetail.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class ProductImage {
|
||||
int id;
|
||||
String image;
|
||||
int? id;
|
||||
String? image;
|
||||
|
||||
ProductImage.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class ProductOption {
|
||||
int id;
|
||||
String name;
|
||||
double adjustAmount;
|
||||
String extra;
|
||||
bool disabled;
|
||||
int? id;
|
||||
String? name;
|
||||
double? adjustAmount;
|
||||
String? extra;
|
||||
bool? disabled;
|
||||
|
||||
ProductOption.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
|
||||
@@ -4,9 +4,9 @@ import 'dart:convert';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class ShippingRate {
|
||||
String name;
|
||||
double price;
|
||||
List<Rate> rates;
|
||||
String? name;
|
||||
double? price;
|
||||
List<Rate>? rates;
|
||||
|
||||
ShippingRate.fromJson(Map<String, dynamic> json)
|
||||
: name = json['name'],
|
||||
@@ -25,7 +25,7 @@ class ShippingRate {
|
||||
other is ShippingRate &&
|
||||
runtimeType == other.runtimeType &&
|
||||
name == other.name &&
|
||||
price.toStringAsFixed(2) == other.price.toStringAsFixed(2) &&
|
||||
price?.toStringAsFixed(2) == other.price?.toStringAsFixed(2) &&
|
||||
listEquals(rates, other.rates);
|
||||
|
||||
@override
|
||||
@@ -41,8 +41,8 @@ class ShippingRate {
|
||||
}
|
||||
|
||||
class Rate {
|
||||
String name;
|
||||
double rate;
|
||||
String? name;
|
||||
double? rate;
|
||||
|
||||
Rate.fromJson(Map<String, dynamic> json)
|
||||
: name = json['name'],
|
||||
@@ -59,7 +59,7 @@ class Rate {
|
||||
other is Rate &&
|
||||
runtimeType == other.runtimeType &&
|
||||
name == other.name &&
|
||||
rate.toStringAsFixed(2) == other.rate.toStringAsFixed(2);
|
||||
rate?.toStringAsFixed(2) == other.rate?.toStringAsFixed(2);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
||||
@@ -4,9 +4,9 @@ import 'dart:convert';
|
||||
import 'address.dart';
|
||||
|
||||
class Store {
|
||||
int id;
|
||||
String name;
|
||||
Address address;
|
||||
int? id;
|
||||
String? name;
|
||||
Address? address;
|
||||
|
||||
Store.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class SimpleProduct {
|
||||
int id;
|
||||
String name;
|
||||
double price;
|
||||
double regularPrice;
|
||||
String description;
|
||||
String imagePath;
|
||||
int? id;
|
||||
String? name;
|
||||
double? price;
|
||||
double? regularPrice;
|
||||
String? description;
|
||||
String? imagePath;
|
||||
|
||||
SimpleProduct.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
class StripePaymentMethod {
|
||||
int id;
|
||||
String customerId;
|
||||
String paymentMethodId;
|
||||
String paymentMethodType;
|
||||
String cardBrand;
|
||||
String cardCountry;
|
||||
int cardExpMonth;
|
||||
int cardExpYear;
|
||||
String cardFunding;
|
||||
String cardLast4;
|
||||
|
||||
StripePaymentMethod.fromJson(Map<String, dynamic> json) :
|
||||
id = json['id'],
|
||||
customerId = json['customer_id'],
|
||||
paymentMethodId = json['payment_method_id'],
|
||||
paymentMethodType = json['payment_method_type'],
|
||||
cardBrand = json['card_brand'],
|
||||
cardCountry = json['card_country'],
|
||||
cardExpMonth = json['card_exp_month'],
|
||||
cardExpYear = json['card_exp_year'],
|
||||
cardFunding = json['card_funding'],
|
||||
cardLast4 = json['card_last4'];
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'customer_id': customerId,
|
||||
'payment_method_id': paymentMethodId,
|
||||
'payment_method_type': paymentMethodType,
|
||||
'card_brand': cardBrand,
|
||||
'card_country': cardCountry,
|
||||
'card_exp_month': cardExpMonth,
|
||||
'card_exp_year': cardExpYear,
|
||||
'card_funding': cardFunding,
|
||||
'card_last4': cardLast4,
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return json.encode(this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class TextValue {
|
||||
String text;
|
||||
int value;
|
||||
String? text;
|
||||
int? value;
|
||||
|
||||
TextValue.fromJson(Map<String, dynamic> json)
|
||||
: text = json['text'],
|
||||
|
||||
+18
-18
@@ -4,10 +4,10 @@ import 'dart:convert';
|
||||
import 'simple_business.dart';
|
||||
|
||||
class TicketFile {
|
||||
int id;
|
||||
String url;
|
||||
String fileName;
|
||||
String fileType;
|
||||
int? id;
|
||||
String? url;
|
||||
String? fileName;
|
||||
String? fileType;
|
||||
|
||||
TicketFile.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
@@ -29,9 +29,9 @@ class TicketFile {
|
||||
}
|
||||
|
||||
class Issue {
|
||||
int id;
|
||||
String msg;
|
||||
List<TicketFile> files;
|
||||
int? id;
|
||||
String? msg;
|
||||
List<TicketFile>? files;
|
||||
|
||||
Issue.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
@@ -51,11 +51,11 @@ class Issue {
|
||||
}
|
||||
|
||||
class FollowUp {
|
||||
int id;
|
||||
String msg;
|
||||
String poster;
|
||||
String createdAt;
|
||||
List<TicketFile> files;
|
||||
int? id;
|
||||
String? msg;
|
||||
String? poster;
|
||||
String? createdAt;
|
||||
List<TicketFile>? files;
|
||||
|
||||
FollowUp.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
@@ -79,12 +79,12 @@ class FollowUp {
|
||||
}
|
||||
|
||||
class Ticket {
|
||||
int id;
|
||||
Issue issue;
|
||||
Store store;
|
||||
List<FollowUp> followUps;
|
||||
bool isClosed;
|
||||
String createdAt;
|
||||
int? id;
|
||||
Issue? issue;
|
||||
Store? store;
|
||||
List<FollowUp>? followUps;
|
||||
bool? isClosed;
|
||||
String? createdAt;
|
||||
|
||||
Ticket.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
|
||||
+17
-22
@@ -1,26 +1,23 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'stripe_payment_method.dart';
|
||||
|
||||
class User {
|
||||
int id;
|
||||
String username;
|
||||
String nickname;
|
||||
String mobile;
|
||||
String email;
|
||||
String avatarUrl;
|
||||
int lastAddressId;
|
||||
String passCode;
|
||||
double credit;
|
||||
double wallet;
|
||||
int coupon;
|
||||
int points;
|
||||
int orderNum;
|
||||
double pointsToCreditsConversionRate;
|
||||
String contactNumber;
|
||||
String flutterMiniStoreToken;
|
||||
List<StripePaymentMethod> stripePaymentMethods;
|
||||
int? id;
|
||||
String? username;
|
||||
String? nickname;
|
||||
String? mobile;
|
||||
String? email;
|
||||
String? avatarUrl;
|
||||
int? lastAddressId;
|
||||
String? passCode;
|
||||
double? credit;
|
||||
double? wallet;
|
||||
int? coupon;
|
||||
int? points;
|
||||
int? orderNum;
|
||||
double? pointsToCreditsConversionRate;
|
||||
String? contactNumber;
|
||||
String? flutterMiniStoreToken;
|
||||
|
||||
User.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
@@ -38,8 +35,7 @@ class User {
|
||||
orderNum = json['order_num'],
|
||||
pointsToCreditsConversionRate = double.parse(json['points_to_credits_conversion_rate'].toString()),
|
||||
contactNumber = json['contact_number'],
|
||||
flutterMiniStoreToken = json['flutter_ministore_token'],
|
||||
stripePaymentMethods = (json['stripe_payment_methods'] as List).map((e) => StripePaymentMethod.fromJson(e)).toList();
|
||||
flutterMiniStoreToken = json['flutter_ministore_token'];
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
@@ -58,7 +54,6 @@ class User {
|
||||
'points_to_credits_conversion_rate': pointsToCreditsConversionRate,
|
||||
'contact_number': contactNumber,
|
||||
'flutter_ministore_token': flutterMiniStoreToken,
|
||||
'stripe_payment_methods': stripePaymentMethods,
|
||||
};
|
||||
|
||||
@override
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class UserPosition {
|
||||
double lat;
|
||||
double lng;
|
||||
double? lat;
|
||||
double? lng;
|
||||
|
||||
UserPosition.fromJson(Map<String, dynamic> json) :
|
||||
lat = double.parse(json['lat'].toString()),
|
||||
|
||||
@@ -4,8 +4,8 @@ import 'dart:convert';
|
||||
import 'waiting_line_item.dart';
|
||||
|
||||
class WaitingLine {
|
||||
List<WaitingLineItem> waitingLines;
|
||||
String storeSn;
|
||||
List<WaitingLineItem>? waitingLines;
|
||||
String? storeSn;
|
||||
|
||||
WaitingLine.fromJson(Map<String, dynamic> json)
|
||||
: waitingLines = (json['waiting_lines'] as List).map((i) => WaitingLineItem.fromJson(i)).toList(),
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class WaitingLineItem {
|
||||
String deviceId;
|
||||
String phone;
|
||||
String createdAt;
|
||||
int peopleCount;
|
||||
int waitingNumber;
|
||||
String? deviceId;
|
||||
String? phone;
|
||||
String? createdAt;
|
||||
int? peopleCount;
|
||||
int? waitingNumber;
|
||||
|
||||
WaitingLineItem.fromJson(Map<String, dynamic> json)
|
||||
: deviceId = json['device_id'],
|
||||
|
||||
@@ -6,20 +6,20 @@ import '../models/business.dart';
|
||||
import '../models/product.dart';
|
||||
|
||||
class AttributeSelection extends StatelessWidget {
|
||||
final Product product;
|
||||
final Business business;
|
||||
final GlobalKey startKey;
|
||||
final Product? product;
|
||||
final Business? business;
|
||||
final GlobalKey? startKey;
|
||||
|
||||
const AttributeSelection({Key key, this.product, this.business, this.startKey}) : super(key: key);
|
||||
const AttributeSelection({Key? key, this.product, this.business, this.startKey}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ResponsiveBuilder(
|
||||
builder: (context, sizingInformation) =>
|
||||
ScreenTypeLayout(
|
||||
mobile: MobileAttributeSelection(product: product, business: business, startKey: startKey,),
|
||||
tablet: MobileAttributeSelection(product: product, business: business, startKey: startKey,),
|
||||
desktop: MobileAttributeSelection(product: product, business: business, startKey: startKey,),
|
||||
mobile: MobileAttributeSelection(product: product!, business: business!, startKey: startKey,),
|
||||
tablet: MobileAttributeSelection(product: product!, business: business!, startKey: startKey,),
|
||||
desktop: MobileAttributeSelection(product: product!, business: business!, startKey: startKey,),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
+3
-3
@@ -8,10 +8,10 @@ import '../widgets/desktop/desktop_blog.dart';
|
||||
import '../widgets/mobile/mobile_blog.dart';
|
||||
|
||||
class Blog extends StatelessWidget {
|
||||
final Key key;
|
||||
final Key? key;
|
||||
final int businessId;
|
||||
|
||||
const Blog({this.key, int businessId}) :
|
||||
const Blog({this.key, int? businessId}) :
|
||||
businessId = businessId ?? Constants.BUSINESS_ID;
|
||||
|
||||
@override
|
||||
@@ -22,7 +22,7 @@ class Blog extends StatelessWidget {
|
||||
mobile: MobileBlog(businessId: businessId,),
|
||||
tablet: DesktopBlog(businessId: businessId,),
|
||||
desktop: Scrollbar(
|
||||
isAlwaysShown: true,
|
||||
thumbVisibility: true,
|
||||
child: DesktopBlog(businessId: businessId,),
|
||||
),
|
||||
),
|
||||
|
||||
+14
-10
@@ -19,10 +19,10 @@ import '../widgets/mobile/mobile_renew_license.dart';
|
||||
class BuyService extends StatefulWidget {
|
||||
final int gid;
|
||||
final String serviceName;
|
||||
final String domain;
|
||||
final String? domain;
|
||||
final int sid;
|
||||
|
||||
const BuyService(this.gid, this.serviceName, {Key key, this.domain, this.sid = 0}) :
|
||||
const BuyService(this.gid, this.serviceName, {Key? key, this.domain, this.sid = 0}) :
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
@@ -30,7 +30,7 @@ class BuyService extends StatefulWidget {
|
||||
}
|
||||
|
||||
class BuyServiceState extends State<BuyService> {
|
||||
Map<String, dynamic> data;
|
||||
Map<String, dynamic>? data;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -51,9 +51,9 @@ class BuyServiceState extends State<BuyService> {
|
||||
return ResponsiveBuilder(
|
||||
builder: (context, sizingInformation) =>
|
||||
ScreenTypeLayout(
|
||||
mobile: MobileBuyService(data),
|
||||
tablet: DesktopBuyService(data),
|
||||
desktop: DesktopBuyService(data),
|
||||
mobile: MobileBuyService(data!),
|
||||
tablet: DesktopBuyService(data!),
|
||||
desktop: DesktopBuyService(data!),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -72,12 +72,16 @@ class BuyServiceState extends State<BuyService> {
|
||||
'store_id': '${widget.sid}',
|
||||
}
|
||||
).then((value) {
|
||||
data = value;
|
||||
data['domain'] = widget.domain;
|
||||
print('data: $data');
|
||||
if (!mounted) return;
|
||||
if (value == null || value is! Map || value['service_selections'] == null) {
|
||||
Utils.showMessageDialog(context, 'Service info unavailable');
|
||||
return;
|
||||
}
|
||||
data = Map<String, dynamic>.from(value);
|
||||
data!['domain'] = widget.domain;
|
||||
setState(() {});
|
||||
}).onError((error, stackTrace) {
|
||||
Utils.showMessageDialog(context, error);
|
||||
if (mounted) Utils.showMessageDialog(context, error);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import '../widgets/mobile/mobile_change_mobile_or_email.dart';
|
||||
class ChangeMobileOrEmail extends StatelessWidget {
|
||||
final bool isMobile;
|
||||
|
||||
const ChangeMobileOrEmail(this.isMobile, {Key key}) : super(key: key);
|
||||
const ChangeMobileOrEmail(this.isMobile, {Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import '../widgets/mobile/mobile_checkout.dart';
|
||||
class Checkout extends StatelessWidget {
|
||||
final int businessId;
|
||||
|
||||
const Checkout(this.businessId, {Key key}) :
|
||||
const Checkout(this.businessId, {Key? key}) :
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
|
||||
@@ -12,9 +12,9 @@ import '../widgets/desktop/desktop_contact_us.dart';
|
||||
import '../widgets/mobile/mobile_contact_us.dart';
|
||||
|
||||
class ContactUs extends StatefulWidget {
|
||||
final int businessId;
|
||||
final int? businessId;
|
||||
|
||||
const ContactUs({this.businessId, Key key}) :
|
||||
const ContactUs({this.businessId, Key? key}) :
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
@@ -22,7 +22,7 @@ class ContactUs extends StatefulWidget {
|
||||
}
|
||||
|
||||
class ContactUsState extends State<ContactUs> {
|
||||
Business business;
|
||||
Business? business;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -43,9 +43,9 @@ class ContactUsState extends State<ContactUs> {
|
||||
return ResponsiveBuilder(
|
||||
builder: (context, sizingInformation) =>
|
||||
ScreenTypeLayout(
|
||||
mobile: MobileContactUs(business),
|
||||
tablet: DesktopContactUs(business),
|
||||
desktop: DesktopContactUs(business),
|
||||
mobile: MobileContactUs(business!),
|
||||
tablet: DesktopContactUs(business!),
|
||||
desktop: DesktopContactUs(business!),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -59,7 +59,7 @@ class ContactUsState extends State<ContactUs> {
|
||||
void loadData() {
|
||||
HttpUtil.httpGet(
|
||||
'v1/get-business',
|
||||
businessId: widget.businessId,
|
||||
businessId: widget.businessId!,
|
||||
).then((value) {
|
||||
business = Business.fromJson(value);
|
||||
setState(() {});
|
||||
|
||||
@@ -10,7 +10,7 @@ import '../widgets/mobile/mobile_coupons.dart';
|
||||
class Coupons extends StatelessWidget {
|
||||
final int contactId;
|
||||
|
||||
const Coupons(this.contactId, {Key key}) :
|
||||
const Coupons(this.contactId, {Key? key}) :
|
||||
super(key: key);
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import '../widgets/mobile/create_online_store_1.dart' as mobile;
|
||||
|
||||
class CreateOnlineStore1 extends StatefulWidget {
|
||||
|
||||
const CreateOnlineStore1({Key key}) :
|
||||
const CreateOnlineStore1({Key? key}) :
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
|
||||
@@ -30,7 +30,7 @@ class Download extends StatefulWidget {
|
||||
|
||||
class DownloadState extends State<Download> {
|
||||
final _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
Map<String, dynamic> data;
|
||||
Map<String, dynamic>? data;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -58,11 +58,11 @@ class DownloadState extends State<Download> {
|
||||
),
|
||||
drawer: sizingInformation.deviceScreenType == DeviceScreenType.mobile ? MobileNavigationDrawer() : null,
|
||||
body: ScreenTypeLayout(
|
||||
mobile: MobileDownloadApps(data),
|
||||
tablet: DesktopDownloadApps(data),
|
||||
mobile: MobileDownloadApps(data!),
|
||||
tablet: DesktopDownloadApps(data!),
|
||||
desktop: Scrollbar(
|
||||
isAlwaysShown: true,
|
||||
child: DesktopDownloadApps(data),
|
||||
thumbVisibility: true,
|
||||
child: DesktopDownloadApps(data!),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: ScreenTypeLayout(
|
||||
@@ -79,7 +79,7 @@ class DownloadState extends State<Download> {
|
||||
super.initState();
|
||||
eventBus.on<OpenDrawer>().listen((event) {
|
||||
if (mounted) {
|
||||
_scaffoldKey.currentState.openDrawer();
|
||||
_scaffoldKey.currentState!.openDrawer();
|
||||
}
|
||||
});
|
||||
_loadData();
|
||||
|
||||
@@ -13,10 +13,10 @@ import '../widgets/general/navigationbar.dart';
|
||||
import '../widgets/mobile/MobileBottomNav.dart';
|
||||
|
||||
class EditAddress extends StatelessWidget {
|
||||
final Key key;
|
||||
final Key? key;
|
||||
final Address address;
|
||||
final int businessId;
|
||||
const EditAddress(this.address, {this.key, int businessId}) :
|
||||
const EditAddress(this.address, {this.key, int? businessId}) :
|
||||
businessId = businessId ?? Constants.BUSINESS_ID;
|
||||
|
||||
@override
|
||||
|
||||
@@ -12,7 +12,7 @@ import '../widgets/general/navigationbar.dart';
|
||||
import '../widgets/mobile/MobileBottomNav.dart';
|
||||
|
||||
class ForgotPassword extends StatelessWidget {
|
||||
const ForgotPassword({Key key}) : super(key: key);
|
||||
const ForgotPassword({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
+19
-18
@@ -34,7 +34,7 @@ import '../widgets/mobile/mobile_navigation_drawer.dart';
|
||||
class Home extends StatefulWidget {
|
||||
final String title;
|
||||
|
||||
Home({Key key, this.title = ''}) : super(key: key);
|
||||
Home({Key? key, this.title = ''}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
@@ -46,11 +46,11 @@ class Home extends StatefulWidget {
|
||||
class HomeState extends State<Home> {
|
||||
final _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
List<Gallery> galleries = [];
|
||||
String content1Message;
|
||||
Map<String, dynamic> content2;
|
||||
String? content1Message;
|
||||
Map<String, dynamic>? content2;
|
||||
|
||||
StreamSubscription _sub;
|
||||
Uri _latestUri;
|
||||
StreamSubscription? _sub;
|
||||
Uri? _latestUri;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -80,9 +80,9 @@ class HomeState extends State<Home> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
MobileIndexCarousel(galleries),
|
||||
MobileIndexMainContent1(content1Message),
|
||||
MobileIndexMainContent2(content2),
|
||||
MobileIndexMainContent3(content2),
|
||||
MobileIndexMainContent1(content1Message ?? ''),
|
||||
MobileIndexMainContent2(content2 ?? <String, dynamic>{}),
|
||||
MobileIndexMainContent3(content2 ?? <String, dynamic>{}),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -91,24 +91,25 @@ class HomeState extends State<Home> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
DesktopIndexCarousel(galleries),
|
||||
DesktopIndexMainContent1(content1Message),
|
||||
DesktopIndexMainContent2(content2),
|
||||
DesktopIndexMainContent1(content1Message ?? ''),
|
||||
DesktopIndexMainContent2(content2 ?? <String, dynamic>{}),
|
||||
CustomersLogo(),
|
||||
DesktopIndexMainContent3(content2),
|
||||
DesktopIndexMainContent3(content2 ?? <String, dynamic>{}),
|
||||
],
|
||||
),
|
||||
),
|
||||
desktop: Scrollbar(
|
||||
isAlwaysShown: true,
|
||||
thumbVisibility: true,
|
||||
child: SingleChildScrollView(
|
||||
primary: true,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
DesktopIndexCarousel(galleries),
|
||||
DesktopIndexMainContent1(content1Message),
|
||||
DesktopIndexMainContent2(content2),
|
||||
DesktopIndexMainContent1(content1Message ?? ''),
|
||||
DesktopIndexMainContent2(content2 ?? <String, dynamic>{}),
|
||||
CustomersLogo(),
|
||||
DesktopIndexMainContent3(content2),
|
||||
DesktopIndexMainContent3(content2 ?? <String, dynamic>{}),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -136,7 +137,7 @@ class HomeState extends State<Home> {
|
||||
_loadData();
|
||||
eventBus.on<OpenDrawer>().listen((event) {
|
||||
if (mounted) {
|
||||
_scaffoldKey.currentState.openDrawer();
|
||||
_scaffoldKey.currentState?.openDrawer();
|
||||
}
|
||||
});
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
@@ -163,7 +164,7 @@ class HomeState extends State<Home> {
|
||||
if (!mounted) return;
|
||||
_latestUri = Uri.base;
|
||||
print('uri base $_latestUri');
|
||||
eventBus.fire(OnGotDeepLinkUri(_latestUri));
|
||||
eventBus.fire(OnGotDeepLinkUri(_latestUri!));
|
||||
} else {
|
||||
// _sub = getUriLinksStream().listen((Uri uri) {
|
||||
// print('_sub should get uri $uri');
|
||||
@@ -189,7 +190,7 @@ class HomeState extends State<Home> {
|
||||
//
|
||||
// if (!mounted) return;
|
||||
// _latestUri = initialUri;
|
||||
// eventBus.fire(OnGotDeepLinkUri(_latestUri));
|
||||
// eventBus.fire(OnGotDeepLinkUri(_latestUri!));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ import '../widgets/mobile/MobileBottomNav.dart';
|
||||
import '../widgets/mobile/mobile_igoshow_learn_more.dart';
|
||||
|
||||
class IGoShowLearnMore extends StatefulWidget {
|
||||
const IGoShowLearnMore({Key key}) : super(key: key);
|
||||
const IGoShowLearnMore({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
@@ -26,7 +26,7 @@ class IGoShowLearnMore extends StatefulWidget {
|
||||
|
||||
class IGoShowLearnMoreState extends State<IGoShowLearnMore> {
|
||||
final _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
Map<String, dynamic> data;
|
||||
Map<String, dynamic>? data;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -56,9 +56,9 @@ class IGoShowLearnMoreState extends State<IGoShowLearnMore> {
|
||||
),
|
||||
drawer: null,
|
||||
body: ScreenTypeLayout(
|
||||
mobile: MobileiGoShowLearnMore(data),
|
||||
tablet: DesktopiGoShowLearnMore(data),
|
||||
desktop: DesktopiGoShowLearnMore(data),
|
||||
mobile: MobileiGoShowLearnMore(data!),
|
||||
tablet: DesktopiGoShowLearnMore(data!),
|
||||
desktop: DesktopiGoShowLearnMore(data!),
|
||||
),
|
||||
bottomNavigationBar: ScreenTypeLayout(
|
||||
mobile: MobileBottomNav(currentIndex: 0,),
|
||||
|
||||
@@ -14,7 +14,7 @@ import '../widgets/mobile/MobileBottomNav.dart';
|
||||
import '../widgets/mobile/mobile_login.dart';
|
||||
|
||||
class Login extends StatefulWidget {
|
||||
final Key key;
|
||||
final Key? key;
|
||||
|
||||
const Login({this.key}) : super(key: key);
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import '../widgets/mobile/MobileBottomNav.dart';
|
||||
import '../widgets/mobile/mobile_me.dart';
|
||||
|
||||
class Me extends StatefulWidget {
|
||||
final Key key;
|
||||
final Key? key;
|
||||
|
||||
const Me({this.key}) : super(key: key);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import '../widgets/mobile/MobileBottomNav.dart';
|
||||
import '../widgets/mobile/mobile_minipos_learn_more.dart';
|
||||
|
||||
class MiniPosLearnMore extends StatefulWidget {
|
||||
const MiniPosLearnMore({Key key}) : super(key: key);
|
||||
const MiniPosLearnMore({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
@@ -26,7 +26,7 @@ class MiniPosLearnMore extends StatefulWidget {
|
||||
|
||||
class MiniPosLearnMoreState extends State<MiniPosLearnMore> {
|
||||
final _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
Map<String, dynamic> data;
|
||||
Map<String, dynamic>? data;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -57,9 +57,9 @@ class MiniPosLearnMoreState extends State<MiniPosLearnMore> {
|
||||
),
|
||||
drawer: null,
|
||||
body: ScreenTypeLayout(
|
||||
mobile: MobileMiniPosLearnMore(data),
|
||||
tablet: DesktopMiniPosLearnMore(data),
|
||||
desktop: DesktopMiniPosLearnMore(data),
|
||||
mobile: MobileMiniPosLearnMore(data!),
|
||||
tablet: DesktopMiniPosLearnMore(data!),
|
||||
desktop: DesktopMiniPosLearnMore(data!),
|
||||
),
|
||||
bottomNavigationBar: ScreenTypeLayout(
|
||||
mobile: MobileBottomNav(currentIndex: 0,),
|
||||
|
||||
@@ -8,10 +8,10 @@ import '../widgets/desktop/desktop_my_addresses.dart';
|
||||
import '../widgets/mobile/mobile_my_addresses.dart';
|
||||
|
||||
class MyAddresses extends StatelessWidget {
|
||||
final Key key;
|
||||
final Key? key;
|
||||
final int businessId;
|
||||
|
||||
const MyAddresses({this.key, int businessId}) :
|
||||
const MyAddresses({this.key, int? businessId}) :
|
||||
businessId = businessId ?? Constants.BUSINESS_ID;
|
||||
|
||||
@override
|
||||
|
||||
@@ -8,10 +8,10 @@ import '../widgets/desktop/desktop_my_support.dart';
|
||||
import '../widgets/mobile/mobile_my_support.dart';
|
||||
|
||||
class MySupport extends StatelessWidget {
|
||||
final Key key;
|
||||
final Key? key;
|
||||
final int businessId;
|
||||
|
||||
const MySupport({this.key, int businessId}) :
|
||||
const MySupport({this.key, int? businessId}) :
|
||||
businessId = businessId ?? Constants.BUSINESS_ID;
|
||||
|
||||
@override
|
||||
|
||||
@@ -7,9 +7,9 @@ import '../widgets/desktop/desktop_new_address.dart';
|
||||
import '../widgets/mobile/mobile_new_address.dart';
|
||||
|
||||
class NewAddress extends StatelessWidget {
|
||||
final Key key;
|
||||
final LocatedAddress locatedAddress;
|
||||
final int businessId;
|
||||
final Key? key;
|
||||
final LocatedAddress? locatedAddress;
|
||||
final int? businessId;
|
||||
const NewAddress({this.key, this.locatedAddress, this.businessId}) : super(key: key);
|
||||
|
||||
@override
|
||||
|
||||
@@ -10,7 +10,7 @@ import '../widgets/mobile/mobile_new_comment.dart';
|
||||
class NewComment extends StatelessWidget {
|
||||
final int orderId;
|
||||
|
||||
const NewComment(this.orderId, {Key key}) :
|
||||
const NewComment(this.orderId, {Key? key}) :
|
||||
super(key: key);
|
||||
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ import '../widgets/mobile/MobileBottomNav.dart';
|
||||
import '../widgets/mobile/mobile_new_ticket.dart';
|
||||
|
||||
class NewTicket extends StatefulWidget {
|
||||
final Key key;
|
||||
final Key? key;
|
||||
final int businessId;
|
||||
|
||||
const NewTicket({this.key, int businessId}) :
|
||||
const NewTicket({this.key, int? businessId}) :
|
||||
businessId = businessId ?? Constants.BUSINESS_ID;
|
||||
|
||||
@override
|
||||
|
||||
@@ -12,7 +12,7 @@ import '../widgets/mobile/MobileBottomNav.dart';
|
||||
import '../widgets/mobile/mobile_new_user.dart';
|
||||
|
||||
class NewUser extends StatelessWidget {
|
||||
const NewUser({Key key}) : super(key: key);
|
||||
const NewUser({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -11,7 +11,7 @@ class OrderDetail extends StatelessWidget {
|
||||
final int orderId;
|
||||
final bool fromOrders;
|
||||
|
||||
const OrderDetail(this.orderId, {this.fromOrders = false, Key key}) :
|
||||
const OrderDetail(this.orderId, {this.fromOrders = false, Key? key}) :
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
|
||||
@@ -10,7 +10,7 @@ import '../widgets/mobile/mobile_pay_now.dart';
|
||||
class PayNow extends StatelessWidget {
|
||||
final int orderId;
|
||||
|
||||
const PayNow(this.orderId, {Key key}) :
|
||||
const PayNow(this.orderId, {Key? key}) :
|
||||
super(key: key);
|
||||
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@ import '../utils/http_util.dart';
|
||||
import '../utils/utils.dart';
|
||||
|
||||
class PlainPage extends StatefulWidget {
|
||||
final int businessId;
|
||||
final int? businessId;
|
||||
final String slug;
|
||||
|
||||
const PlainPage(this.slug, {this.businessId, Key key}) :
|
||||
const PlainPage(this.slug, {this.businessId, Key? key}) :
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
@@ -23,7 +23,7 @@ class PlainPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class PlainPageState extends State<PlainPage> {
|
||||
Blog blog;
|
||||
Blog? blog;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -44,9 +44,9 @@ class PlainPageState extends State<PlainPage> {
|
||||
return ResponsiveBuilder(
|
||||
builder: (context, sizingInformation) =>
|
||||
ScreenTypeLayout(
|
||||
mobile: MobilePlainPage(blog),
|
||||
tablet: DesktopPlainPage(blog),
|
||||
desktop: DesktopPlainPage(blog),
|
||||
mobile: MobilePlainPage(blog!),
|
||||
tablet: DesktopPlainPage(blog!),
|
||||
desktop: DesktopPlainPage(blog!),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class PlainPageState extends State<PlainPage> {
|
||||
void loadData() {
|
||||
HttpUtil.httpGet(
|
||||
'v1/special-page',
|
||||
businessId: widget.businessId,
|
||||
businessId: widget.businessId!,
|
||||
queryParameters: {
|
||||
'bid': widget.slug,
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@ import '../widgets/desktop/desktop_product_detail_page.dart';
|
||||
import '../widgets/mobile/mobile_product_detail_page.dart';
|
||||
|
||||
class ProductDetailPage extends StatelessWidget {
|
||||
final Business business;
|
||||
final Product product;
|
||||
final Business? business;
|
||||
final Product? product;
|
||||
|
||||
const ProductDetailPage({this.business, this.product, Key key}) :
|
||||
const ProductDetailPage({this.business, this.product, Key? key}) :
|
||||
super(key: key);
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ class ProductDetailPage extends StatelessWidget {
|
||||
return ResponsiveBuilder(
|
||||
builder: (context, sizingInformation) =>
|
||||
ScreenTypeLayout(
|
||||
mobile: MobileProductDetailPage(business: business, product: product,),
|
||||
tablet: DesktopProductDetailPage(business: business, product: product,),
|
||||
desktop: DesktopProductDetailPage(business: business, product: product,),
|
||||
mobile: MobileProductDetailPage(business: business!, product: product!,),
|
||||
tablet: DesktopProductDetailPage(business: business!, product: product!,),
|
||||
desktop: DesktopProductDetailPage(business: business!, product: product!,),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import '../widgets/mobile/product_search.dart' as mobile;
|
||||
class ProductSearch extends StatelessWidget {
|
||||
final Business business;
|
||||
|
||||
const ProductSearch(this.business, {Key key}) : super(key: key);
|
||||
const ProductSearch(this.business, {Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import '../widgets/mobile/mobile_renew_license.dart';
|
||||
|
||||
class RenewLicense extends StatefulWidget {
|
||||
|
||||
const RenewLicense({Key key}) :
|
||||
const RenewLicense({Key? key}) :
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
|
||||
@@ -17,7 +17,7 @@ import '../widgets/mobile/mobile_renew_license.dart';
|
||||
class RenewMiniOffice extends StatefulWidget {
|
||||
final int gid;
|
||||
|
||||
const RenewMiniOffice(this.gid, {Key key}) :
|
||||
const RenewMiniOffice(this.gid, {Key? key}) :
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
@@ -25,7 +25,7 @@ class RenewMiniOffice extends StatefulWidget {
|
||||
}
|
||||
|
||||
class RenewMiniOfficeState extends State<RenewMiniOffice> {
|
||||
Map<String, dynamic> data;
|
||||
Map<String, dynamic>? data;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -46,9 +46,9 @@ class RenewMiniOfficeState extends State<RenewMiniOffice> {
|
||||
return ResponsiveBuilder(
|
||||
builder: (context, sizingInformation) =>
|
||||
ScreenTypeLayout(
|
||||
mobile: MobileRenewMiniOffice(data),
|
||||
tablet: DesktopRenewMiniOffice(data),
|
||||
desktop: DesktopRenewMiniOffice(data),
|
||||
mobile: MobileRenewMiniOffice(data!),
|
||||
tablet: DesktopRenewMiniOffice(data!),
|
||||
desktop: DesktopRenewMiniOffice(data!),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ import '../widgets/mobile/mobile_reset_password.dart';
|
||||
|
||||
class ResetPassword extends StatelessWidget {
|
||||
final String mobile;
|
||||
final String code;
|
||||
const ResetPassword(this.mobile, {Key key, this.code}) : super(key: key);
|
||||
final String? code;
|
||||
const ResetPassword(this.mobile, {Key? key, this.code}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import '../widgets/mobile/mobile_search_place.dart';
|
||||
import 'package:responsive_builder/responsive_builder.dart';
|
||||
|
||||
class SearchPlace extends StatelessWidget {
|
||||
final Key key;
|
||||
final Key? key;
|
||||
final int businessId;
|
||||
const SearchPlace(this.businessId, {this.key}) : super(key: key);
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ import '../widgets/mobile/mobile_set_password.dart';
|
||||
|
||||
class SetPassword extends StatelessWidget {
|
||||
final String mobile;
|
||||
final String code;
|
||||
const SetPassword(this.mobile, {Key key, this.code}) : super(key: key);
|
||||
final String? code;
|
||||
const SetPassword(this.mobile, {Key? key, this.code}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
+3
-3
@@ -8,9 +8,9 @@ import '../widgets/desktop/shop.dart' as desktop;
|
||||
import '../widgets/mobile/shop.dart' as mobile;
|
||||
|
||||
class Shop extends StatefulWidget {
|
||||
final int businessId;
|
||||
final int? businessId;
|
||||
|
||||
const Shop({this.businessId, Key key}) : super(key: key);
|
||||
const Shop({this.businessId, Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => ShopState();
|
||||
@@ -20,7 +20,7 @@ class ShopState extends State<Shop> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
int _businessId =
|
||||
widget.businessId == null ? Utils.getBusinessId() : widget.businessId;
|
||||
widget.businessId == null ? Utils.getBusinessId() : widget.businessId!;
|
||||
|
||||
return ResponsiveBuilder(
|
||||
builder: (context, sizingInformation) => ScreenTypeLayout(
|
||||
|
||||
@@ -15,7 +15,7 @@ import '../widgets/mobile/mobile_store_product_search.dart';
|
||||
class StoreProductSearch extends StatelessWidget {
|
||||
final Business business;
|
||||
|
||||
const StoreProductSearch(this.business, {Key key}) : super(key: key);
|
||||
const StoreProductSearch(this.business, {Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:responsive_builder/responsive_builder.dart';
|
||||
|
||||
import '../models/order.dart';
|
||||
import '../models/payment_platform.dart';
|
||||
import '../models/stripe_payment_method.dart';
|
||||
import '../store/actions.dart';
|
||||
import '../store/store.dart';
|
||||
import '../widgets/desktop/desktop_stripe_pay_web.dart';
|
||||
import '../widgets/mobile/mobile_stripe_pay_web.dart';
|
||||
|
||||
class StripePayWeb extends StatelessWidget {
|
||||
final Order order;
|
||||
final PaymentPlatform paymentPlatform;
|
||||
final StripePaymentMethod stripePaymentMethod;
|
||||
|
||||
const StripePayWeb(this.order, this.paymentPlatform, {this.stripePaymentMethod});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
store.dispatch(UpdateContext(context));
|
||||
|
||||
return ResponsiveBuilder(
|
||||
builder: (context, sizingInformation) =>
|
||||
ScreenTypeLayout(
|
||||
mobile: MobileStripePayWeb(order, paymentPlatform, stripePaymentMethod: stripePaymentMethod,),
|
||||
tablet: DesktopStripePayWeb(order, paymentPlatform, stripePaymentMethod: stripePaymentMethod,),
|
||||
desktop: DesktopStripePayWeb(order, paymentPlatform, stripePaymentMethod: stripePaymentMethod,),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import '../widgets/mobile/MobileBottomNav.dart';
|
||||
import '../widgets/mobile/mobile_user_profile.dart';
|
||||
|
||||
class UserProfile extends StatelessWidget {
|
||||
const UserProfile({Key key}) : super(key: key);
|
||||
const UserProfile({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import '../widgets/mobile/MobileBottomNav.dart';
|
||||
import '../widgets/mobile/mobile_view_blog.dart';
|
||||
|
||||
class ViewBlog extends StatefulWidget {
|
||||
final Key key;
|
||||
final Key? key;
|
||||
final int bid;
|
||||
|
||||
const ViewBlog(this.bid, {this.key}) : super(key: key);
|
||||
|
||||
@@ -14,7 +14,7 @@ import '../widgets/mobile/MobileBottomNav.dart';
|
||||
import '../widgets/mobile/mobile_view_ticket.dart';
|
||||
|
||||
class ViewTicket extends StatefulWidget {
|
||||
final Key key;
|
||||
final Key? key;
|
||||
final int ticketId;
|
||||
|
||||
const ViewTicket(this.ticketId, {this.key}) : super(key: key);
|
||||
|
||||
+58
-58
@@ -44,169 +44,169 @@ class Routes {
|
||||
|
||||
static void configure() {
|
||||
router.define('/', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return Home(title: Constants.APP_TITLE,);
|
||||
}),
|
||||
transitionType: TransitionType.fadeIn
|
||||
);
|
||||
router.define('/download', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return Download();
|
||||
}),
|
||||
transitionType: TransitionType.inFromRight
|
||||
);
|
||||
router.define('/minipos-learn-more', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return MiniPosLearnMore();
|
||||
}),
|
||||
transitionType: TransitionType.inFromRight
|
||||
);
|
||||
router.define('/igoshow-learn-more', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return IGoShowLearnMore();
|
||||
}),
|
||||
transitionType: TransitionType.inFromRight
|
||||
);
|
||||
router.define('/login', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return Login();
|
||||
}),
|
||||
transitionType: TransitionType.inFromRight
|
||||
);
|
||||
router.define('/me', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return Me();
|
||||
}),
|
||||
transitionType: TransitionType.inFromRight
|
||||
);
|
||||
router.define('/change-password', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return ChangePassword();
|
||||
}),
|
||||
transitionType: TransitionType.inFromRight
|
||||
);
|
||||
router.define('/user-profile', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return UserProfile();
|
||||
}),
|
||||
transitionType: TransitionType.inFromRight
|
||||
);
|
||||
router.define('/new-user', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return NewUser();
|
||||
}),
|
||||
transitionType: TransitionType.inFromRight
|
||||
);
|
||||
router.define('/set-password/:mobile/:code', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return SetPassword(params['mobile'][0], code: params['code'][0]);
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return SetPassword(params['mobile']![0], code: params['code']![0]);
|
||||
}
|
||||
));
|
||||
router.define('/forgot-password', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return ForgotPassword();
|
||||
}
|
||||
));
|
||||
router.define('/reset-password/:mobile/:code', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return ResetPassword(params['mobile'][0], code: params['code'][0]);
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return ResetPassword(params['mobile']![0], code: params['code']![0]);
|
||||
}
|
||||
));
|
||||
router.define('/change-mobile-email/:ismobile', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
if (params['ismobile'][0] == '1') {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
if (params['ismobile']![0] == '1') {
|
||||
return ChangeMobileOrEmail(true);
|
||||
}
|
||||
return ChangeMobileOrEmail(false);
|
||||
}
|
||||
));
|
||||
router.define('/my-addresses/:business_id', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return MyAddresses(businessId: int.parse(params['business_id'][0]),);
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return MyAddresses(businessId: int.parse(params['business_id']![0]),);
|
||||
}
|
||||
));
|
||||
router.define('/my-support/:business_id', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return MySupport(businessId: int.parse(params['business_id'][0]),);
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return MySupport(businessId: int.parse(params['business_id']![0]),);
|
||||
}
|
||||
));
|
||||
router.define('/new-ticket/:business_id', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return NewTicket(businessId: int.parse(params['business_id'][0]),);
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return NewTicket(businessId: int.parse(params['business_id']![0]),);
|
||||
}
|
||||
));
|
||||
router.define('/search-place/:business_id', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return SearchPlace(int.parse(params['business_id'][0]));
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return SearchPlace(int.parse(params['business_id']![0]));
|
||||
}
|
||||
));
|
||||
router.define('/view-ticket/:ticket_id', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return ViewTicket(int.parse(params['ticket_id'][0]),);
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return ViewTicket(int.parse(params['ticket_id']![0]),);
|
||||
}
|
||||
));
|
||||
router.define('/blog/:business_id', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return Blog(businessId: int.parse(params['business_id'][0]),);
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return Blog(businessId: int.parse(params['business_id']![0]),);
|
||||
}
|
||||
));
|
||||
router.define('/view-blog/:bid', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return ViewBlog(int.parse(params['bid'][0]),);
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return ViewBlog(int.parse(params['bid']![0]),);
|
||||
}
|
||||
));
|
||||
router.define('/shop/:business_id', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return Shop(businessId: int.parse(params['business_id'][0]),);
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return Shop(businessId: int.parse(params['business_id']![0]),);
|
||||
}
|
||||
));
|
||||
router.define('/shop', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return Shop();
|
||||
}
|
||||
));
|
||||
// router.define('/ocr-scan', handler: new Handler(
|
||||
// handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
// handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
// return OCRScan();
|
||||
// }
|
||||
// ));
|
||||
router.define('/checkout/:id', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return Checkout(int.parse(params['id'][0]));
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return Checkout(int.parse(params['id']![0]));
|
||||
}),
|
||||
);
|
||||
router.define('/paynow/:orderId', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return PayNow(int.parse(params['orderId'][0]));
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return PayNow(int.parse(params['orderId']![0]));
|
||||
}),
|
||||
);
|
||||
router.define('/orders', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return Orders();
|
||||
}
|
||||
));
|
||||
router.define('/my-cards', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return MyCards();
|
||||
}
|
||||
));
|
||||
router.define('/orderdetail/:orderId', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return OrderDetail(int.parse(params['orderId'][0]));
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return OrderDetail(int.parse(params['orderId']![0]));
|
||||
}),
|
||||
);
|
||||
router.define('/new-comment/:orderId', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return NewComment(int.parse(params['orderId'][0]));
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return NewComment(int.parse(params['orderId']![0]));
|
||||
}),
|
||||
);
|
||||
router.define('/coupons/:contactId', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return Coupons(int.parse(params['contactId'][0]));
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return Coupons(int.parse(params['contactId']![0]));
|
||||
}),
|
||||
);
|
||||
router.define('/service-policy', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return PlainPage(
|
||||
'service-policy',
|
||||
// businessId: Constants.BUSINESS_ID,
|
||||
@@ -215,7 +215,7 @@ class Routes {
|
||||
}),
|
||||
);
|
||||
router.define('/return-policy', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return PlainPage(
|
||||
'return-policy',
|
||||
// businessId: Constants.BUSINESS_ID,
|
||||
@@ -224,7 +224,7 @@ class Routes {
|
||||
}),
|
||||
);
|
||||
router.define('/privacy-policy', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return PlainPage(
|
||||
'privacy-policy',
|
||||
// businessId: Constants.BUSINESS_ID,
|
||||
@@ -233,7 +233,7 @@ class Routes {
|
||||
}),
|
||||
);
|
||||
router.define('/end-user-license-agreement', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return PlainPage(
|
||||
'end-user-license-agreement',
|
||||
// businessId: Constants.BUSINESS_ID,
|
||||
@@ -242,7 +242,7 @@ class Routes {
|
||||
}),
|
||||
);
|
||||
router.define('/about-us', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return PlainPage(
|
||||
'about-us',
|
||||
// businessId: Constants.BUSINESS_ID,
|
||||
@@ -251,29 +251,29 @@ class Routes {
|
||||
}),
|
||||
);
|
||||
router.define('/contact-us', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return ContactUs(
|
||||
businessId: Constants.BUSINESS_ID,
|
||||
);
|
||||
}),
|
||||
);
|
||||
router.define('/renew-license', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return RenewLicense();
|
||||
}
|
||||
));
|
||||
router.define('/renew-minioffice/:gid', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return RenewMiniOffice(int.parse(params['gid'][0]));
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return RenewMiniOffice(int.parse(params['gid']![0]));
|
||||
}
|
||||
));
|
||||
router.define('/buy-service/:gid/:servicename', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
return BuyService(int.parse(params['gid'][0]), params['servicename'][0]);
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return BuyService(int.parse(params['gid']![0]), params['servicename']![0]);
|
||||
}
|
||||
));
|
||||
router.define('/contact-stores', handler: new Handler(
|
||||
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
|
||||
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
|
||||
return CreateOnlineStore1();
|
||||
}
|
||||
));
|
||||
|
||||
@@ -15,12 +15,12 @@ class UpdateLocale {
|
||||
}
|
||||
|
||||
class UpdateCurrentUser {
|
||||
final User user;
|
||||
final User? user;
|
||||
UpdateCurrentUser(this.user);
|
||||
}
|
||||
|
||||
class UpdateRedirectRoute {
|
||||
final String route;
|
||||
final String? route;
|
||||
UpdateRedirectRoute(this.route);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ import 'package:redux/redux.dart';
|
||||
|
||||
import '../actions.dart';
|
||||
|
||||
final cartInfoReducer = combineReducers<List<CartInfo>>([
|
||||
TypedReducer<List<CartInfo>, UpdateCartInfo>(_updateCartInfo)
|
||||
final cartInfoReducer = combineReducers<List<CartInfo>?>([
|
||||
TypedReducer<List<CartInfo>?, UpdateCartInfo>(_updateCartInfo)
|
||||
]);
|
||||
|
||||
List<CartInfo> _updateCartInfo(List<CartInfo> cartInfos, action) {
|
||||
List<CartInfo>? _updateCartInfo(List<CartInfo>? cartInfos, action) {
|
||||
return action.cartInfos;
|
||||
}
|
||||
@@ -3,10 +3,10 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_wisetronic/store/actions.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
|
||||
final contextReducer = combineReducers<BuildContext>([
|
||||
TypedReducer<BuildContext, UpdateContext>(_updateContext)
|
||||
final contextReducer = combineReducers<BuildContext?>([
|
||||
TypedReducer<BuildContext?, UpdateContext>(_updateContext)
|
||||
]);
|
||||
|
||||
BuildContext _updateContext(BuildContext context, action) {
|
||||
BuildContext? _updateContext(BuildContext? context, action) {
|
||||
return action.context;
|
||||
}
|
||||
@@ -2,10 +2,10 @@ import 'package:redux/redux.dart';
|
||||
|
||||
import '../actions.dart';
|
||||
|
||||
final deviceIdReducer = combineReducers<String>([
|
||||
TypedReducer<String, UpdateDeviceId>(_updateDeviceId)
|
||||
final deviceIdReducer = combineReducers<String?>([
|
||||
TypedReducer<String?, UpdateDeviceId>(_updateDeviceId)
|
||||
]);
|
||||
|
||||
String _updateDeviceId(String deviceId, action) {
|
||||
String? _updateDeviceId(String? deviceId, action) {
|
||||
return action.deviceId;
|
||||
}
|
||||
@@ -2,10 +2,10 @@ import 'package:redux/redux.dart';
|
||||
|
||||
import '../actions.dart';
|
||||
|
||||
final fcmtokenReducer = combineReducers<String>([
|
||||
TypedReducer<String, UpdateFcmToken>(_updateFcmToken)
|
||||
final fcmtokenReducer = combineReducers<String?>([
|
||||
TypedReducer<String?, UpdateFcmToken>(_updateFcmToken)
|
||||
]);
|
||||
|
||||
String _updateFcmToken(String token, action) {
|
||||
String? _updateFcmToken(String? token, action) {
|
||||
return action.token;
|
||||
}
|
||||
@@ -2,10 +2,10 @@ import 'package:redux/redux.dart';
|
||||
|
||||
import '../actions.dart';
|
||||
|
||||
final lastVisitReducer = combineReducers<List<int>>([
|
||||
TypedReducer<List<int>, UpdateLastVisit>(_updateLastVisit)
|
||||
final lastVisitReducer = combineReducers<List<int>?>([
|
||||
TypedReducer<List<int>?, UpdateLastVisit>(_updateLastVisit)
|
||||
]);
|
||||
|
||||
List<int> _updateLastVisit(List<int> lastVisit, action) {
|
||||
List<int>? _updateLastVisit(List<int>? lastVisit, action) {
|
||||
return action.lastVisit;
|
||||
}
|
||||
@@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_wisetronic/store/actions.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
|
||||
final localeReducer = combineReducers<Locale>([
|
||||
TypedReducer<Locale, UpdateLocale>(_updateLocale)
|
||||
final localeReducer = combineReducers<Locale?>([
|
||||
TypedReducer<Locale?, UpdateLocale>(_updateLocale)
|
||||
]);
|
||||
|
||||
Locale _updateLocale(Locale locale, action) {
|
||||
Locale? _updateLocale(Locale? locale, action) {
|
||||
return action.locale;
|
||||
}
|
||||
@@ -3,10 +3,10 @@ import 'package:redux/redux.dart';
|
||||
import '../../models/located_address.dart';
|
||||
import '../actions.dart';
|
||||
|
||||
final locatedAddressReducer = combineReducers<LocatedAddress>([
|
||||
TypedReducer<LocatedAddress, UpdateLocatedAddress>(_updateLocatedAddress)
|
||||
final locatedAddressReducer = combineReducers<LocatedAddress?>([
|
||||
TypedReducer<LocatedAddress?, UpdateLocatedAddress>(_updateLocatedAddress)
|
||||
]);
|
||||
|
||||
LocatedAddress _updateLocatedAddress(LocatedAddress locatedAddress, action) {
|
||||
LocatedAddress? _updateLocatedAddress(LocatedAddress? locatedAddress, action) {
|
||||
return action.locatedAddress;
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
import 'package:redux/redux.dart';
|
||||
import '../actions.dart';
|
||||
|
||||
final redirectRouteReducer = combineReducers<String>([
|
||||
TypedReducer<String, UpdateRedirectRoute>(_updateRedirectRoute)
|
||||
final redirectRouteReducer = combineReducers<String?>([
|
||||
TypedReducer<String?, UpdateRedirectRoute>(_updateRedirectRoute)
|
||||
]);
|
||||
|
||||
String _updateRedirectRoute(String route, action) {
|
||||
String? _updateRedirectRoute(String? route, action) {
|
||||
return action.route;
|
||||
}
|
||||
@@ -2,10 +2,10 @@ import 'package:redux/redux.dart';
|
||||
|
||||
import '../actions.dart';
|
||||
|
||||
final tableNumberReducer = combineReducers<String>([
|
||||
TypedReducer<String, UpdateTableNumber>(_updateTableNumber)
|
||||
final tableNumberReducer = combineReducers<String?>([
|
||||
TypedReducer<String?, UpdateTableNumber>(_updateTableNumber)
|
||||
]);
|
||||
|
||||
String _updateTableNumber(String tableNumber, action) {
|
||||
String? _updateTableNumber(String? tableNumber, action) {
|
||||
return action.tableNumber;
|
||||
}
|
||||
@@ -4,10 +4,10 @@ import 'package:flutter_wisetronic/models/user.dart';
|
||||
|
||||
import '../actions.dart';
|
||||
|
||||
final userReducer = combineReducers<User>([
|
||||
TypedReducer<User, UpdateCurrentUser>(_updateCurrentUser)
|
||||
final userReducer = combineReducers<User?>([
|
||||
TypedReducer<User?, UpdateCurrentUser>(_updateCurrentUser)
|
||||
]);
|
||||
|
||||
User _updateCurrentUser(User user, action) {
|
||||
User? _updateCurrentUser(User? user, action) {
|
||||
return action.user;
|
||||
}
|
||||
@@ -6,16 +6,16 @@ import '../../models/user.dart';
|
||||
|
||||
@immutable
|
||||
class AppState {
|
||||
final BuildContext context;
|
||||
final Locale locale;
|
||||
final User user;
|
||||
final String redirectRoute;
|
||||
final List<CartInfo> cartInfos;
|
||||
final LocatedAddress locatedAddress;
|
||||
final String fcmToken;
|
||||
final List<int> lastVisit;
|
||||
final String deviceId;
|
||||
final String tableNumber;
|
||||
final BuildContext? context;
|
||||
final Locale? locale;
|
||||
final User? user;
|
||||
final String? redirectRoute;
|
||||
final List<CartInfo>? cartInfos;
|
||||
final LocatedAddress? locatedAddress;
|
||||
final String? fcmToken;
|
||||
final List<int>? lastVisit;
|
||||
final String? deviceId;
|
||||
final String? tableNumber;
|
||||
|
||||
AppState({this.context, this.locale, this.user, this.redirectRoute,
|
||||
this.cartInfos, this.locatedAddress, this.fcmToken, this.lastVisit,
|
||||
@@ -24,8 +24,8 @@ class AppState {
|
||||
factory AppState.init() => AppState();
|
||||
|
||||
AppState copyWith({
|
||||
BuildContext context,
|
||||
Locale locale}) {
|
||||
BuildContext? context,
|
||||
Locale? locale}) {
|
||||
return AppState(
|
||||
context: context ?? this.context,
|
||||
locale: locale ?? this.locale,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user