@@ -66,9 +66,11 @@ class _BackdropTitle extends AnimatedWidget {
66
66
Key key,
67
67
Listenable listenable,
68
68
this .customIcon,
69
- this .frontTitle,
70
- this .backTitle,
71
- }) : super (key: key, listenable: listenable);
69
+ @required this .frontTitle,
70
+ @required this .backTitle,
71
+ }) : assert (frontTitle != null ),
72
+ assert (backTitle != null ),
73
+ super (key: key, listenable: listenable);
72
74
73
75
@override
74
76
Widget build (BuildContext context) {
@@ -79,43 +81,41 @@ class _BackdropTitle extends AnimatedWidget {
79
81
rowContents.add (this .customIcon);
80
82
}
81
83
82
- if (this .frontTitle != null && this .backTitle != null ) {
83
- Animation <Offset > backSlide = new Tween <Offset >(
84
- begin: Offset (0.0 , 0.0 ),
85
- end: Offset (0.5 , 0.0 ),
86
- ).animate (animation);
87
- Animation <Offset > frontSlide = new Tween <Offset >(
88
- begin: Offset (- 0.25 , 0.0 ),
89
- end: Offset (0.0 , 0.0 ),
90
- ).animate (animation);
84
+ Animation <Offset > backSlide = new Tween <Offset >(
85
+ begin: Offset .zero,
86
+ end: Offset (0.5 , 0.0 ),
87
+ ).animate (animation);
88
+ Animation <Offset > frontSlide = new Tween <Offset >(
89
+ begin: Offset (- 0.25 , 0.0 ),
90
+ end: Offset .zero,
91
+ ).animate (animation);
91
92
92
- rowContents.add (Stack (
93
- // Here, we do a custom cross fade between backTitle and frontTitle.
94
- // This makes a smooth animation between the two texts.
95
- children: < Widget > [
96
- Opacity (
97
- opacity: CurvedAnimation (
98
- parent: ReverseAnimation (animation),
99
- curve: Interval (0.5 , 1.0 ),
100
- ).value,
101
- child: SlideTransition (
102
- position: backSlide,
103
- child: backTitle,
104
- ),
93
+ rowContents.add (Stack (
94
+ // Here, we do a custom cross fade between backTitle and frontTitle.
95
+ // This makes a smooth animation between the two texts.
96
+ children: < Widget > [
97
+ Opacity (
98
+ opacity: CurvedAnimation (
99
+ parent: ReverseAnimation (animation),
100
+ curve: Interval (0.5 , 1.0 ),
101
+ ).value,
102
+ child: SlideTransition (
103
+ position: backSlide,
104
+ child: backTitle,
105
105
),
106
- Opacity (
107
- opacity : CurvedAnimation (
108
- parent : animation,
109
- curve : Interval ( 0.5 , 1.0 ) ,
110
- ).value ,
111
- child : SlideTransition (
112
- position : frontSlide,
113
- child : frontTitle ,
114
- ) ,
106
+ ),
107
+ Opacity (
108
+ opacity : CurvedAnimation (
109
+ parent : animation ,
110
+ curve : Interval ( 0.5 , 1.0 ) ,
111
+ ).value,
112
+ child : SlideTransition (
113
+ position : frontSlide ,
114
+ child : frontTitle ,
115
115
),
116
- ] ,
117
- ));
118
- }
116
+ ) ,
117
+ ],
118
+ ));
119
119
120
120
return DefaultTextStyle (
121
121
style: Theme .of (context).primaryTextTheme.title,
@@ -176,8 +176,7 @@ class _BackdropState extends State<Backdrop>
176
176
if (widget.currentCategory != old.currentCategory) {
177
177
setState (() {
178
178
_controller.fling (
179
- velocity:
180
- _frontLayerVisible ? - _kFlingVelocity : _kFlingVelocity);
179
+ velocity: _frontLayerVisible ? - _kFlingVelocity : _kFlingVelocity);
181
180
});
182
181
} else if (! _frontLayerVisible) {
183
182
setState (() {
@@ -242,7 +241,7 @@ class _BackdropState extends State<Backdrop>
242
241
);
243
242
244
243
Animation <Offset > slide = new Tween <Offset >(
245
- begin: Offset ( 0.0 , 0.0 ) ,
244
+ begin: Offset .zero ,
246
245
end: Offset (1.0 , 0.0 ),
247
246
).animate (_controller.view);
248
247
var diamondIcon = SlideTransition (
@@ -252,7 +251,7 @@ class _BackdropState extends State<Backdrop>
252
251
width: 72.0 ,
253
252
child: IconButton (
254
253
padding: EdgeInsets .only (right: 8.0 ),
255
- onPressed: _toggleBackdropPanelVisibility ,
254
+ onPressed: _toggleBackdropLayerVisibility ,
256
255
icon: Stack (children: < Widget > [menuIcon, diamondIcon]),
257
256
),
258
257
);
0 commit comments