feat(mobile): UI-01 theme system, shared components and navigation
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -4,32 +4,33 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../app/locale_controller.dart';
|
||||
import '../core/api_client.dart';
|
||||
import '../features/uploads/engine_scope.dart';
|
||||
import '../features/uploads/queue_controller.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
import 'albums_tab.dart';
|
||||
import 'queue_tab.dart';
|
||||
|
||||
/// 主壳:底部导航(相册 / 队列 / 设置)。
|
||||
class HomePage extends StatefulWidget {
|
||||
/// 主壳:底部导航「相册 / 上传 / 设置」(UI-01 §4.1)。
|
||||
///
|
||||
/// IndexedStack 保持三页签状态;「上传」页签角标 = 当前账号未结束任务数
|
||||
/// ([unfinishedCountOf],TaskStore 账号硬隔离,不跨账号),为 0 时隐藏。
|
||||
class HomePage extends ConsumerStatefulWidget {
|
||||
const HomePage({super.key});
|
||||
|
||||
@override
|
||||
State<HomePage> createState() => _HomePageState();
|
||||
ConsumerState<HomePage> createState() => _HomePageState();
|
||||
}
|
||||
|
||||
class _HomePageState extends State<HomePage> {
|
||||
class _HomePageState extends ConsumerState<HomePage> {
|
||||
int _selectedIndex = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
final badgeCount = ref.watch(uploadBadgeCountProvider);
|
||||
return Scaffold(
|
||||
body: IndexedStack(
|
||||
index: _selectedIndex,
|
||||
children: const [
|
||||
AlbumsTab(),
|
||||
QueueTab(),
|
||||
SettingsTab(),
|
||||
],
|
||||
children: const [AlbumsTab(), QueueTab(), SettingsTab()],
|
||||
),
|
||||
bottomNavigationBar: NavigationBar(
|
||||
selectedIndex: _selectedIndex,
|
||||
@@ -39,17 +40,23 @@ class _HomePageState extends State<HomePage> {
|
||||
NavigationDestination(
|
||||
icon: const Icon(Icons.photo_library_outlined),
|
||||
selectedIcon: const Icon(Icons.photo_library),
|
||||
label: l10n.homeTabAlbums,
|
||||
label: l10n.navAlbums,
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: const Icon(Icons.cloud_upload_outlined),
|
||||
selectedIcon: const Icon(Icons.cloud_upload),
|
||||
label: l10n.homeTabQueue,
|
||||
icon: _UploadTabIcon(
|
||||
count: badgeCount,
|
||||
icon: Icons.cloud_upload_outlined,
|
||||
),
|
||||
selectedIcon: _UploadTabIcon(
|
||||
count: badgeCount,
|
||||
icon: Icons.cloud_upload,
|
||||
),
|
||||
label: l10n.navUploads,
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: const Icon(Icons.settings_outlined),
|
||||
selectedIcon: const Icon(Icons.settings),
|
||||
label: l10n.homeTabSettings,
|
||||
label: l10n.navSettings,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -57,6 +64,25 @@ class _HomePageState extends State<HomePage> {
|
||||
}
|
||||
}
|
||||
|
||||
/// 上传页签图标 + 未完成任务角标(≤0 时隐藏 Badge,仅图标)。
|
||||
///
|
||||
/// Semantics 携带本地化计数文案(读屏不依赖角标视觉)。
|
||||
class _UploadTabIcon extends StatelessWidget {
|
||||
const _UploadTabIcon({required this.count, required this.icon});
|
||||
|
||||
final int count;
|
||||
final IconData icon;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (count <= 0) return Icon(icon);
|
||||
return Semantics(
|
||||
label: AppLocalizations.of(context).badgeUploading(count),
|
||||
child: Badge.count(count: count, child: Icon(icon)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 设置页(P3 Task 3:修改密码入口 + 退出登录;Task 10:语言切换)。
|
||||
class SettingsTab extends ConsumerWidget {
|
||||
const SettingsTab({super.key});
|
||||
|
||||
Reference in New Issue
Block a user