add support for badges and notifications, adjust nav pages
All checks were successful
All checks were successful
This commit is contained in:
48
lib/components/pages/logbook.dart
Normal file
48
lib/components/pages/logbook.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mileograph_flutter/components/pages/legs.dart';
|
||||
import 'package:mileograph_flutter/components/pages/trips.dart';
|
||||
|
||||
enum LogbookTab { entries, trips }
|
||||
|
||||
class LogbookPage extends StatelessWidget {
|
||||
const LogbookPage({super.key, this.initialTab = LogbookTab.entries});
|
||||
|
||||
final LogbookTab initialTab;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final initialIndex = initialTab == LogbookTab.trips ? 1 : 0;
|
||||
return DefaultTabController(
|
||||
key: ValueKey(initialTab),
|
||||
initialIndex: initialIndex,
|
||||
length: 2,
|
||||
child: Column(
|
||||
children: [
|
||||
TabBar(
|
||||
onTap: (index) {
|
||||
final dest =
|
||||
index == 0 ? '/logbook/entries' : '/logbook/trips';
|
||||
final current = GoRouterState.of(context).uri.path;
|
||||
if (current != dest) {
|
||||
context.go(dest);
|
||||
}
|
||||
},
|
||||
tabs: const [
|
||||
Tab(text: 'Entries'),
|
||||
Tab(text: 'Trips'),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
children: const [
|
||||
LegsPage(),
|
||||
TripsPage(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user