add support for badges and notifications, adjust nav pages
All checks were successful
All checks were successful
This commit is contained in:
68
lib/components/pages/more.dart
Normal file
68
lib/components/pages/more.dart
Normal file
@@ -0,0 +1,68 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mileograph_flutter/components/pages/profile.dart';
|
||||
import 'package:mileograph_flutter/components/pages/settings.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 '/more/settings':
|
||||
page = const SettingsPage();
|
||||
break;
|
||||
case '/more/profile':
|
||||
page = const ProfilePage();
|
||||
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.settings),
|
||||
title: const Text('Settings'),
|
||||
onTap: () => Navigator.of(context).pushNamed('/more/settings'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user