1
0
mirror of https://github.com/go-vikunja/app synced 2024-06-01 02:06:51 +00:00

added bottom navigation bar to list view

This commit is contained in:
Paul Nettleton 2022-07-10 05:21:48 -05:00
parent 9f05f72de1
commit 4a4ad2c9b3
2 changed files with 36 additions and 0 deletions

View File

@ -23,6 +23,7 @@ class ListPage extends StatefulWidget {
}
class _ListPageState extends State<ListPage> {
int _viewIndex = 0;
TaskList _list;
List<Task> _loadingTasks = [];
int _currentPage = 1;
@ -103,9 +104,31 @@ class _ListPageState extends State<ListPage> {
builder: (context) => FloatingActionButton(
onPressed: () => _addItemDialog(context), child: Icon(Icons.add)),
),
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.view_list),
label: 'List',
tooltip: 'List',
),
BottomNavigationBarItem(
icon: Icon(Icons.view_kanban),
label: 'Kanban',
tooltip: 'Kanban',
),
],
currentIndex: _viewIndex,
onTap: _onViewTapped,
),
);
}
void _onViewTapped(int index) {
setState(() {
_viewIndex = index;
});
}
TaskTile _buildTile(Task task) {
return TaskTile(
task: task,

View File

@ -1,3 +1,5 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:vikunja_app/theme/constants.dart';
@ -32,5 +34,16 @@ ThemeData _buildVikunjaTheme(ThemeData base) {
vWhite, // This does not work, looks like a bug in Flutter: https://github.com/flutter/flutter/issues/19623
),
),
bottomNavigationBarTheme: base.bottomNavigationBarTheme.copyWith(
// Make bottomNavigationBar backgroundColor darker to provide more separation
backgroundColor: () {
final _hslColor = HSLColor.fromColor(
base.bottomNavigationBarTheme.backgroundColor != null
? base.bottomNavigationBarTheme.backgroundColor
: base.scaffoldBackgroundColor
);
return _hslColor.withLightness(max(_hslColor.lightness - 0.03, 0)).toColor();
}(),
),
);
}