Skip to content

Commit

Permalink
Fix navigation bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Pante committed Sep 4, 2024
1 parent 061af6f commit e1a2902
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 63 deletions.
76 changes: 38 additions & 38 deletions forui/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,45 +30,45 @@ class _ApplicationState extends State<Application> {
Widget build(BuildContext context) => MaterialApp(
builder: (context, child) => FTheme(
data: FThemes.zinc.light,
child: FScaffold(
header: FHeader(
title: const Text('Example'),
actions: [
FHeaderAction(
icon: FAssets.icons.plus,
onPress: () {},
),
],
),
content: child!,
footer: FBottomNavigationBar(
index: index,
onChange: (index) => setState(() => this.index = index),
children: [
FBottomNavigationBarItem(
icon: FAssets.icons.home,
label: 'Home',
),
FBottomNavigationBarItem(
icon: FAssets.icons.layoutGrid,
label: 'Categories',
),
FBottomNavigationBarItem(
icon: FAssets.icons.search,
label: 'Search',
),
FBottomNavigationBarItem(
icon: FAssets.icons.settings,
label: 'Settings',
),
FBottomNavigationBarItem(
icon: FAssets.icons.castle,
label: 'Sandbox',
),
],
),
child: child!,
),
home: FScaffold(
header: FHeader(
title: const Text('Example'),
actions: [
FHeaderAction(
icon: FAssets.icons.plus,
onPress: () {},
),
],
),
content: _pages[index],
footer: FBottomNavigationBar(
index: index,
onChange: (index) => setState(() => this.index = index),
children: [
FBottomNavigationBarItem(
icon: FAssets.icons.home,
label: 'Home',
),
FBottomNavigationBarItem(
icon: FAssets.icons.layoutGrid,
label: 'Categories',
),
FBottomNavigationBarItem(
icon: FAssets.icons.search,
label: 'Search',
),
FBottomNavigationBarItem(
icon: FAssets.icons.settings,
label: 'Settings',
),
FBottomNavigationBarItem(
icon: FAssets.icons.castle,
label: 'Sandbox',
),
],
),
),
home: _pages[index],
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class FBottomNavigationBarData extends InheritedWidget {
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty('style', itemStyle))
..add(DiagnosticsProperty('itemStyle', itemStyle))
..add(FlagProperty('selected', value: selected, ifTrue: 'selected'));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';

import 'package:meta/meta.dart';

import 'package:forui/forui.dart';
Expand Down Expand Up @@ -30,32 +29,27 @@ class FBottomNavigationBarItem extends StatelessWidget {
final style = this.style ?? itemStyle;

return Semantics(
button: true,
selected: selected,
label: label,
excludeSemantics: true,
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: Padding(
padding: style.padding,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
icon(
height: style.iconSize,
colorFilter: ColorFilter.mode(
selected ? style.activeIconColor : style.inactiveIconColor,
BlendMode.srcIn,
),
),
const SizedBox(height: 2),
Text(
label,
overflow: TextOverflow.ellipsis,
style: selected ? style.activeTextStyle : style.inactiveTextStyle,
child: Padding(
padding: style.padding,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
icon(
height: style.iconSize,
colorFilter: ColorFilter.mode(
selected ? style.activeIconColor : style.inactiveIconColor,
BlendMode.srcIn,
),
],
),
),
const SizedBox(height: 2),
Text(
label,
overflow: TextOverflow.ellipsis,
style: selected ? style.activeTextStyle : style.inactiveTextStyle,
),
],
),
),
);
Expand Down

0 comments on commit e1a2902

Please sign in to comment.