@@ -68,9 +68,9 @@ class BottomNavPageGroup extends StatefulWidget {
68
68
69
69
class _BottomNavPageGroupState extends State <BottomNavPageGroup > {
70
70
late List <MenuItem > menuItems;
71
- Widget ? fab;
72
- FloatingAlignment floatingAlignment = FloatingAlignment .none;
71
+ FloatingAlignment floatingAlignment = FloatingAlignment .center;
73
72
int ? floatingMargin;
73
+ MenuItem ? fabMenuItem;
74
74
75
75
@override
76
76
void initState () {
@@ -85,26 +85,41 @@ class _BottomNavPageGroupState extends State<BottomNavPageGroup> {
85
85
throw LanguageError ('There should be only one floating nav bar item' );
86
86
}
87
87
if (fabItems.isNotEmpty) {
88
- final fabMenuItem = fabItems.first;
89
- floatingMargin = fabMenuItem.floatingMargin;
90
- final dynamic customIcon = _buildCustomIcon (fabMenuItem);
91
- fab = Theme (
88
+ fabMenuItem = fabItems.first;
89
+ }
90
+ if (fabMenuItem != null && fabMenuItem? .floatingAlignment != null ) {
91
+ floatingAlignment =
92
+ FloatingAlignment .values.byName (fabMenuItem! .floatingAlignment);
93
+ }
94
+ }
95
+
96
+ Widget ? _buildFloatingButton () {
97
+ if (fabMenuItem != null ) {
98
+ floatingMargin = fabMenuItem! .floatingMargin;
99
+ final dynamic customIcon = _buildCustomIcon (fabMenuItem! );
100
+
101
+ final floatingItemColor =
102
+ Utils .getColor (widget.menu.styles? ['floatingIconColor' ]) ??
103
+ Theme .of (context).colorScheme.onSecondary;
104
+ final floatingBackgroundColor =
105
+ Utils .getColor (widget.menu.styles? ['floatingBackgroundColor' ]) ??
106
+ Theme .of (context).colorScheme.secondary;
107
+
108
+ return Theme (
92
109
data: ThemeData (useMaterial3: false ),
93
110
child: customIcon ??
94
111
FloatingActionButton (
112
+ backgroundColor: floatingBackgroundColor,
95
113
child: ensemble.Icon (
96
- fabMenuItem.icon ?? '' ,
97
- library: fabMenuItem.iconLibrary,
98
- color: Colors .white ,
114
+ fabMenuItem! .icon ?? '' ,
115
+ library: fabMenuItem! .iconLibrary,
116
+ color: floatingItemColor ,
99
117
),
100
- onPressed: () => _floatingButtonTapped (fabMenuItem),
118
+ onPressed: () => _floatingButtonTapped (fabMenuItem! ),
101
119
),
102
120
);
103
- if (fab != null ) {
104
- floatingAlignment =
105
- FloatingAlignment .values.byName (fabMenuItem.floatingAlignment);
106
- }
107
121
}
122
+ return null ;
108
123
}
109
124
110
125
void _floatingButtonTapped (MenuItem fabMenuItem) {
@@ -123,8 +138,7 @@ class _BottomNavPageGroupState extends State<BottomNavPageGroup> {
123
138
floatingActionButtonLocation: floatingAlignment == FloatingAlignment .none
124
139
? null
125
140
: floatingAlignment.location,
126
- floatingActionButton:
127
- floatingAlignment == FloatingAlignment .none ? null : fab,
141
+ floatingActionButton: _buildFloatingButton (),
128
142
body: PageGroupWidget (
129
143
scopeManager: widget.scopeManager,
130
144
child: widget.child,
@@ -135,6 +149,12 @@ class _BottomNavPageGroupState extends State<BottomNavPageGroup> {
135
149
EnsembleBottomAppBar ? _buildBottomNavBar () {
136
150
List <FABBottomAppBarItem > navItems = [];
137
151
152
+ final unselectedColor = Utils .getColor (widget.menu.styles? ['color' ]) ??
153
+ Theme .of (context).unselectedWidgetColor;
154
+ final selectedColor =
155
+ Utils .getColor (widget.menu.styles? ['selectedColor' ]) ??
156
+ Theme .of (context).primaryColor;
157
+
138
158
// final menu = widget.menu;
139
159
for (int i = 0 ; i < menuItems.length; i++ ) {
140
160
MenuItem item = menuItems[i];
@@ -148,13 +168,13 @@ class _BottomNavPageGroupState extends State<BottomNavPageGroup> {
148
168
ensemble.Icon (
149
169
item.activeIcon ?? item.icon,
150
170
library: item.iconLibrary,
151
- color: Colors .white ,
171
+ color: selectedColor ,
152
172
);
153
173
final icon = customIcon ??
154
174
ensemble.Icon (
155
175
item.icon ?? '' ,
156
176
library: item.iconLibrary,
157
- color: Colors .white60 ,
177
+ color: unselectedColor ,
158
178
);
159
179
navItems.add (
160
180
FABBottomAppBarItem (
@@ -169,8 +189,8 @@ class _BottomNavPageGroupState extends State<BottomNavPageGroup> {
169
189
return EnsembleBottomAppBar (
170
190
backgroundColor: Utils .getColor (widget.menu.styles? ['backgroundColor' ]) ??
171
191
Colors .white,
172
- color: Colors .white60 ,
173
- selectedColor: Colors .white ,
192
+ color: unselectedColor ,
193
+ selectedColor: selectedColor ,
174
194
notchedShape: const CircularNotchedRectangle (),
175
195
onTabSelected: widget.onTabSelected,
176
196
items: navItems,
@@ -197,7 +217,7 @@ class EnsembleBottomAppBar extends StatefulWidget {
197
217
EnsembleBottomAppBar ({
198
218
super .key,
199
219
required this .items,
200
- this .height = 80 .0 ,
220
+ this .height = 70 .0 ,
201
221
this .iconSize = 24.0 ,
202
222
required this .backgroundColor,
203
223
required this .color,
@@ -316,6 +336,7 @@ class EnsembleBottomAppBarState extends State<EnsembleBottomAppBar> {
316
336
child: Material (
317
337
type: MaterialType .transparency,
318
338
child: InkWell (
339
+ customBorder: const CircleBorder (),
319
340
onTap: () => onPressed (index),
320
341
child: item.isCustom
321
342
? icon
0 commit comments