113 lines
3.0 KiB
Dart
113 lines
3.0 KiB
Dart
|
|
import 'package:flutter/material.dart';
|
|||
|
|
|
|||
|
|
import '../l10n/app_localizations.dart';
|
|||
|
|
|
|||
|
|
/// 主壳:底部导航(相册 / 队列 / 设置)。
|
|||
|
|
class HomePage extends StatefulWidget {
|
|||
|
|
const HomePage({super.key});
|
|||
|
|
|
|||
|
|
@override
|
|||
|
|
State<HomePage> createState() => _HomePageState();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
class _HomePageState extends State<HomePage> {
|
|||
|
|
int _selectedIndex = 0;
|
|||
|
|
|
|||
|
|
@override
|
|||
|
|
Widget build(BuildContext context) {
|
|||
|
|
final l10n = AppLocalizations.of(context);
|
|||
|
|
return Scaffold(
|
|||
|
|
body: IndexedStack(
|
|||
|
|
index: _selectedIndex,
|
|||
|
|
children: const [
|
|||
|
|
AlbumsTab(),
|
|||
|
|
QueueTab(),
|
|||
|
|
SettingsTab(),
|
|||
|
|
],
|
|||
|
|
),
|
|||
|
|
bottomNavigationBar: NavigationBar(
|
|||
|
|
selectedIndex: _selectedIndex,
|
|||
|
|
onDestinationSelected: (index) =>
|
|||
|
|
setState(() => _selectedIndex = index),
|
|||
|
|
destinations: [
|
|||
|
|
NavigationDestination(
|
|||
|
|
icon: const Icon(Icons.photo_library_outlined),
|
|||
|
|
selectedIcon: const Icon(Icons.photo_library),
|
|||
|
|
label: l10n.homeTabAlbums,
|
|||
|
|
),
|
|||
|
|
NavigationDestination(
|
|||
|
|
icon: const Icon(Icons.cloud_upload_outlined),
|
|||
|
|
selectedIcon: const Icon(Icons.cloud_upload),
|
|||
|
|
label: l10n.homeTabQueue,
|
|||
|
|
),
|
|||
|
|
NavigationDestination(
|
|||
|
|
icon: const Icon(Icons.settings_outlined),
|
|||
|
|
selectedIcon: const Icon(Icons.settings),
|
|||
|
|
label: l10n.homeTabSettings,
|
|||
|
|
),
|
|||
|
|
],
|
|||
|
|
),
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// 相册列表(桩)。Task 4:游标分页、创建/编辑、二维码分享。
|
|||
|
|
class AlbumsTab extends StatelessWidget {
|
|||
|
|
const AlbumsTab({super.key});
|
|||
|
|
|
|||
|
|
@override
|
|||
|
|
Widget build(BuildContext context) {
|
|||
|
|
final l10n = AppLocalizations.of(context);
|
|||
|
|
return Scaffold(
|
|||
|
|
appBar: AppBar(title: Text(l10n.albums)),
|
|||
|
|
body: Center(
|
|||
|
|
child: Text(
|
|||
|
|
l10n.albums,
|
|||
|
|
style: Theme.of(context).textTheme.headlineSmall,
|
|||
|
|
),
|
|||
|
|
),
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// 上传队列(桩)。Task 6/9:状态机展示、筛选与重试。
|
|||
|
|
class QueueTab extends StatelessWidget {
|
|||
|
|
const QueueTab({super.key});
|
|||
|
|
|
|||
|
|
@override
|
|||
|
|
Widget build(BuildContext context) {
|
|||
|
|
final l10n = AppLocalizations.of(context);
|
|||
|
|
return Scaffold(
|
|||
|
|
appBar: AppBar(title: Text(l10n.queue)),
|
|||
|
|
body: Center(
|
|||
|
|
child: Text(
|
|||
|
|
l10n.queue,
|
|||
|
|
style: Theme.of(context).textTheme.headlineSmall,
|
|||
|
|
),
|
|||
|
|
),
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// 设置(桩)。Task 10:App 内语言切换(zh / en / 跟随系统)持久化。
|
|||
|
|
class SettingsTab extends StatelessWidget {
|
|||
|
|
const SettingsTab({super.key});
|
|||
|
|
|
|||
|
|
@override
|
|||
|
|
Widget build(BuildContext context) {
|
|||
|
|
final l10n = AppLocalizations.of(context);
|
|||
|
|
return Scaffold(
|
|||
|
|
appBar: AppBar(title: Text(l10n.settings)),
|
|||
|
|
body: ListView(
|
|||
|
|
children: [
|
|||
|
|
ListTile(
|
|||
|
|
leading: const Icon(Icons.language),
|
|||
|
|
title: Text(l10n.language),
|
|||
|
|
subtitle: Text(l10n.localeFollowSystem),
|
|||
|
|
),
|
|||
|
|
],
|
|||
|
|
),
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
}
|