- flutter create 初始化 + 依赖(riverpod 3/dio/go_router/three_dart 0.0.16) - ApiClient:JWT 拦截器 + 统一响应解包 + 401 登出回调 + multipart 上传 - TokenStorage(shared_preferences)+ AuthNotifier 登录/登出 - 登录页(含注册对话框)+ 4 Tab 主框架 - 6 个单元测试通过(网络层 4 + 认证 2) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
59 lines
1.7 KiB
Dart
59 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../commercial/commercial_page.dart';
|
|
import '../outfit/outfit_page.dart';
|
|
import '../profile/profile_page.dart';
|
|
import '../wardrobe/wardrobe_page.dart';
|
|
|
|
/// 主框架:4 Tab(我的形象 / 我的衣橱 / 穿搭方案 / 门店电商)
|
|
class HomePage extends StatefulWidget {
|
|
const HomePage({super.key});
|
|
|
|
@override
|
|
State<HomePage> createState() => _HomePageState();
|
|
}
|
|
|
|
class _HomePageState extends State<HomePage> {
|
|
int _index = 0;
|
|
|
|
static const _titles = ['我的形象', '我的衣橱', '穿搭方案', '门店电商'];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(title: Text(_titles[_index])),
|
|
body: IndexedStack(
|
|
index: _index,
|
|
children: const [
|
|
ProfilePage(),
|
|
WardrobePage(),
|
|
OutfitPage(),
|
|
CommercialPage(),
|
|
],
|
|
),
|
|
bottomNavigationBar: NavigationBar(
|
|
selectedIndex: _index,
|
|
onDestinationSelected: (i) => setState(() => _index = i),
|
|
destinations: const [
|
|
NavigationDestination(
|
|
icon: Icon(Icons.face_outlined),
|
|
selectedIcon: Icon(Icons.face),
|
|
label: '形象'),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.checkroom_outlined),
|
|
selectedIcon: Icon(Icons.checkroom),
|
|
label: '衣橱'),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.auto_awesome_outlined),
|
|
selectedIcon: Icon(Icons.auto_awesome),
|
|
label: '穿搭'),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.store_outlined),
|
|
selectedIcon: Icon(Icons.store),
|
|
label: '门店'),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|