Skip to content

Commit

Permalink
Prevent clipping by size transition
Browse files Browse the repository at this point in the history
  • Loading branch information
jb3rndt committed Apr 9, 2024
1 parent 4fdc4ea commit c45c859
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions lib/components/persistent_tab_view_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,8 @@ class _PersistentTabViewScaffoldState extends State<PersistentTabViewScaffold>
)),
),
),
bottomNavigationBar: SizeTransition(
bottomNavigationBar: NCSizeTransition(
sizeFactor: _animation,
axisAlignment: -1,
child: Padding(
padding: widget.margin,
child: MediaQuery(
Expand Down Expand Up @@ -576,3 +575,22 @@ class _TabSwitchingViewState extends State<_TabSwitchingView>
child: _buildScreens(),
);
}

class NCSizeTransition extends AnimatedWidget {
const NCSizeTransition({
required Animation<double> sizeFactor,
super.key,
this.child,
}) : super(listenable: sizeFactor);

Animation<double> get sizeFactor => listenable as Animation<double>;

final Widget? child;

@override
Widget build(BuildContext context) => Align(
alignment: Alignment.topCenter,
heightFactor: max(sizeFactor.value, 0),
child: child,
);
}

0 comments on commit c45c859

Please sign in to comment.