Skip to content

Instantly share code, notes, and snippets.

View d3xvn's full-sized avatar
:octocat:
Fluttering away the hours

Deven Joshi d3xvn

:octocat:
Fluttering away the hours
View GitHub Profile
import 'package:flutter/material.dart';
enum CardSuit {
spades,
hearts,
diamonds,
clubs,
}
enum CardType {
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
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;
import 'package:flutter/material.dart';
class DemoPage extends StatefulWidget {
@override
_DemoPageState createState() => _DemoPageState();
}
class _DemoPageState extends State<DemoPage> {
@override
Widget build(BuildContext context) {
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',
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(
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);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Animation Demo"),
),
body: Center(
child: Container(
height: sizeAnimation.value,
width: sizeAnimation.value,
// In initState
controller.addListener(() {
setState(() {});
});
colorAnimation = ColorTween(begin: Colors.blue, end: Colors.yellow).animate(CurvedAnimation(parent: controller, curve: Curves.bounceOut));