Files
AIOA/mobile/lib/app/shell.dart
T
2026-07-18 09:13:27 +08:00

48 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class AioaShell extends StatelessWidget {
const AioaShell({super.key, required this.location, required this.child});
final String location;
final Widget child;
@override
Widget build(BuildContext context) {
final index = switch (location) {
String path when path.startsWith('/assistant') => 1,
String path when path.startsWith('/tasks') => 2,
String path when path.startsWith('/profile') => 3,
_ => 0,
};
return Scaffold(
body: SafeArea(child: child),
bottomNavigationBar: NavigationBar(
selectedIndex: index,
onDestinationSelected: (value) {
const paths = ['/workspace', '/assistant', '/tasks', '/profile'];
context.go(paths[value]);
},
destinations: const [
NavigationDestination(
icon: Icon(Icons.grid_view_rounded),
label: '工作台',
),
NavigationDestination(
icon: Icon(Icons.auto_awesome_rounded),
label: 'AI 助手',
),
NavigationDestination(
icon: Icon(Icons.task_alt_rounded),
label: '待办',
),
NavigationDestination(
icon: Icon(Icons.person_outline_rounded),
label: '我的',
),
],
),
);
}
}