Skip to content

[104] Add branded icon menu nav animation #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
4736f4d
[101] Correcting widget class.
willlarche May 16, 2018
f35a5ee
[101] Complete code.
willlarche Apr 25, 2018
6a68899
[102] Minor copy correction.
willlarche Apr 26, 2018
4ff1bdd
[101] Update for Dart 2
willlarche May 7, 2018
cbdec91
[102] Complete code.
willlarche Apr 25, 2018
01a8917
[102] Correcting home being stateful.
willlarche Apr 27, 2018
f5089c4
[103] Correcting order of fields. (#10)
willlarche Apr 28, 2018
4e454e5
[102] Removing unneeded value.
willlarche Apr 30, 2018
ac5749b
[102] Dart 2.
willlarche May 7, 2018
5ebbe30
[102] Data correction.
willlarche May 8, 2018
fcefb2f
[103] Completed code.
willlarche Apr 26, 2018
b038b96
[103] Removing unneeded directory.
willlarche Apr 30, 2018
6261855
[103] Unused icons code.
willlarche Apr 30, 2018
cd0c5e3
[103] Moving supplemental files.
willlarche May 1, 2018
77b4eb9
[103] Using recent changes.
willlarche May 7, 2018
081fcb8
[103] Removing unused import.
willlarche May 7, 2018
76766c1
[103] Data correction.
willlarche May 8, 2018
330acb6
[103] Adding body2 styling.
willlarche May 8, 2018
ff206b7
[103] Dart 2
willlarche May 8, 2018
fa3c1af
[103] Color const correction.
willlarche May 11, 2018
d9c47a5
[103] Completed code.
willlarche Apr 26, 2018
fdbe581
[102] Complete code.
willlarche Apr 25, 2018
061d0da
[103] Correcting order of fields. (#10)
willlarche Apr 28, 2018
d17bcf4
[103] Completed code.
willlarche Apr 26, 2018
84ee656
[103] Using recent changes.
willlarche May 7, 2018
871d445
add backdrop and working menu with filtering
maryx May 7, 2018
8281cc2
[104] Minor visual changes.
willlarche May 7, 2018
322e4bc
[104] Visual detail.
willlarche May 7, 2018
1d44d1e
[104] Newline at EOF.
willlarche May 7, 2018
55474b5
[104] License stanzas.
willlarche May 7, 2018
8a48536
[104] Removing files from merge.
willlarche May 7, 2018
36e5157
[104] Sync.
willlarche May 7, 2018
f3d01c8
[104] Correcting license
willlarche May 8, 2018
4a00a80
[104] Adding license stanza
willlarche May 8, 2018
7389a02
[104] Decrease backdrop radius size to match mocks. (#21)
clocksmith May 16, 2018
aae57c9
[104] PR feedback.
willlarche May 16, 2018
24dfbdd
[104] Removing an unnecessary widget.
willlarche May 16, 2018
f775045
[104] Formatting.
willlarche May 16, 2018
d848b07
[104] Replaces regular hamburger menu behavior with a branded version…
clocksmith May 18, 2018
36a82d3
[104] Changing "Panel" to "Layer" (#24)
willlarche May 21, 2018
91ec150
Start to reconfigure the _BackdropTitle to handle custom transition a…
clocksmith May 21, 2018
d096aea
Added a customIcon to _BackdropTitle with the correct animations for …
clocksmith May 22, 2018
bb16b35
Added front and back title sliding to the branded icon animation.
clocksmith May 22, 2018
889869b
[104] Merge sync. (#27)
willlarche May 22, 2018
ae2df64
Start to reconfigure the _BackdropTitle to handle custom transition a…
clocksmith May 21, 2018
d4ff197
Added a customIcon to _BackdropTitle with the correct animations for …
clocksmith May 22, 2018
2a4a3dd
Added front and back title sliding to the branded icon animation.
clocksmith May 22, 2018
4e557d5
rebase?
clocksmith May 24, 2018
f412345
rebase fixes
clocksmith May 24, 2018
2a5f058
Responded to comments
clocksmith May 29, 2018
556a43a
mergre?
clocksmith May 29, 2018
807d459
merge fix
clocksmith May 29, 2018
bf2bc80
Rearranged the animations and used nested widgets instead of transiti…
clocksmith May 29, 2018
57358be
Fix bad rebase
clocksmith May 29, 2018
50a6f03
Respond to comments by replacing .animate with .evaluate
clocksmith May 29, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 65 additions & 45 deletions mdc_100_series/lib/backdrop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,43 +58,82 @@ class _FrontLayer extends StatelessWidget {
}

class _BackdropTitle extends AnimatedWidget {
final Function onPress;
final Widget frontTitle;
final Widget backTitle;

const _BackdropTitle({
Key key,
Listenable listenable,
this.frontTitle,
this.backTitle,
}) : super(key: key, listenable: listenable);
this.onPress,
@required this.frontTitle,
@required this.backTitle,
}) : assert(frontTitle != null),
assert(backTitle != null),
super(key: key, listenable: listenable);

@override
Widget build(BuildContext context) {
final Animation<double> animation = this.listenable;

return DefaultTextStyle(
style: Theme.of(context).primaryTextTheme.title,
softWrap: false,
overflow: TextOverflow.ellipsis,
// Here, we do a custom cross fade between backTitle and frontTitle.
// This makes a smooth animation between the two texts.
child: Stack(
children: <Widget>[
Opacity(
opacity: CurvedAnimation(
parent: ReverseAnimation(animation),
curve: Interval(0.5, 1.0),
).value,
child: backTitle,
),
Opacity(
opacity: CurvedAnimation(
parent: animation,
curve: Interval(0.5, 1.0),
).value,
child: frontTitle,
child: Row(children: <Widget>[
// branded icon
SizedBox(
width: 72.0,
child: IconButton(
padding: EdgeInsets.only(right: 8.0),
onPressed: this.onPress,
icon: Stack(children: <Widget>[
Opacity(
opacity: animation.value,
child: ImageIcon(AssetImage('assets/slanted_menu.png')),
),
FractionalTranslation(
translation: Tween<Offset>(
begin: Offset.zero,
end: Offset(1.0, 0.0),
).evaluate(animation),
child: ImageIcon(AssetImage('assets/diamond.png')),
)]),
),
],
),
),
// Here, we do a custom cross fade between backTitle and frontTitle.
// This makes a smooth animation between the two texts.
Stack(
children: <Widget>[
Opacity(
opacity: CurvedAnimation(
parent: ReverseAnimation(animation),
curve: Interval(0.5, 1.0),
).value,
child: FractionalTranslation(
translation: Tween<Offset>(
begin: Offset.zero,
end: Offset(0.5, 0.0),
).evaluate(animation),
child: backTitle,
),
),
Opacity(
opacity: CurvedAnimation(
parent: animation,
curve: Interval(0.5, 1.0),
).value,
child: FractionalTranslation(
translation: Tween<Offset>(
begin: Offset(-0.25, 0.0),
end: Offset.zero,
).evaluate(animation),
child: frontTitle,
),
),
],
)
]),
);
}
}
Expand Down Expand Up @@ -146,7 +185,7 @@ class _BackdropState extends State<Backdrop>
@override
void didUpdateWidget(Backdrop old) {
super.didUpdateWidget(old);

if (widget.currentCategory != old.currentCategory) {
_toggleBackdropLayerVisibility();
} else if (!_frontLayerVisible) {
Expand Down Expand Up @@ -199,34 +238,15 @@ class _BackdropState extends State<Backdrop>

@override
Widget build(BuildContext context) {
var brandedIcon = Row(children: <Widget>[
ImageIcon(AssetImage('assets/slanted_menu.png')),
ImageIcon(AssetImage('assets/diamond.png')),
]);

var appBar = AppBar(
brightness: Brightness.light,
elevation: 0.0,
titleSpacing: 0.0,
title: _BackdropTitle(
listenable: _controller.view,
frontTitle: Row(
children: <Widget>[
SizedBox(
width: 72.0,
child: IconButton(
padding: EdgeInsets.only(left: 20.0),
onPressed: _toggleBackdropLayerVisibility,
icon: brandedIcon,
),
),
widget.frontTitle,
],
),
backTitle: IconButton(
onPressed: _toggleBackdropLayerVisibility,
icon: Icon(Icons.close),
),
onPress: _toggleBackdropLayerVisibility,
frontTitle: widget.frontTitle,
backTitle: widget.backTitle,
),
actions: <Widget>[
new IconButton(
Expand Down