@@ -20,8 +20,8 @@ import 'login.dart';
20
20
21
21
const double _kFlingVelocity = 2.0 ;
22
22
23
- class _BackdropPanel extends StatelessWidget {
24
- const _BackdropPanel ({
23
+ class _FrontLayer extends StatelessWidget {
24
+ const _FrontLayer ({
25
25
Key key,
26
26
this .onTap,
27
27
this .child,
@@ -101,26 +101,26 @@ class _BackdropTitle extends AnimatedWidget {
101
101
102
102
/// Builds a Backdrop.
103
103
///
104
- /// A Backdrop widget has two panels , front and back. The front panel is shown
105
- /// by default, and slides down to show the back panel , from which a user
104
+ /// A Backdrop widget has two layers , front and back. The front layer is shown
105
+ /// by default, and slides down to show the back layer , from which a user
106
106
/// can make a selection. The user can also configure the titles for when the
107
- /// front or back panel is showing.
107
+ /// front or back layer is showing.
108
108
class Backdrop extends StatefulWidget {
109
109
final Category currentCategory;
110
- final Widget frontPanel ;
111
- final Widget backPanel ;
110
+ final Widget frontLayer ;
111
+ final Widget backLayer ;
112
112
final Widget frontTitle;
113
113
final Widget backTitle;
114
114
115
115
const Backdrop ({
116
116
@required this .currentCategory,
117
- @required this .frontPanel ,
118
- @required this .backPanel ,
117
+ @required this .frontLayer ,
118
+ @required this .backLayer ,
119
119
@required this .frontTitle,
120
120
@required this .backTitle,
121
121
}) : assert (currentCategory != null ),
122
- assert (frontPanel != null ),
123
- assert (backPanel != null ),
122
+ assert (frontLayer != null ),
123
+ assert (backLayer != null ),
124
124
assert (frontTitle != null ),
125
125
assert (backTitle != null );
126
126
@@ -150,9 +150,9 @@ class _BackdropState extends State<Backdrop>
150
150
setState (() {
151
151
_controller.fling (
152
152
velocity:
153
- _backdropPanelVisible ? - _kFlingVelocity : _kFlingVelocity);
153
+ _frontLayerVisible ? - _kFlingVelocity : _kFlingVelocity);
154
154
});
155
- } else if (! _backdropPanelVisible ) {
155
+ } else if (! _frontLayerVisible ) {
156
156
setState (() {
157
157
_controller.fling (velocity: _kFlingVelocity);
158
158
});
@@ -165,37 +165,38 @@ class _BackdropState extends State<Backdrop>
165
165
super .dispose ();
166
166
}
167
167
168
- bool get _backdropPanelVisible {
168
+ bool get _frontLayerVisible {
169
169
final AnimationStatus status = _controller.status;
170
170
return status == AnimationStatus .completed ||
171
171
status == AnimationStatus .forward;
172
172
}
173
173
174
- void _toggleBackdropPanelVisibility () {
174
+ void _toggleBackdropLayerVisibility () {
175
+ print (_frontLayerVisible);
175
176
_controller.fling (
176
- velocity: _backdropPanelVisible ? - _kFlingVelocity : _kFlingVelocity);
177
+ velocity: _frontLayerVisible ? - _kFlingVelocity : _kFlingVelocity);
177
178
}
178
179
179
180
Widget _buildStack (BuildContext context, BoxConstraints constraints) {
180
- const double panelTitleHeight = 48.0 ;
181
- final Size panelSize = constraints.biggest;
182
- final double panelTop = panelSize .height - panelTitleHeight ;
181
+ const double layerTitleHeight = 48.0 ;
182
+ final Size layerSize = constraints.biggest;
183
+ final double layerTop = layerSize .height - layerTitleHeight ;
183
184
184
- Animation <RelativeRect > panelAnimation = RelativeRectTween (
185
+ Animation <RelativeRect > layerAnimation = RelativeRectTween (
185
186
begin: RelativeRect .fromLTRB (
186
- 0.0 , panelTop , 0.0 , panelTop - panelSize .height),
187
+ 0.0 , layerTop , 0.0 , layerTop - layerSize .height),
187
188
end: RelativeRect .fromLTRB (0.0 , 0.0 , 0.0 , 0.0 ),
188
189
).animate (_controller.view);
189
190
190
191
return Stack (
191
192
key: _backdropKey,
192
193
children: < Widget > [
193
- widget.backPanel ,
194
+ widget.backLayer ,
194
195
PositionedTransition (
195
- rect: panelAnimation ,
196
- child: _BackdropPanel (
197
- onTap: _toggleBackdropPanelVisibility ,
198
- child: widget.frontPanel ,
196
+ rect: layerAnimation ,
197
+ child: _FrontLayer (
198
+ onTap: _toggleBackdropLayerVisibility ,
199
+ child: widget.frontLayer ,
199
200
),
200
201
),
201
202
],
0 commit comments