-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,193 additions
and
1,086 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,47 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
Widget getControlsView( | ||
GlobalKey key, | ||
BoxConstraints constraints, | ||
Widget? child, | ||
) { | ||
return AnimatedSize( | ||
key: key, | ||
duration: const Duration(milliseconds: 300), | ||
curve: Curves.easeOutQuint, | ||
child: AnimatedSwitcher( | ||
switchInCurve: Curves.easeOutQuint, | ||
// switchOutCurve: Curves.easeInSine, | ||
transitionBuilder: (Widget newChild, Animation<double> animation) { | ||
// Don't transition widgets animating out | ||
// as this causes issues with the crop page | ||
if (newChild != child) return Container(); | ||
class SlyControlsView extends StatelessWidget { | ||
final GlobalKey globalKey; | ||
final bool wideLayout; | ||
final Widget? child; | ||
|
||
return SlideTransition( | ||
key: ValueKey<Key?>(newChild.key), | ||
position: Tween<Offset>( | ||
begin: (constraints.maxWidth > 600) | ||
? const Offset(0.07, 0.0) | ||
: const Offset(0.0, 0.07), | ||
end: Offset.zero, | ||
).animate(animation), | ||
child: FadeTransition( | ||
key: ValueKey<Key?>(newChild.key), | ||
opacity: animation, | ||
child: newChild, | ||
), | ||
); | ||
}, | ||
duration: const Duration(milliseconds: 150), | ||
child: child, | ||
), | ||
); | ||
const SlyControlsView({ | ||
super.key, | ||
required this.globalKey, | ||
required this.wideLayout, | ||
this.child, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) => AnimatedSize( | ||
key: key, | ||
duration: const Duration(milliseconds: 300), | ||
curve: Curves.easeOutQuint, | ||
child: AnimatedSwitcher( | ||
switchInCurve: Curves.easeOutQuint, | ||
// switchOutCurve: Curves.easeInSine, | ||
transitionBuilder: (Widget newChild, Animation<double> animation) { | ||
// Don't transition widgets animating out | ||
// as this causes issues with the crop page | ||
if (newChild != child) return Container(); | ||
|
||
return SlideTransition( | ||
key: ValueKey<Key?>(newChild.key), | ||
position: Tween<Offset>( | ||
begin: (wideLayout) | ||
? const Offset(0.07, 0.0) | ||
: const Offset(0.0, 0.07), | ||
end: Offset.zero, | ||
).animate(animation), | ||
child: FadeTransition( | ||
key: ValueKey<Key?>(newChild.key), | ||
opacity: animation, | ||
child: newChild, | ||
), | ||
); | ||
}, | ||
duration: const Duration(milliseconds: 150), | ||
child: child, | ||
), | ||
); | ||
} |
Oops, something went wrong.