feat: 完成智能电网电工端 Flutter 应用初始化

创建完整的 Flutter 项目结构,包含 Android 和 iOS 平台配置、核心网络层、路由、状态管理及业务模块(订单、收益、认证),适配原 uni-app 项目功能逻辑
This commit is contained in:
andyesfly committed 2026-10-06 11:54:10 +08:00
commit 56830e94ec
108 files changed
+9272

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
/// 底部导航的三个 Tab,对应 `components/CustomTabBar.vue` 的 3 个入口。
enum AppTab { order, earnings, profile }
extension AppTabKey on AppTab {
/// 与 `XBottomNav.items` 中的 key 一致。
String get key => switch (this) {
AppTab.order => 'order',
AppTab.earnings => 'earnings',
AppTab.profile => 'profile',
};
}
/// 当前 Tab。源里每个页面各自挂 `CustomTabBar` 并用 `redirectTo` 切换,
/// Flutter 端改为单容器 + [IndexedStack],避免页面重建、保留各自滚动位置。
class TabIndexController extends Notifier<AppTab> {
@override
AppTab build() => AppTab.order;
void select(AppTab tab) => state = tab;
void selectByKey(String key) {
state = AppTab.values.firstWhere((t) => t.key == key, orElse: () => state);
}
}
final tabIndexProvider = NotifierProvider<TabIndexController, AppTab>(
TabIndexController.new,
);