Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
leoafarias committed Aug 6, 2024
1 parent 1dad9dd commit c702c1a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class SplitView extends HookWidget {

@override
Widget build(BuildContext context) {
final slides = useSlides();
final navigation = useNavigation();

final animationController = useAnimationController(
Expand Down
42 changes: 28 additions & 14 deletions packages/superdeck/lib/components/organisms/app_shell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ class ScaffoldWithNavBar extends HookWidget {
bindings: bindings,
child: Scaffold(
bottomNavigationBar: null,
extendBodyBehindAppBar: true,
extendBody: true,
appBar: AppBar(
backgroundColor: Colors.transparent,
surfaceTintColor: Colors.transparent,
toolbarOpacity: animation,
actions: [
IconButton(
onPressed: () {},
Expand Down Expand Up @@ -153,17 +158,16 @@ class ScaffoldWithNavBar extends HookWidget {
child: const Icon(Icons.menu),
),
),
body: isSmall
? navigationShell
: Row(
children: [
_SizeTransition(
sizeFactor: animation,
child: navigationRail,
),
Expanded(child: navigationShell),
],
),
body: Row(
children: [
_SizeTransition(
sizeFactor: animation,
direction: Axis.horizontal,
child: navigationRail,
),
Expanded(child: navigationShell),
],
),
),
);
}
Expand All @@ -173,19 +177,29 @@ class _SizeTransition extends StatelessWidget {
const _SizeTransition({
required this.sizeFactor,
this.child,
this.direction = Axis.horizontal,
});

final double sizeFactor;
final Axis direction;

final Widget? child;

@override
Widget build(BuildContext context) {
AlignmentDirectional alignment;
if (direction == Axis.horizontal) {
alignment = const AlignmentDirectional(0.0, -1.0);
} else {
alignment = const AlignmentDirectional(-1.0, 0.0);
}
return ClipRect(
child: Align(
alignment: const AlignmentDirectional(0.0, -1.0),
heightFactor: null,
widthFactor: math.max(sizeFactor, 0.0),
alignment: alignment,
heightFactor:
direction == Axis.vertical ? math.max(sizeFactor, 0.0) : 1.0,
widthFactor:
direction == Axis.horizontal ? math.max(sizeFactor, 0.0) : 1.0,
child: child,
),
);
Expand Down

0 comments on commit c702c1a

Please sign in to comment.