This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
enum CardSuit { | |
spades, | |
hearts, | |
diamonds, | |
clubs, | |
} | |
enum CardType { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:solitaire_flutter/playing_card.dart'; | |
import 'package:solitaire_flutter/transformed_card.dart'; | |
typedef Null CardAcceptCallback(List<PlayingCard> card, int fromIndex); | |
// This is a stack of overlayed cards (implemented using a stack) | |
class CardColumn extends StatefulWidget { | |
// List of cards in the stack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:solitaire_flutter/card_column.dart'; | |
import 'package:solitaire_flutter/playing_card.dart'; | |
import 'package:solitaire_flutter/transformed_card.dart'; | |
// The deck of cards which accept the final cards (Ace to King) | |
class EmptyCardDeck extends StatefulWidget { | |
final CardSuit cardSuit; | |
final List<PlayingCard> cardsAdded; | |
final CardAcceptCallback onCardAdded; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class DemoPage extends StatefulWidget { | |
@override | |
_DemoPageState createState() => _DemoPageState(); | |
} | |
class _DemoPageState extends State<DemoPage> { | |
@override | |
Widget build(BuildContext context) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
// This widget is the root of your application. | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
// This widget is the root of your application. | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AnimationController controller; | |
Animation colorAnimation; | |
Animation sizeAnimation; | |
@override | |
void initState() { | |
super.initState(); | |
controller = AnimationController(vsync: this, duration: Duration(seconds: 2)); | |
colorAnimation = ColorTween(begin: Colors.blue, end: Colors.yellow).animate(controller); | |
sizeAnimation = Tween<double>(begin: 100.0, end: 200.0).animate(controller); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text("Animation Demo"), | |
), | |
body: Center( | |
child: Container( | |
height: sizeAnimation.value, | |
width: sizeAnimation.value, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In initState | |
controller.addListener(() { | |
setState(() {}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
colorAnimation = ColorTween(begin: Colors.blue, end: Colors.yellow).animate(CurvedAnimation(parent: controller, curve: Curves.bounceOut)); |