OLD | NEW |
1 part of widgets; | 1 part of widgets; |
2 | 2 |
3 const double _kWidth = 256.0; | 3 const double _kWidth = 256.0; |
4 const double _kMinFlingVelocity = 0.4; | 4 const double _kMinFlingVelocity = 0.4; |
5 const double _kBaseSettleDurationMS = 246.0; | 5 const double _kBaseSettleDurationMS = 246.0; |
6 const double _kMaxSettleDurationMS = 600.0; | 6 const double _kMaxSettleDurationMS = 600.0; |
7 const Cubic _kAnimationCurve = easeOut; | 7 const Cubic _kAnimationCurve = easeOut; |
8 | 8 |
9 class DrawerAnimation { | 9 class DrawerAnimation { |
10 | 10 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 return; | 145 return; |
146 | 146 |
147 _listening = true; | 147 _listening = true; |
148 animation.onPositionChanged.listen((position) { | 148 animation.onPositionChanged.listen((position) { |
149 setState(() { | 149 setState(() { |
150 _position = position; | 150 _position = position; |
151 }); | 151 }); |
152 }); | 152 }); |
153 } | 153 } |
154 | 154 |
155 Node render() { | 155 Node build() { |
156 _ensureListening(); | 156 _ensureListening(); |
157 | 157 |
158 bool isClosed = _position <= -_kWidth; | 158 bool isClosed = _position <= -_kWidth; |
159 String inlineStyle = 'display: ${isClosed ? 'none' : ''}'; | 159 String inlineStyle = 'display: ${isClosed ? 'none' : ''}'; |
160 String maskInlineStyle = 'opacity: ${(_position / _kWidth + 1) * 0.25}'; | 160 String maskInlineStyle = 'opacity: ${(_position / _kWidth + 1) * 0.25}'; |
161 String contentInlineStyle = 'transform: translateX(${_position}px)'; | 161 String contentInlineStyle = 'transform: translateX(${_position}px)'; |
162 | 162 |
163 Container mask = new Container( | 163 Container mask = new Container( |
164 key: 'Mask', | 164 key: 'Mask', |
165 style: _maskStyle, | 165 style: _maskStyle, |
(...skipping 12 matching lines...) Expand all Loading... |
178 style: _style, | 178 style: _style, |
179 inlineStyle: inlineStyle, | 179 inlineStyle: inlineStyle, |
180 children: [ mask, content ] | 180 children: [ mask, content ] |
181 )..events.listen('pointerdown', animation.handlePointerDown) | 181 )..events.listen('pointerdown', animation.handlePointerDown) |
182 ..events.listen('pointermove', animation.handlePointerMove) | 182 ..events.listen('pointermove', animation.handlePointerMove) |
183 ..events.listen('pointerup', animation.handlePointerUp) | 183 ..events.listen('pointerup', animation.handlePointerUp) |
184 ..events.listen('pointercancel', animation.handlePointerCancel); | 184 ..events.listen('pointercancel', animation.handlePointerCancel); |
185 | 185 |
186 } | 186 } |
187 } | 187 } |
OLD | NEW |