diff --git a/AUTHORS b/AUTHORS index e8063a8cd..3da7b5f40 100644 --- a/AUTHORS +++ b/AUTHORS @@ -4,3 +4,4 @@ # Name/Organization Google Inc. +Abhijeeth Padarthi diff --git a/jsonexample/lib/built_value/built_value_serializers.dart b/jsonexample/lib/built_value/built_value_serializers.dart index a3be0239e..71c80fc39 100644 --- a/jsonexample/lib/built_value/built_value_serializers.dart +++ b/jsonexample/lib/built_value/built_value_serializers.dart @@ -12,7 +12,7 @@ import 'package:jsonexample/built_value/built_simple_object.dart'; part 'built_value_serializers.g.dart'; -@SerializersFor(const [ +@SerializersFor([ BuiltSimpleObject, BuiltComplexObject, ]) diff --git a/jsonexample/lib/main.dart b/jsonexample/lib/main.dart index d466290b1..ca4be3ebd 100644 --- a/jsonexample/lib/main.dart +++ b/jsonexample/lib/main.dart @@ -46,7 +46,7 @@ class MyHomePage extends StatelessWidget { ], ), ), - body: new SafeArea( + body: SafeArea( bottom: false, child: TabBarView( children: [ diff --git a/jsonexample/lib/widgets.dart b/jsonexample/lib/widgets.dart index b1d819ab9..40bdde2a5 100644 --- a/jsonexample/lib/widgets.dart +++ b/jsonexample/lib/widgets.dart @@ -129,7 +129,7 @@ class ComplexObjectView extends StatelessWidget { if (simpleObjects == null) { return [ const Padding( - padding: const EdgeInsets.symmetric(vertical: 8.0), + padding: EdgeInsets.symmetric(vertical: 8.0), child: Text('NULL'), ), ]; @@ -138,7 +138,7 @@ class ComplexObjectView extends StatelessWidget { if (simpleObjects.length == 0) { return [ const Padding( - padding: const EdgeInsets.symmetric(vertical: 4.0), + padding: EdgeInsets.symmetric(vertical: 4.0), child: Text('[]'), ), ]; diff --git a/place_tracker/lib/place_map.dart b/place_tracker/lib/place_map.dart index 375f03bdb..5c6db4c5a 100644 --- a/place_tracker/lib/place_map.dart +++ b/place_tracker/lib/place_map.dart @@ -233,8 +233,8 @@ class PlaceMapState extends State { Scaffold.of(context).showSnackBar( SnackBar( duration: Duration(seconds: 3), - content: const Text('New place added.', - style: const TextStyle(fontSize: 16.0)), + content: + const Text('New place added.', style: TextStyle(fontSize: 16.0)), action: SnackBarAction( label: 'Edit', onPressed: () async { diff --git a/platform_view_swift/lib/main.dart b/platform_view_swift/lib/main.dart index 5f6a0eb45..5e5cfec7f 100644 --- a/platform_view_swift/lib/main.dart +++ b/platform_view_swift/lib/main.dart @@ -7,15 +7,15 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; void main() { - runApp(new PlatformView()); + runApp(PlatformView()); } class PlatformView extends StatelessWidget { @override Widget build(BuildContext context) { - return new MaterialApp( + return MaterialApp( title: 'Platform View', - theme: new ThemeData( + theme: ThemeData( primarySwatch: Colors.grey, ), home: const MyHomePage(title: 'Platform View'), @@ -29,12 +29,12 @@ class MyHomePage extends StatefulWidget { final String title; @override - _MyHomePageState createState() => new _MyHomePageState(); + _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State { static const MethodChannel _methodChannel = - const MethodChannel('samples.flutter.io/platform_view_swift'); + MethodChannel('samples.flutter.io/platform_view_swift'); int _counter = 0; @@ -53,25 +53,25 @@ class _MyHomePageState extends State { } @override - Widget build(BuildContext context) => new Scaffold( - appBar: new AppBar( - title: new Text(widget.title), + Widget build(BuildContext context) => Scaffold( + appBar: AppBar( + title: Text(widget.title), ), - body: new Column( + body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - new Expanded( - child: new Center( - child: new Column( + Expanded( + child: Center( + child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - new Text( + Text( 'Button tapped $_counter time${_counter == 1 ? '' : 's'}.', style: const TextStyle(fontSize: 17.0), ), - new Padding( + Padding( padding: const EdgeInsets.all(18.0), - child: new RaisedButton( + child: RaisedButton( child: const Text('Continue in iOS view'), onPressed: _launchPlatformCount), ), @@ -79,22 +79,21 @@ class _MyHomePageState extends State { ), ), ), - new Container( + Container( padding: const EdgeInsets.only(bottom: 15.0, left: 5.0), - child: new Row( + child: Row( children: [ - new Image.asset('assets/flutter-mark-square-64.png', - scale: 1.5), + Image.asset('assets/flutter-mark-square-64.png', scale: 1.5), const Text( 'Flutter', - style: const TextStyle(fontSize: 30.0), + style: TextStyle(fontSize: 30.0), ), ], ), ), ], ), - floatingActionButton: new FloatingActionButton( + floatingActionButton: FloatingActionButton( onPressed: _incrementCounter, tooltip: 'Increment', child: const Icon(Icons.add), diff --git a/shrine/lib/colors.dart b/shrine/lib/colors.dart index 04298a0bc..4af159310 100644 --- a/shrine/lib/colors.dart +++ b/shrine/lib/colors.dart @@ -14,15 +14,15 @@ import 'package:flutter/material.dart'; -const kShrinePink50 = const Color(0xFFFEEAE6); -const kShrinePink100 = const Color(0xFFFEDBD0); -const kShrinePink300 = const Color(0xFFFBB8AC); -const kShrinePink400 = const Color(0xFFEAA4A4); +const kShrinePink50 = Color(0xFFFEEAE6); +const kShrinePink100 = Color(0xFFFEDBD0); +const kShrinePink300 = Color(0xFFFBB8AC); +const kShrinePink400 = Color(0xFFEAA4A4); -const kShrineBrown900 = const Color(0xFF442B2D); -const kShrineBrown600 = const Color(0xFF7D4F52); +const kShrineBrown900 = Color(0xFF442B2D); +const kShrineBrown600 = Color(0xFF7D4F52); -const kShrineErrorRed = const Color(0xFFC5032B); +const kShrineErrorRed = Color(0xFFC5032B); -const kShrineSurfaceWhite = const Color(0xFFFFFBFA); +const kShrineSurfaceWhite = Color(0xFFFFFBFA); const kShrineBackgroundWhite = Colors.white; diff --git a/shrine/lib/expanding_bottom_sheet.dart b/shrine/lib/expanding_bottom_sheet.dart index ae0301bad..43849481f 100644 --- a/shrine/lib/expanding_bottom_sheet.dart +++ b/shrine/lib/expanding_bottom_sheet.dart @@ -25,8 +25,8 @@ import 'model/product.dart'; import 'shopping_cart.dart'; // These curves define the emphasized easing curve. -const Cubic _kAccelerateCurve = const Cubic(0.548, 0.0, 0.757, 0.464); -const Cubic _kDecelerateCurve = const Cubic(0.23, 0.94, 0.41, 1.0); +const Cubic _kAccelerateCurve = Cubic(0.548, 0.0, 0.757, 0.464); +const Cubic _kDecelerateCurve = Cubic(0.23, 0.94, 0.41, 1.0); // The time at which the accelerate and decelerate curves switch off const double _kPeakVelocityTime = 0.248210; // Percent (as a decimal) of animation that should be completed at _peakVelocityTime @@ -48,7 +48,7 @@ class ExpandingBottomSheet extends StatefulWidget { _ExpandingBottomSheetState createState() => _ExpandingBottomSheetState(); static _ExpandingBottomSheetState of(BuildContext context, - {bool isNullOk: false}) { + {bool isNullOk = false}) { assert(isNullOk != null); assert(context != null); final _ExpandingBottomSheetState result = context @@ -115,8 +115,10 @@ double _getPeakPoint({double begin, double end}) { return begin + (end - begin) * _kPeakVelocityProgress; } -class _ExpandingBottomSheetState extends State with TickerProviderStateMixin { - final GlobalKey _expandingBottomSheetKey = GlobalKey(debugLabel: 'Expanding bottom sheet'); +class _ExpandingBottomSheetState extends State + with TickerProviderStateMixin { + final GlobalKey _expandingBottomSheetKey = + GlobalKey(debugLabel: 'Expanding bottom sheet'); // The width of the Material, calculated by _widthFor() & based on the number // of products in the cart. 64.0 is the width when there are 0 products @@ -163,7 +165,8 @@ class _ExpandingBottomSheetState extends State with Ticker peak: _getPeakPoint(begin: _width, end: screenWidth), end: screenWidth, isForward: false, - parent: CurvedAnimation(parent: _controller.view, curve: Interval(0.0, 0.87)), + parent: CurvedAnimation( + parent: _controller.view, curve: Interval(0.0, 0.87)), ); } } @@ -174,7 +177,8 @@ class _ExpandingBottomSheetState extends State with Ticker return _getEmphasizedEasingAnimation( begin: _kCartHeight, - peak: _kCartHeight + (screenHeight - _kCartHeight) * _kPeakVelocityProgress, + peak: _kCartHeight + + (screenHeight - _kCartHeight) * _kPeakVelocityProgress, end: screenHeight, isForward: true, parent: _controller.view, @@ -189,7 +193,8 @@ class _ExpandingBottomSheetState extends State with Ticker parent: _controller.view, curve: Interval(0.434, 1.0, curve: Curves.linear), // not used // only the reverseCurve will be used - reverseCurve: Interval(0.434, 1.0, curve: Curves.fastOutSlowIn.flipped), + reverseCurve: + Interval(0.434, 1.0, curve: Curves.fastOutSlowIn.flipped), ), ); } @@ -259,7 +264,8 @@ class _ExpandingBottomSheetState extends State with Ticker // Returns true if the cart is open or opening and false otherwise. bool get _isOpen { final AnimationStatus status = _controller.status; - return status == AnimationStatus.completed || status == AnimationStatus.forward; + return status == AnimationStatus.completed || + status == AnimationStatus.forward; } // Opens the ExpandingBottomSheet if it's closed, otherwise does nothing. @@ -438,7 +444,8 @@ class _ProductThumbnailRowState extends State { super.initState(); _list = _ListModel( listKey: _listKey, - initialItems: ScopedModel.of(context).productsInCart.keys.toList(), + initialItems: + ScopedModel.of(context).productsInCart.keys.toList(), removedItemBuilder: _buildRemovedThumbnail, ); _internalList = List.from(_list.list); @@ -451,12 +458,15 @@ class _ProductThumbnailRowState extends State { return product; } - Widget _buildRemovedThumbnail(int item, BuildContext context, Animation animation) { + Widget _buildRemovedThumbnail( + int item, BuildContext context, Animation animation) { return ProductThumbnail(animation, animation, _productWithId(item)); } - Widget _buildThumbnail(BuildContext context, int index, Animation animation) { - Animation thumbnailSize = Tween(begin: 0.8, end: 1.0).animate( + Widget _buildThumbnail( + BuildContext context, int index, Animation animation) { + Animation thumbnailSize = + Tween(begin: 0.8, end: 1.0).animate( CurvedAnimation( curve: Interval(0.33, 1.0, curve: Curves.easeIn), parent: animation, @@ -468,7 +478,8 @@ class _ProductThumbnailRowState extends State { parent: animation, ); - return ProductThumbnail(thumbnailSize, opacity, _productWithId(_list[index])); + return ProductThumbnail( + thumbnailSize, opacity, _productWithId(_list[index])); } // If the lists are the same length, assume nothing has changed. @@ -476,7 +487,8 @@ class _ProductThumbnailRowState extends State { // If the internalList is longer, then an item has been added. void _updateLists() { // Update _internalList based on the model - _internalList = ScopedModel.of(context).productsInCart.keys.toList(); + _internalList = + ScopedModel.of(context).productsInCart.keys.toList(); Set internalSet = Set.from(_internalList); Set listSet = Set.from(_list.list); @@ -550,9 +562,11 @@ class ExtraProductsNumber extends StatelessWidget { if (model.productsInCart.length > 3) { int numOverflowProducts = _calculateOverflow(model); // Maximum of 99 so padding doesn't get messy. - int displayedOverflowProducts = numOverflowProducts <= 99 ? numOverflowProducts : 99; + int displayedOverflowProducts = + numOverflowProducts <= 99 ? numOverflowProducts : 99; return Container( - child: Text('+$displayedOverflowProducts', + child: Text( + '+$displayedOverflowProducts', style: Theme.of(context).primaryTextTheme.button, ), ); @@ -606,8 +620,8 @@ class ProductThumbnail extends StatelessWidget { class _ListModel { _ListModel( {@required this.listKey, - @required this.removedItemBuilder, - Iterable initialItems}) + @required this.removedItemBuilder, + Iterable initialItems}) : assert(listKey != null), assert(removedItemBuilder != null), _items = List.from(initialItems ?? []); @@ -637,7 +651,8 @@ class _ListModel { void _removeAt(int index) { final int removedItem = _items.removeAt(index); if (removedItem != null) { - _animatedList.removeItem(index, (BuildContext context, Animation animation) { + _animatedList.removeItem(index, + (BuildContext context, Animation animation) { return removedItemBuilder(removedItem, context, animation); }); } diff --git a/shrine/lib/home.dart b/shrine/lib/home.dart index 9772e7cfa..c251ba256 100644 --- a/shrine/lib/home.dart +++ b/shrine/lib/home.dart @@ -24,7 +24,7 @@ import 'supplemental/asymmetric_view.dart'; class ProductPage extends StatelessWidget { final Category category; - const ProductPage({this.category: Category.all}); + const ProductPage({this.category = Category.all}); @override Widget build(BuildContext context) { @@ -41,11 +41,8 @@ class HomePage extends StatelessWidget { final ExpandingBottomSheet expandingBottomSheet; final Backdrop backdrop; - const HomePage({ - Key key, - this.expandingBottomSheet, - this.backdrop - }) : super(key: key); + const HomePage({Key key, this.expandingBottomSheet, this.backdrop}) + : super(key: key); @override Widget build(BuildContext context) { diff --git a/shrine/lib/shopping_cart.dart b/shrine/lib/shopping_cart.dart index e5d825ed1..48274b13e 100644 --- a/shrine/lib/shopping_cart.dart +++ b/shrine/lib/shopping_cart.dart @@ -63,8 +63,8 @@ class _ShoppingCartPageState extends State { width: _leftColumnWidth, child: IconButton( icon: const Icon(Icons.keyboard_arrow_down), - onPressed: () => ExpandingBottomSheet.of(context).close() - ), + onPressed: () => + ExpandingBottomSheet.of(context).close()), ), Text( 'CART', diff --git a/shrine/lib/supplemental/cut_corners_border.dart b/shrine/lib/supplemental/cut_corners_border.dart index 6837a0992..af7ab94e1 100644 --- a/shrine/lib/supplemental/cut_corners_border.dart +++ b/shrine/lib/supplemental/cut_corners_border.dart @@ -19,10 +19,10 @@ import 'package:flutter/widgets.dart'; class CutCornersBorder extends OutlineInputBorder { const CutCornersBorder({ - BorderSide borderSide: const BorderSide(), - BorderRadius borderRadius: const BorderRadius.all(Radius.circular(2.0)), - this.cut: 7.0, - double gapPadding: 2.0, + BorderSide borderSide = const BorderSide(), + BorderRadius borderRadius = const BorderRadius.all(Radius.circular(2.0)), + this.cut = 7.0, + double gapPadding = 2.0, }) : super( borderSide: borderSide, borderRadius: borderRadius, @@ -104,8 +104,8 @@ class CutCornersBorder extends OutlineInputBorder { Canvas canvas, Rect rect, { double gapStart, - double gapExtent: 0.0, - double gapPercentage: 0.0, + double gapExtent = 0.0, + double gapPercentage = 0.0, TextDirection textDirection, }) { assert(gapExtent != null); diff --git a/shrine/lib/supplemental/product_card.dart b/shrine/lib/supplemental/product_card.dart index 5a2f04ccd..40f59c225 100644 --- a/shrine/lib/supplemental/product_card.dart +++ b/shrine/lib/supplemental/product_card.dart @@ -20,7 +20,7 @@ import '../model/app_state_model.dart'; import '../model/product.dart'; class ProductCard extends StatelessWidget { - ProductCard({this.imageAspectRatio: 33 / 49, this.product}) + ProductCard({this.imageAspectRatio = 33 / 49, this.product}) : assert(imageAspectRatio == null || imageAspectRatio > 0); final double imageAspectRatio; diff --git a/veggieseasons/lib/screens/list.dart b/veggieseasons/lib/screens/list.dart index 9efc72274..8fda02916 100644 --- a/veggieseasons/lib/screens/list.dart +++ b/veggieseasons/lib/screens/list.dart @@ -14,7 +14,7 @@ import 'package:veggieseasons/widgets/veggie_card.dart'; class ListScreen extends StatelessWidget { List _generateVeggieRows(List veggies, Preferences prefs) { - final cards = new List(); + final cards = List(); for (Veggie veggie in veggies) { cards.add(Padding( diff --git a/veggieseasons/lib/styles.dart b/veggieseasons/lib/styles.dart index 46082da83..8941cdf4c 100644 --- a/veggieseasons/lib/styles.dart +++ b/veggieseasons/lib/styles.dart @@ -118,7 +118,7 @@ abstract class Styles { Season.autumn: Color(0xff724913), }; - static const seasonBorder = const Border( + static const seasonBorder = Border( top: BorderSide(color: Color(0xff606060)), left: BorderSide(color: Color(0xff606060)), bottom: BorderSide(color: Color(0xff606060)), diff --git a/veggieseasons/lib/widgets/close_button.dart b/veggieseasons/lib/widgets/close_button.dart index 9f1b48825..5c42a5ea1 100644 --- a/veggieseasons/lib/widgets/close_button.dart +++ b/veggieseasons/lib/widgets/close_button.dart @@ -86,7 +86,7 @@ class CloseButton extends StatefulWidget { @override CloseButtonState createState() { - return new CloseButtonState(); + return CloseButtonState(); } } diff --git a/veggieseasons/lib/widgets/settings_item.dart b/veggieseasons/lib/widgets/settings_item.dart index 4ce9b3a93..4af93fe9e 100644 --- a/veggieseasons/lib/widgets/settings_item.dart +++ b/veggieseasons/lib/widgets/settings_item.dart @@ -13,7 +13,7 @@ import 'package:veggieseasons/styles.dart'; // // See https://github.com/flutter/flutter/projects/29 for more info. -typedef FutureOr SettingsItemCallback(); +typedef SettingsItemCallback = FutureOr Function(); class SettingsNavigationIndicator extends StatelessWidget { const SettingsNavigationIndicator({Key key}) : super(key: key); @@ -77,7 +77,7 @@ class SettingsItem extends StatefulWidget { final SettingsItemCallback onPress; @override - State createState() => new SettingsItemState(); + State createState() => SettingsItemState(); } class SettingsItemState extends State {