82 lines
2.3 KiB
Dart
82 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:mileograph_flutter/components/pages/profile.dart';
|
|
import 'package:mileograph_flutter/components/pages/settings.dart';
|
|
import 'package:mileograph_flutter/components/pages/stats.dart';
|
|
|
|
class MorePage extends StatelessWidget {
|
|
const MorePage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Navigator(
|
|
onGenerateRoute: (settings) {
|
|
final name = settings.name ?? '/';
|
|
Widget page;
|
|
switch (name) {
|
|
case '/settings':
|
|
page = const SettingsPage();
|
|
break;
|
|
case '/profile':
|
|
page = const ProfilePage();
|
|
break;
|
|
case '/stats':
|
|
page = const StatsPage();
|
|
break;
|
|
case '/more/settings':
|
|
page = const SettingsPage();
|
|
break;
|
|
case '/more/profile':
|
|
page = const ProfilePage();
|
|
break;
|
|
case '/more/stats':
|
|
page = const StatsPage();
|
|
break;
|
|
case '/':
|
|
default:
|
|
page = _MoreHome();
|
|
}
|
|
return MaterialPageRoute(builder: (_) => page, settings: settings);
|
|
},
|
|
);
|
|
}
|
|
}
|
|
|
|
class _MoreHome extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ListView(
|
|
padding: const EdgeInsets.all(16),
|
|
children: [
|
|
Text(
|
|
'More',
|
|
style: Theme.of(context).textTheme.headlineSmall,
|
|
),
|
|
const SizedBox(height: 12),
|
|
Card(
|
|
child: Column(
|
|
children: [
|
|
ListTile(
|
|
leading: const Icon(Icons.emoji_events),
|
|
title: const Text('Badges'),
|
|
onTap: () => Navigator.of(context).pushNamed('/more/profile'),
|
|
),
|
|
const Divider(height: 1),
|
|
ListTile(
|
|
leading: const Icon(Icons.bar_chart),
|
|
title: const Text('Stats'),
|
|
onTap: () => Navigator.of(context).pushNamed('/more/stats'),
|
|
),
|
|
const Divider(height: 1),
|
|
ListTile(
|
|
leading: const Icon(Icons.settings),
|
|
title: const Text('Settings'),
|
|
onTap: () => Navigator.of(context).pushNamed('/more/settings'),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|