new UI + new targets.

This commit is contained in:
Jan Pleterski
2026-11-27 14:37:44 +01:00
parent 5f9e2a3b86
commit 2fc741a9f6
113 changed files with 6861 additions and 7381 deletions
+57 -18
View File
@@ -1,10 +1,19 @@
import 'package:flutter/material.dart';
import '../theme/app_theme.dart';
class NavItem {
final IconData icon;
final IconData selectedIcon;
final String label;
const NavItem(this.icon, this.selectedIcon, this.label);
}
/// Bottom navigation of the design: icon + label, the selected one on a soft
/// accent pill. Paints the gesture-bar strip below it too (edge-to-edge).
class BottomNavBar extends StatelessWidget {
final int selectedIndex;
final ValueChanged<int> onItemTapped;
final List<BottomNavigationBarItem> items;
final List<NavItem> items;
const BottomNavBar({
super.key,
@@ -15,29 +24,59 @@ class BottomNavBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
// Paint the gesture-bar strip below the nav too (edge-to-edge since targetSdk 35),
// otherwise the target background color shows through as a thin line.
return ColoredBox(
color: AppTheme.bar,
final c = Palette.current;
return DecoratedBox(
decoration: BoxDecoration(
color: c.nav,
border: Border(top: BorderSide(color: c.line2)),
),
child: SafeArea(
top: false,
child: SizedBox(
height: 80,
child: BottomNavigationBar(
backgroundColor: AppTheme.bar,
currentIndex: selectedIndex,
onTap: onItemTapped,
showSelectedLabels: true,
showUnselectedLabels: true,
type: BottomNavigationBarType.fixed,
selectedFontSize: 12,
unselectedFontSize: 12,
selectedItemColor: Colors.white,
unselectedItemColor: Colors.white70,
items: items,
height: 66,
child: Row(
children: [
for (int i = 0; i < items.length; i++)
Expanded(child: _item(c, items[i], i == selectedIndex, () => onItemTapped(i))),
],
),
),
),
);
}
Widget _item(Palette c, NavItem item, bool selected, VoidCallback onTap) {
return InkWell(
onTap: onTap,
splashFactory: NoSplash.splashFactory,
highlightColor: Colors.transparent,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AnimatedContainer(
duration: const Duration(milliseconds: 200),
curve: Curves.easeOut,
width: 52,
height: 30,
decoration: BoxDecoration(
color: selected ? c.accentSoft : Colors.transparent,
borderRadius: BorderRadius.circular(15),
),
child: Icon(selected ? item.selectedIcon : item.icon, size: 22, color: selected ? c.accent : c.muted),
),
const SizedBox(height: 4),
Text(
item.label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 11,
fontWeight: selected ? FontWeight.w700 : FontWeight.w500,
color: selected ? c.ink : c.muted,
),
),
],
),
);
}
}