Skip to content

Commit c150aa4

Browse files
committed
update navbar hide offset
1 parent fd0cad8 commit c150aa4

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

example/lib/main.dart

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -418,12 +418,10 @@ class FeedTile extends StatelessWidget {
418418
Container(
419419
padding: const EdgeInsets.symmetric(horizontal: 8.0),
420420
alignment: Alignment.center,
421-
child: const Flexible(
422-
child: Text(
423-
placeHolderText,
424-
maxLines: 4,
425-
overflow: TextOverflow.ellipsis,
426-
),
421+
child: const Text(
422+
placeHolderText,
423+
maxLines: 4,
424+
overflow: TextOverflow.ellipsis,
427425
))
428426
],
429427
),

lib/src/animated_navbar.dart

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,15 @@ class _AnimatedNavBarState extends State<_AnimatedNavBar>
9494
}
9595

9696
void setUpAnimation() {
97-
double offset = 75.0;
97+
double offset = kNavbarHeight * 2;
9898
if (widget.isDesktop) {
9999
if (widget.decoration!.isExtended) {
100100
offset = widget.decoration!.minExtendedWidth;
101101
} else {
102102
offset = widget.decoration!.minWidth;
103103
}
104+
} else {
105+
offset += (widget.decoration!.margin?.vertical ?? 0) / 2;
104106
}
105107
animation = Tween(begin: 0.0, end: offset).animate(_controller);
106108
}
@@ -312,8 +314,9 @@ class _AnimatedNavBarState extends State<_AnimatedNavBar>
312314
indicatorColor: widget.decoration!.indicatorColor ??
313315
theme.colorScheme.secondaryContainer,
314316
labelBehavior: NavigationDestinationLabelBehavior.alwaysShow,
315-
indicatorShape: widget.decoration!.indicatorShape,
316-
margin: widget.decoration!.margin,
317+
indicatorShape: widget.decoration!.indicatorShape ??
318+
defaultDecoration.indicatorShape,
319+
margin: widget.decoration!.margin ?? defaultDecoration.margin,
317320
showSelectedLabels: widget.decoration?.showSelectedLabels,
318321
selectedLabelTextStyle:
319322
widget.decoration!.selectedLabelTextStyle ??
@@ -339,7 +342,7 @@ class _AnimatedNavBarState extends State<_AnimatedNavBar>
339342
items: widget.menuItems,
340343
onTap: widget.onItemTapped,
341344
borderRadius: widget.decoration!.borderRadius,
342-
margin: widget.decoration!.margin,
345+
margin: widget.decoration!.margin ?? defaultDecoration.margin,
343346
navBarElevation: defaultDecoration.elevation,
344347
);
345348
}
@@ -1018,8 +1021,8 @@ class FloatingNavbarState extends State<FloatingNavbar> {
10181021
backgroundColor: widget.decoration.backgroundColor ??
10191022
Theme.of(context).colorScheme.surface,
10201023
elevation: widget.elevation,
1021-
labelTextStyle: WidgetStateProperty.all(
1022-
widget.decoration.selectedLabelTextStyle),
1024+
labelTextStyle:
1025+
WidgetStateProperty.all(widget.decoration.selectedLabelTextStyle),
10231026
indicatorShape: widget.decoration.indicatorShape ??
10241027
RoundedRectangleBorder(borderRadius: BorderRadius.circular(18.0)),
10251028
iconTheme:

0 commit comments

Comments
 (0)