Skip to content

Instantly share code, notes, and snippets.

@deven98
Created January 19, 2019 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deven98/6c11ef8e330cc4b65097738a60b141ea to your computer and use it in GitHub Desktop.
Save deven98/6c11ef8e330cc4b65097738a60b141ea to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
enum CardSuit {
spades,
hearts,
diamonds,
clubs,
}
enum CardType {
one,
two,
three,
four,
five,
six,
seven,
eight,
nine,
ten,
jack,
queen,
king
}
enum CardColor {
red,
black,
}
// Simple playing card model
class PlayingCard {
CardSuit cardSuit;
CardType cardType;
bool faceUp;
bool opened;
PlayingCard({
@required this.cardSuit,
@required this.cardType,
this.faceUp = false,
this.opened = false,
});
CardColor get cardColor {
if(cardSuit == CardSuit.hearts || cardSuit == CardSuit.diamonds) {
return CardColor.red;
} else {
return CardColor.black;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment