diff --git a/lib/cards_section_alignment.dart b/lib/cards_section_alignment.dart index 7dc84b7..7f6e352 100644 --- a/lib/cards_section_alignment.dart +++ b/lib/cards_section_alignment.dart @@ -2,168 +2,156 @@ import 'package:flutter/material.dart'; import 'profile_card_alignment.dart'; import 'dart:math'; -List cardsAlign = [ new Alignment(0.0, 1.0), new Alignment(0.0, 0.8), new Alignment(0.0, 0.0) ]; -List cardsSize = new List(3); - -class CardsSectionAlignment extends StatefulWidget -{ - CardsSectionAlignment(BuildContext context) - { - cardsSize[0] = new Size(MediaQuery.of(context).size.width * 0.9, MediaQuery.of(context).size.height * 0.6); - cardsSize[1] = new Size(MediaQuery.of(context).size.width * 0.85, MediaQuery.of(context).size.height * 0.55); - cardsSize[2] = new Size(MediaQuery.of(context).size.width * 0.8, MediaQuery.of(context).size.height * 0.5); +List cardsAlign = [ + Alignment(0.0, 1.0), + Alignment(0.0, 0.8), + Alignment(0.0, 0.0) +]; +List cardsSize = List(3); + +class CardsSectionAlignment extends StatefulWidget { + CardsSectionAlignment(BuildContext context) { + cardsSize[0] = Size(MediaQuery.of(context).size.width * 0.9, + MediaQuery.of(context).size.height * 0.6); + cardsSize[1] = Size(MediaQuery.of(context).size.width * 0.85, + MediaQuery.of(context).size.height * 0.55); + cardsSize[2] = Size(MediaQuery.of(context).size.width * 0.8, + MediaQuery.of(context).size.height * 0.5); } @override - _CardsSectionState createState() => new _CardsSectionState(); + _CardsSectionState createState() => _CardsSectionState(); } -class _CardsSectionState extends State with SingleTickerProviderStateMixin -{ +class _CardsSectionState extends State + with SingleTickerProviderStateMixin { int cardsCounter = 0; - List cards = new List(); + List cards = List(); AnimationController _controller; - final Alignment defaultFrontCardAlign = new Alignment(0.0, 0.0); + final Alignment defaultFrontCardAlign = Alignment(0.0, 0.0); Alignment frontCardAlign; double frontCardRot = 0.0; @override - void initState() - { + void initState() { super.initState(); // Init cards - for (cardsCounter = 0; cardsCounter < 3; cardsCounter++) - { - cards.add(new ProfileCardAlignment(cardsCounter)); + for (cardsCounter = 0; cardsCounter < 3; cardsCounter++) { + cards.add(ProfileCardAlignment(cardsCounter)); } frontCardAlign = cardsAlign[2]; // Init the animation controller - _controller = new AnimationController(duration: new Duration(milliseconds: 700), vsync: this); + _controller = + AnimationController(duration: Duration(milliseconds: 700), vsync: this); _controller.addListener(() => setState(() {})); - _controller.addStatusListener((AnimationStatus status) - { - if(status == AnimationStatus.completed) changeCardsOrder(); + _controller.addStatusListener((AnimationStatus status) { + if (status == AnimationStatus.completed) changeCardsOrder(); }); } @override - Widget build(BuildContext context) - { - return new Expanded - ( - child: new Stack - ( - children: - [ - backCard(), - middleCard(), - frontCard(), - - // Prevent swiping if the cards are animating - _controller.status != AnimationStatus.forward ? new SizedBox.expand - ( - child: new GestureDetector - ( - // While dragging the first card - onPanUpdate: (DragUpdateDetails details) - { - // Add what the user swiped in the last frame to the alignment of the card - setState(() - { - // 20 is the "speed" at which moves the card - frontCardAlign = new Alignment - ( - frontCardAlign.x + 20 * details.delta.dx / MediaQuery.of(context).size.width, - frontCardAlign.y + 40 * details.delta.dy / MediaQuery.of(context).size.height - ); - - frontCardRot = frontCardAlign.x; // * rotation speed; - }); - }, - // When releasing the first card - onPanEnd: (_) - { - // If the front card was swiped far enough to count as swiped - if(frontCardAlign.x > 3.0 || frontCardAlign.x < -3.0) - { - animateCards(); - } - else - { - // Return to the initial rotation and alignment - setState(() - { - frontCardAlign = defaultFrontCardAlign; - frontCardRot = 0.0; + Widget build(BuildContext context) { + return Expanded( + child: Stack( + children: [ + backCard(), + middleCard(), + frontCard(), + + // Prevent swiping if the cards are animating + _controller.status != AnimationStatus.forward + ? SizedBox.expand( + child: GestureDetector( + // While dragging the first card + onPanUpdate: (DragUpdateDetails details) { + // Add what the user swiped in the last frame to the alignment of the card + setState(() { + // 20 is the "speed" at which moves the card + frontCardAlign = Alignment( + frontCardAlign.x + + 20 * + details.delta.dx / + MediaQuery.of(context).size.width, + frontCardAlign.y + + 40 * + details.delta.dy / + MediaQuery.of(context).size.height); + + frontCardRot = frontCardAlign.x; // * rotation speed; }); - } - }, - ) - ) : new Container(), - ], - ) - ); + }, + // When releasing the first card + onPanEnd: (_) { + // If the front card was swiped far enough to count as swiped + if (frontCardAlign.x > 3.0 || frontCardAlign.x < -3.0) { + animateCards(); + } else { + // Return to the initial rotation and alignment + setState(() { + frontCardAlign = defaultFrontCardAlign; + frontCardRot = 0.0; + }); + } + }, + )) + : Container(), + ], + )); } - Widget backCard() - { - return new Align - ( - alignment: _controller.status == AnimationStatus.forward ? CardsAnimation.backCardAlignmentAnim(_controller).value : cardsAlign[0], - child: new SizedBox.fromSize - ( - size: _controller.status == AnimationStatus.forward ? CardsAnimation.backCardSizeAnim(_controller).value : cardsSize[2], - child: cards[2] - ), + Widget backCard() { + return Align( + alignment: _controller.status == AnimationStatus.forward + ? CardsAnimation.backCardAlignmentAnim(_controller).value + : cardsAlign[0], + child: SizedBox.fromSize( + size: _controller.status == AnimationStatus.forward + ? CardsAnimation.backCardSizeAnim(_controller).value + : cardsSize[2], + child: cards[2]), ); } - Widget middleCard() - { - return new Align - ( - alignment: _controller.status == AnimationStatus.forward ? CardsAnimation.middleCardAlignmentAnim(_controller).value : cardsAlign[1], - child: new SizedBox.fromSize - ( - size: _controller.status == AnimationStatus.forward ? CardsAnimation.middleCardSizeAnim(_controller).value : cardsSize[1], - child: cards[1] - ), + Widget middleCard() { + return Align( + alignment: _controller.status == AnimationStatus.forward + ? CardsAnimation.middleCardAlignmentAnim(_controller).value + : cardsAlign[1], + child: SizedBox.fromSize( + size: _controller.status == AnimationStatus.forward + ? CardsAnimation.middleCardSizeAnim(_controller).value + : cardsSize[1], + child: cards[1]), ); } - Widget frontCard() - { - return new Align - ( - alignment: _controller.status == AnimationStatus.forward ? CardsAnimation.frontCardDisappearAlignmentAnim(_controller, frontCardAlign).value : frontCardAlign, - child: new Transform.rotate - ( - angle: (pi / 180.0) * frontCardRot, - child: new SizedBox.fromSize - ( - size: cardsSize[0], - child: cards[0] - ), - ) - ); + Widget frontCard() { + return Align( + alignment: _controller.status == AnimationStatus.forward + ? CardsAnimation.frontCardDisappearAlignmentAnim( + _controller, frontCardAlign) + .value + : frontCardAlign, + child: Transform.rotate( + angle: (pi / 180.0) * frontCardRot, + child: SizedBox.fromSize(size: cardsSize[0], child: cards[0]), + )); } - void changeCardsOrder() - { - setState(() - { - // Swap cards (back card becomes the middle card; middle card becomes the front card, front card becomes a new bottom card) + void changeCardsOrder() { + setState(() { + // Swap cards (back card becomes the middle card; middle card becomes the front card, front card becomes a bottom card) var temp = cards[0]; cards[0] = cards[1]; cards[1] = cards[2]; cards[2] = temp; - cards[2] = new ProfileCardAlignment(cardsCounter); + cards[2] = ProfileCardAlignment(cardsCounter); cardsCounter++; frontCardAlign = defaultFrontCardAlign; @@ -171,93 +159,49 @@ class _CardsSectionState extends State with SingleTickerP }); } - void animateCards() - { + void animateCards() { _controller.stop(); _controller.value = 0.0; _controller.forward(); } } -class CardsAnimation -{ - static Animation backCardAlignmentAnim(AnimationController parent) - { - return new AlignmentTween - ( - begin: cardsAlign[0], - end: cardsAlign[1] - ).animate - ( - new CurvedAnimation - ( - parent: parent, - curve: new Interval(0.4, 0.7, curve: Curves.easeIn) - ) - ); +class CardsAnimation { + static Animation backCardAlignmentAnim( + AnimationController parent) { + return AlignmentTween(begin: cardsAlign[0], end: cardsAlign[1]).animate( + CurvedAnimation( + parent: parent, curve: Interval(0.4, 0.7, curve: Curves.easeIn))); } - static Animation backCardSizeAnim(AnimationController parent) - { - return new SizeTween - ( - begin: cardsSize[2], - end: cardsSize[1] - ).animate - ( - new CurvedAnimation - ( - parent: parent, - curve: new Interval(0.4, 0.7, curve: Curves.easeIn) - ) - ); + static Animation backCardSizeAnim(AnimationController parent) { + return SizeTween(begin: cardsSize[2], end: cardsSize[1]).animate( + CurvedAnimation( + parent: parent, curve: Interval(0.4, 0.7, curve: Curves.easeIn))); } - static Animation middleCardAlignmentAnim(AnimationController parent) - { - return new AlignmentTween - ( - begin: cardsAlign[1], - end: cardsAlign[2] - ).animate - ( - new CurvedAnimation - ( - parent: parent, - curve: new Interval(0.2, 0.5, curve: Curves.easeIn) - ) - ); + static Animation middleCardAlignmentAnim( + AnimationController parent) { + return AlignmentTween(begin: cardsAlign[1], end: cardsAlign[2]).animate( + CurvedAnimation( + parent: parent, curve: Interval(0.2, 0.5, curve: Curves.easeIn))); } - static Animation middleCardSizeAnim(AnimationController parent) - { - return new SizeTween - ( - begin: cardsSize[1], - end: cardsSize[0] - ).animate - ( - new CurvedAnimation - ( - parent: parent, - curve: new Interval(0.2, 0.5, curve: Curves.easeIn) - ) - ); + static Animation middleCardSizeAnim(AnimationController parent) { + return SizeTween(begin: cardsSize[1], end: cardsSize[0]).animate( + CurvedAnimation( + parent: parent, curve: Interval(0.2, 0.5, curve: Curves.easeIn))); } - static Animation frontCardDisappearAlignmentAnim(AnimationController parent, Alignment beginAlign) - { - return new AlignmentTween - ( - begin: beginAlign, - end: new Alignment(beginAlign.x > 0 ? beginAlign.x + 30.0 : beginAlign.x - 30.0, 0.0) // Has swiped to the left or right? - ).animate - ( - new CurvedAnimation - ( - parent: parent, - curve: new Interval(0.0, 0.5, curve: Curves.easeIn) - ) - ); + static Animation frontCardDisappearAlignmentAnim( + AnimationController parent, Alignment beginAlign) { + return AlignmentTween( + begin: beginAlign, + end: Alignment( + beginAlign.x > 0 ? beginAlign.x + 30.0 : beginAlign.x - 30.0, + 0.0) // Has swiped to the left or right? + ) + .animate(CurvedAnimation( + parent: parent, curve: Interval(0.0, 0.5, curve: Curves.easeIn))); } } diff --git a/lib/cards_section_draggable.dart b/lib/cards_section_draggable.dart index 7bd0808..7c8bd83 100644 --- a/lib/cards_section_draggable.dart +++ b/lib/cards_section_draggable.dart @@ -1,135 +1,109 @@ import 'package:flutter/material.dart'; import 'profile_card_draggable.dart'; -class CardsSectionDraggable extends StatefulWidget -{ +class CardsSectionDraggable extends StatefulWidget { @override - _CardsSectionState createState() => new _CardsSectionState(); + _CardsSectionState createState() => _CardsSectionState(); } -class _CardsSectionState extends State -{ +class _CardsSectionState extends State { bool dragOverTarget = false; - List cards = new List(); + List cards = List(); int cardsCounter = 0; @override - void initState() - { + void initState() { super.initState(); - for (cardsCounter = 0; cardsCounter < 3; cardsCounter++) - { - cards.add(new ProfileCardDraggable(cardsCounter)); + for (cardsCounter = 0; cardsCounter < 3; cardsCounter++) { + cards.add(ProfileCardDraggable(cardsCounter)); } } @override - Widget build(BuildContext context) - { - return new Expanded - ( - child: new Stack - ( - children: - [ - // Drag target row - new Row - ( - mainAxisSize: MainAxisSize.max, - children: - [ - dragTarget(), - new Flexible - ( - flex: 2, - child: new Container() - ), - dragTarget() - ], - ), - // Back card - new Align - ( - alignment: new Alignment(0.0, 1.0), - child: new IgnorePointer(child: new SizedBox.fromSize - ( - size: new Size(MediaQuery.of(context).size.width * 0.8, MediaQuery.of(context).size.height * 0.5), - child: cards[2], - )), - ), - // Middle card - new Align - ( - alignment: new Alignment(0.0, 0.8), - child: new IgnorePointer(child: new SizedBox.fromSize - ( - size: new Size(MediaQuery.of(context).size.width * 0.85, MediaQuery.of(context).size.height * 0.55), - child: cards[1], - )), - ), - // Front card - new Align - ( - alignment: new Alignment(0.0, 0.0), - child: new Draggable - ( - feedback: new SizedBox.fromSize - ( - size: new Size(MediaQuery.of(context).size.width * 0.9, MediaQuery.of(context).size.height * 0.6), - child: cards[0], - ), - child: new SizedBox.fromSize - ( - size: new Size(MediaQuery.of(context).size.width * 0.9, MediaQuery.of(context).size.height * 0.6), - child: cards[0], - ), - childWhenDragging: new Container(), + Widget build(BuildContext context) { + return Expanded( + child: Stack( + children: [ + // Drag target row + Row( + mainAxisSize: MainAxisSize.max, + children: [ + dragTarget(), + Flexible(flex: 2, child: Container()), + dragTarget() + ], + ), + // Back card + Align( + alignment: Alignment(0.0, 1.0), + child: IgnorePointer( + child: SizedBox.fromSize( + size: Size(MediaQuery.of(context).size.width * 0.8, + MediaQuery.of(context).size.height * 0.5), + child: cards[2], + )), + ), + // Middle card + Align( + alignment: Alignment(0.0, 0.8), + child: IgnorePointer( + child: SizedBox.fromSize( + size: Size(MediaQuery.of(context).size.width * 0.85, + MediaQuery.of(context).size.height * 0.55), + child: cards[1], + )), + ), + // Front card + Align( + alignment: Alignment(0.0, 0.0), + child: Draggable( + feedback: SizedBox.fromSize( + size: Size(MediaQuery.of(context).size.width * 0.9, + MediaQuery.of(context).size.height * 0.6), + child: cards[0], ), + child: SizedBox.fromSize( + size: Size(MediaQuery.of(context).size.width * 0.9, + MediaQuery.of(context).size.height * 0.6), + child: cards[0], + ), + childWhenDragging: Container(), ), - ], - ) - ); + ), + ], + )); } - void changeCardsOrder() - { - setState(() - { + void changeCardsOrder() { + setState(() { // Swap cards var temp = cards[0]; cards[0] = cards[1]; cards[1] = cards[2]; cards[2] = temp; - cards[2] = new ProfileCardDraggable(cardsCounter); + cards[2] = ProfileCardDraggable(cardsCounter); cardsCounter++; }); } - Widget dragTarget() - { - return new Flexible - ( + Widget dragTarget() { + return Flexible( flex: 1, - child: new DragTarget - ( - builder: (_, __, ___) - { - return new Container(); - }, - onWillAccept: (_) - { - setState(() => dragOverTarget = true); - return true; - }, - onAccept: (_) - { - changeCardsOrder(); - setState(() => dragOverTarget = false); - }, - onLeave: (_) => setState(() => dragOverTarget = false) - ), + child: DragTarget( + builder: (_, __, ___) { + return Container(); + }, + onWillAccept: (_) { + setState(() => dragOverTarget = true); + return true; + }, + onAccept: (_) { + changeCardsOrder(); + setState(() => dragOverTarget = false); + }, + onLeave: (_) => setState(() => dragOverTarget = false)), ); } -} \ No newline at end of file +} diff --git a/lib/main.dart b/lib/main.dart index 090fd03..e4ce4e4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,17 +1,15 @@ import 'package:flutter/material.dart'; import 'swipe_feed_page.dart'; -void main() => runApp(new MyApp()); -class MyApp extends StatelessWidget -{ +void main() => runApp(MyApp()); + +class MyApp extends StatelessWidget { @override - Widget build(BuildContext context) - { - return new MaterialApp - ( + Widget build(BuildContext context) { + return MaterialApp( title: 'Tinder cards demo', - theme: new ThemeData(primarySwatch: Colors.blue), - home: new SwipeFeedPage(), + theme: ThemeData(primarySwatch: Colors.blue), + home: SwipeFeedPage(), ); } -} \ No newline at end of file +} diff --git a/lib/profile_card_alignment.dart b/lib/profile_card_alignment.dart index d6d02e6..2ac6ae5 100644 --- a/lib/profile_card_alignment.dart +++ b/lib/profile_card_alignment.dart @@ -1,63 +1,51 @@ import 'package:flutter/material.dart'; -class ProfileCardAlignment extends StatelessWidget -{ +class ProfileCardAlignment extends StatelessWidget { final int cardNum; ProfileCardAlignment(this.cardNum); @override - Widget build(BuildContext context) - { - return new Card - ( - child: new Stack - ( - children: - [ - new SizedBox.expand - ( - child: new Material - ( - borderRadius: new BorderRadius.circular(12.0), - child: new Image.asset('res/portrait.jpeg', fit: BoxFit.cover), + Widget build(BuildContext context) { + return Card( + child: Stack( + children: [ + SizedBox.expand( + child: Material( + borderRadius: BorderRadius.circular(12.0), + child: Image.asset('res/portrait.jpeg', fit: BoxFit.cover), ), ), - new SizedBox.expand - ( - child: new Container - ( - decoration: new BoxDecoration - ( - gradient: new LinearGradient - ( - colors: [ Colors.transparent, Colors.black54 ], - begin: Alignment.center, - end: Alignment.bottomCenter - ) - ), + SizedBox.expand( + child: Container( + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Colors.transparent, Colors.black54], + begin: Alignment.center, + end: Alignment.bottomCenter)), ), ), - new Align - ( + Align( alignment: Alignment.bottomLeft, - child: new Container - ( - padding: new EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0), - child: new Column - ( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.start, - children: - [ - new Text('Card number $cardNum', style: new TextStyle(color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.w700)), - new Padding(padding: new EdgeInsets.only(bottom: 8.0)), - new Text('A short description.', textAlign: TextAlign.start, style: new TextStyle(color: Colors.white)), - ], - ) - ), + child: Container( + padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Card number $cardNum', + style: TextStyle( + color: Colors.white, + fontSize: 20.0, + fontWeight: FontWeight.w700)), + Padding(padding: EdgeInsets.only(bottom: 8.0)), + Text('A short description.', + textAlign: TextAlign.start, + style: TextStyle(color: Colors.white)), + ], + )), ) ], ), ); } -} \ No newline at end of file +} diff --git a/lib/profile_card_draggable.dart b/lib/profile_card_draggable.dart index 58a12a8..5a02051 100644 --- a/lib/profile_card_draggable.dart +++ b/lib/profile_card_draggable.dart @@ -1,41 +1,33 @@ import 'package:flutter/material.dart'; -class ProfileCardDraggable extends StatelessWidget -{ +class ProfileCardDraggable extends StatelessWidget { final int cardNum; ProfileCardDraggable(this.cardNum); @override - Widget build(BuildContext context) - { - return new Card - ( - child: new Column - ( + Widget build(BuildContext context) { + return Card( + child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, - children: - [ - new Expanded - ( - child: new Image.asset('res/portrait.jpeg', fit: BoxFit.cover), + children: [ + Expanded( + child: Image.asset('res/portrait.jpeg', fit: BoxFit.cover), ), - new Container - ( - padding: new EdgeInsets.symmetric(vertical: 32.0, horizontal: 16.0), - child: new Column - ( - crossAxisAlignment: CrossAxisAlignment.start, - children: - [ - new Text('Card number $cardNum', style: new TextStyle(fontSize: 20.0, fontWeight: FontWeight.w700)), - new Padding(padding: new EdgeInsets.only(bottom: 8.0)), - new Text('A short description.', textAlign: TextAlign.start), - ], - ) - ) + Container( + padding: EdgeInsets.symmetric(vertical: 32.0, horizontal: 16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Card number $cardNum', + style: TextStyle( + fontSize: 20.0, fontWeight: FontWeight.w700)), + Padding(padding: EdgeInsets.only(bottom: 8.0)), + Text('A short description.', textAlign: TextAlign.start), + ], + )) ], ), ); } -} \ No newline at end of file +} diff --git a/lib/swipe_feed_page.dart b/lib/swipe_feed_page.dart index 75d4a19..16db807 100644 --- a/lib/swipe_feed_page.dart +++ b/lib/swipe_feed_page.dart @@ -2,100 +2,80 @@ import 'package:flutter/material.dart'; import 'cards_section_alignment.dart'; import 'cards_section_draggable.dart'; -class SwipeFeedPage extends StatefulWidget -{ +class SwipeFeedPage extends StatefulWidget { @override - _SwipeFeedPageState createState() => new _SwipeFeedPageState(); + _SwipeFeedPageState createState() => _SwipeFeedPageState(); } -class _SwipeFeedPageState extends State -{ +class _SwipeFeedPageState extends State { bool showAlignmentCards = false; - + @override - Widget build(BuildContext context) - { - return new Scaffold - ( - appBar: new AppBar - ( + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( elevation: 0.0, centerTitle: true, backgroundColor: Colors.white, - leading: new IconButton - ( - onPressed: () {}, - icon: new Icon(Icons.settings, color: Colors.grey) - ), - title: new Switch - ( - onChanged: (bool newValue) => setState(() => showAlignmentCards = newValue), + leading: IconButton( + onPressed: () {}, icon: Icon(Icons.settings, color: Colors.grey)), + title: Switch( + onChanged: (bool value) => setState(() => showAlignmentCards = value), value: showAlignmentCards, activeColor: Colors.red, ), - actions: - [ - new IconButton - ( - onPressed: () {}, - icon: new Icon(Icons.question_answer, color: Colors.grey) - ), + actions: [ + IconButton( + onPressed: () {}, + icon: Icon(Icons.question_answer, color: Colors.grey)), ], ), backgroundColor: Colors.white, - body: new Column - ( - children: - [ - showAlignmentCards ? new CardsSectionAlignment(context) : new CardsSectionDraggable(), + body: Column( + children: [ + showAlignmentCards + ? CardsSectionAlignment(context) + : CardsSectionDraggable(), buttonsRow() ], ), ); } - Widget buttonsRow() - { - return new Container - ( - margin: new EdgeInsets.symmetric(vertical: 48.0), - child: new Row - ( + Widget buttonsRow() { + return Container( + margin: EdgeInsets.symmetric(vertical: 48.0), + child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, - children: - [ - new FloatingActionButton - ( + children: [ + FloatingActionButton( mini: true, onPressed: () {}, backgroundColor: Colors.white, - child: new Icon(Icons.loop, color: Colors.yellow), + child: Icon(Icons.loop, color: Colors.yellow), ), - new Padding(padding: new EdgeInsets.only(right: 8.0)), - new FloatingActionButton - ( + Padding(padding: EdgeInsets.only(right: 8.0)), + FloatingActionButton( onPressed: () {}, backgroundColor: Colors.white, - child: new Icon(Icons.close, color: Colors.red), + child: Icon(Icons.close, color: Colors.red), ), - new Padding(padding: new EdgeInsets.only(right: 8.0)), - new FloatingActionButton - ( + Padding(padding: EdgeInsets.only(right: 8.0)), + FloatingActionButton( onPressed: () {}, backgroundColor: Colors.white, - child: new Icon(Icons.favorite, color: Colors.green), + child: Icon(Icons.favorite, color: Colors.green), ), - new Padding(padding: new EdgeInsets.only(right: 8.0)), - new FloatingActionButton - ( + Padding(padding: EdgeInsets.only(right: 8.0)), + FloatingActionButton( mini: true, onPressed: () {}, backgroundColor: Colors.white, - child: new Icon(Icons.star, color: Colors.blue), + child: Icon(Icons.star, color: Colors.blue), ), ], ), ); } -} \ No newline at end of file +}