Files
flutter_wisetronic/UPGRADE_NOTES.md
peima 1a578c925d feat: Phase 2 — upgrade deps to null-safe, replace deprecated packages
- pubspec: bump all maintained deps to null-safe latest; flutter pub get resolves
- Remove 12 packages (0-ref or no null-safe): splashscreen, flappy_search_bar,
  searchable_dropdown, share, platform_detect, flutter_inappwebview, countdown,
  gender_selection, flutter_dash, smooth_star_rating, hovering, ffi
- Add flutter_rating_bar
- Keep discontinued-but-null-safe for now (Phase 5): pull_to_refresh, hive, catcher
- New null-safe custom components (API-compatible, callers change only imports):
  utils/countdown.dart, widgets/general/{hover_widget,gender_selection,
  smooth_star_rating,search_bar}.dart
- main.dart: drop dead SplashScreen _buildBody + _to field
- 23 consuming files: swap deprecated imports to local components

Null-safety migration + upgraded-API adaptation = Phase 3.
2026-07-24 03:10:12 +08:00

3.7 KiB
Raw Blame History

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 修复

阶段

  • 阶段 0基线 & 锁版本
  • 阶段 1去掉 Stripe
  • 阶段 2依赖替换与升级
  • 阶段 3空安全迁移
  • 阶段 4Web 跑起来

改动记录

阶段 0

  • 创建 UPGRADE_NOTES.md
  • pubspec.yaml: environment sdk >=2.7.0 <3.0.0>=3.0.0 <4.0.0flutter >=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#
  • 保留: 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 3API 升级破坏性变更(dio5/badges3/toggle_switch2/pinput5/geolocator12 等用法适配) + 整库空安全迁移,按 dart analyze 驱动修复