Build APK / build (push) Successful in 5m30s
New Settings > Appearance toggle moves Search into the bottom bar and out of the top bar, so there's only one search entry point on screen. Tapping it pushes SearchView same as before - it's never highlighted, since it isn't a real destination. - Attached: Search becomes the row's last item, styled like any other tab but permanently idle. - Floating: Search gets its own separate, always fully round satellite circle beside the bar instead. Enabling it costs one regular tab: SettingsController.maxVisibleTabs is now a dynamic getter (defaultMaxVisibleTabs - 1 while the toggle is on) instead of the old flat constant, re-enforced immediately if the user already has all 5 slots filled - the same cleanup path used for a fresh install or an app update that added a new tab. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
52 lines
1.7 KiB
Dart
52 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:lucide_icons_flutter/lucide_icons.dart';
|
|
import '../models/app_tab.dart';
|
|
import 'noo/nav/noo_bottom_bar.dart';
|
|
|
|
/// Adapts the app's [AppTab] model onto [NooBottomBar]'s generic
|
|
/// [NooNavDestination] list, so `MainShellView` only deals in tabs and
|
|
/// doesn't need to import `noo/nav` itself. [selectedIndex] may be -1 (no
|
|
/// destination highlighted) when the shell is showing a tab opened from the
|
|
/// drawer's "More" list that isn't one of the pinned [tabs].
|
|
///
|
|
/// [onSearchTap] (from Settings' "Search in bottom bar") adds the Search
|
|
/// entry [NooBottomBar] itself knows how to place (row's last item when
|
|
/// attached, its own satellite when floating) - null leaves the bar
|
|
/// exactly as before.
|
|
class BottomNavBar extends StatelessWidget {
|
|
final NooNavStyle style;
|
|
final NooBottomBarStyle barStyle;
|
|
final List<AppTab> tabs;
|
|
final int selectedIndex;
|
|
final ValueChanged<int> onDestinationSelected;
|
|
final VoidCallback? onSearchTap;
|
|
|
|
const BottomNavBar({
|
|
super.key,
|
|
required this.style,
|
|
this.barStyle = NooBottomBarStyle.attached,
|
|
required this.tabs,
|
|
required this.selectedIndex,
|
|
required this.onDestinationSelected,
|
|
this.onSearchTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return NooBottomBar(
|
|
style: style,
|
|
barStyle: barStyle,
|
|
destinations: [
|
|
for (final tab in tabs)
|
|
NooNavDestination(icon: tab.icon, label: tab.label),
|
|
],
|
|
selectedIndex: selectedIndex,
|
|
onSelected: onDestinationSelected,
|
|
searchDestination: onSearchTap == null
|
|
? null
|
|
: const NooNavDestination(icon: LucideIcons.search, label: 'Search'),
|
|
onSearchTap: onSearchTap,
|
|
);
|
|
}
|
|
}
|