@@ -25,8 +25,8 @@ import 'model/product.dart';
2525import 'shopping_cart.dart' ;
2626
2727// These curves define the emphasized easing curve.
28- const Cubic _kAccelerateCurve = const Cubic (0.548 , 0.0 , 0.757 , 0.464 );
29- const Cubic _kDecelerateCurve = const Cubic (0.23 , 0.94 , 0.41 , 1.0 );
28+ const Cubic _kAccelerateCurve = Cubic (0.548 , 0.0 , 0.757 , 0.464 );
29+ const Cubic _kDecelerateCurve = Cubic (0.23 , 0.94 , 0.41 , 1.0 );
3030// The time at which the accelerate and decelerate curves switch off
3131const double _kPeakVelocityTime = 0.248210 ;
3232// Percent (as a decimal) of animation that should be completed at _peakVelocityTime
@@ -48,7 +48,7 @@ class ExpandingBottomSheet extends StatefulWidget {
4848 _ExpandingBottomSheetState createState () => _ExpandingBottomSheetState ();
4949
5050 static _ExpandingBottomSheetState of (BuildContext context,
51- {bool isNullOk: false }) {
51+ {bool isNullOk = false }) {
5252 assert (isNullOk != null );
5353 assert (context != null );
5454 final _ExpandingBottomSheetState result = context
@@ -115,8 +115,10 @@ double _getPeakPoint({double begin, double end}) {
115115 return begin + (end - begin) * _kPeakVelocityProgress;
116116}
117117
118- class _ExpandingBottomSheetState extends State <ExpandingBottomSheet > with TickerProviderStateMixin {
119- final GlobalKey _expandingBottomSheetKey = GlobalKey (debugLabel: 'Expanding bottom sheet' );
118+ class _ExpandingBottomSheetState extends State <ExpandingBottomSheet >
119+ with TickerProviderStateMixin {
120+ final GlobalKey _expandingBottomSheetKey =
121+ GlobalKey (debugLabel: 'Expanding bottom sheet' );
120122
121123 // The width of the Material, calculated by _widthFor() & based on the number
122124 // of products in the cart. 64.0 is the width when there are 0 products
@@ -163,7 +165,8 @@ class _ExpandingBottomSheetState extends State<ExpandingBottomSheet> with Ticker
163165 peak: _getPeakPoint (begin: _width, end: screenWidth),
164166 end: screenWidth,
165167 isForward: false ,
166- parent: CurvedAnimation (parent: _controller.view, curve: Interval (0.0 , 0.87 )),
168+ parent: CurvedAnimation (
169+ parent: _controller.view, curve: Interval (0.0 , 0.87 )),
167170 );
168171 }
169172 }
@@ -174,7 +177,8 @@ class _ExpandingBottomSheetState extends State<ExpandingBottomSheet> with Ticker
174177
175178 return _getEmphasizedEasingAnimation (
176179 begin: _kCartHeight,
177- peak: _kCartHeight + (screenHeight - _kCartHeight) * _kPeakVelocityProgress,
180+ peak: _kCartHeight +
181+ (screenHeight - _kCartHeight) * _kPeakVelocityProgress,
178182 end: screenHeight,
179183 isForward: true ,
180184 parent: _controller.view,
@@ -189,7 +193,8 @@ class _ExpandingBottomSheetState extends State<ExpandingBottomSheet> with Ticker
189193 parent: _controller.view,
190194 curve: Interval (0.434 , 1.0 , curve: Curves .linear), // not used
191195 // only the reverseCurve will be used
192- reverseCurve: Interval (0.434 , 1.0 , curve: Curves .fastOutSlowIn.flipped),
196+ reverseCurve:
197+ Interval (0.434 , 1.0 , curve: Curves .fastOutSlowIn.flipped),
193198 ),
194199 );
195200 }
@@ -259,7 +264,8 @@ class _ExpandingBottomSheetState extends State<ExpandingBottomSheet> with Ticker
259264 // Returns true if the cart is open or opening and false otherwise.
260265 bool get _isOpen {
261266 final AnimationStatus status = _controller.status;
262- return status == AnimationStatus .completed || status == AnimationStatus .forward;
267+ return status == AnimationStatus .completed ||
268+ status == AnimationStatus .forward;
263269 }
264270
265271 // Opens the ExpandingBottomSheet if it's closed, otherwise does nothing.
@@ -438,7 +444,8 @@ class _ProductThumbnailRowState extends State<ProductThumbnailRow> {
438444 super .initState ();
439445 _list = _ListModel (
440446 listKey: _listKey,
441- initialItems: ScopedModel .of <AppStateModel >(context).productsInCart.keys.toList (),
447+ initialItems:
448+ ScopedModel .of <AppStateModel >(context).productsInCart.keys.toList (),
442449 removedItemBuilder: _buildRemovedThumbnail,
443450 );
444451 _internalList = List <int >.from (_list.list);
@@ -451,12 +458,15 @@ class _ProductThumbnailRowState extends State<ProductThumbnailRow> {
451458 return product;
452459 }
453460
454- Widget _buildRemovedThumbnail (int item, BuildContext context, Animation <double > animation) {
461+ Widget _buildRemovedThumbnail (
462+ int item, BuildContext context, Animation <double > animation) {
455463 return ProductThumbnail (animation, animation, _productWithId (item));
456464 }
457465
458- Widget _buildThumbnail (BuildContext context, int index, Animation <double > animation) {
459- Animation <double > thumbnailSize = Tween <double >(begin: 0.8 , end: 1.0 ).animate (
466+ Widget _buildThumbnail (
467+ BuildContext context, int index, Animation <double > animation) {
468+ Animation <double > thumbnailSize =
469+ Tween <double >(begin: 0.8 , end: 1.0 ).animate (
460470 CurvedAnimation (
461471 curve: Interval (0.33 , 1.0 , curve: Curves .easeIn),
462472 parent: animation,
@@ -468,15 +478,17 @@ class _ProductThumbnailRowState extends State<ProductThumbnailRow> {
468478 parent: animation,
469479 );
470480
471- return ProductThumbnail (thumbnailSize, opacity, _productWithId (_list[index]));
481+ return ProductThumbnail (
482+ thumbnailSize, opacity, _productWithId (_list[index]));
472483 }
473484
474485 // If the lists are the same length, assume nothing has changed.
475486 // If the internalList is shorter than the ListModel, an item has been removed.
476487 // If the internalList is longer, then an item has been added.
477488 void _updateLists () {
478489 // Update _internalList based on the model
479- _internalList = ScopedModel .of <AppStateModel >(context).productsInCart.keys.toList ();
490+ _internalList =
491+ ScopedModel .of <AppStateModel >(context).productsInCart.keys.toList ();
480492 Set <int > internalSet = Set <int >.from (_internalList);
481493 Set <int > listSet = Set <int >.from (_list.list);
482494
@@ -550,9 +562,11 @@ class ExtraProductsNumber extends StatelessWidget {
550562 if (model.productsInCart.length > 3 ) {
551563 int numOverflowProducts = _calculateOverflow (model);
552564 // Maximum of 99 so padding doesn't get messy.
553- int displayedOverflowProducts = numOverflowProducts <= 99 ? numOverflowProducts : 99 ;
565+ int displayedOverflowProducts =
566+ numOverflowProducts <= 99 ? numOverflowProducts : 99 ;
554567 return Container (
555- child: Text ('+$displayedOverflowProducts ' ,
568+ child: Text (
569+ '+$displayedOverflowProducts ' ,
556570 style: Theme .of (context).primaryTextTheme.button,
557571 ),
558572 );
@@ -606,8 +620,8 @@ class ProductThumbnail extends StatelessWidget {
606620class _ListModel {
607621 _ListModel (
608622 {@required this .listKey,
609- @required this .removedItemBuilder,
610- Iterable <int > initialItems})
623+ @required this .removedItemBuilder,
624+ Iterable <int > initialItems})
611625 : assert (listKey != null ),
612626 assert (removedItemBuilder != null ),
613627 _items = List <int >.from (initialItems ?? < int > []);
@@ -637,7 +651,8 @@ class _ListModel {
637651 void _removeAt (int index) {
638652 final int removedItem = _items.removeAt (index);
639653 if (removedItem != null ) {
640- _animatedList.removeItem (index, (BuildContext context, Animation <double > animation) {
654+ _animatedList.removeItem (index,
655+ (BuildContext context, Animation <double > animation) {
641656 return removedItemBuilder (removedItem, context, animation);
642657 });
643658 }
0 commit comments