パッケージ、リポジトリ、アプリカテゴリを検索

playing_cards のカバー
パッケージ詳細v0.4.1+11

playing_cards

Flutterアプリで標準の52枚カードデッキをレンダリングするためのライブラリです。あまり手間をかけずに美しいトランプカードを表示したい場合は、このパッケージを使用してください。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
3
いいね数
145
Pub ポイント
150

パッケージをインストール

flutter pub add playing_cards

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Flutterパッケージで、アプリケーション内に視覚的に魅力的な標準の52枚カードデッキを簡単にレンダリングできます。ゲーム開発者向けに設計されており、適切なスタイルとレイアウトを持つ使いやすいカードウィジェットを提供し、大規模なカスタムコーディングなしにカードベースのUIを迅速に統合できるようにします。このライブラリは複数のプラットフォームをサポートしており、デバイス間で一貫性があり、高品質なカードビジュアルを保証しています。

用途

  • カードゲーム開発
  • インタラクティブデッキシミュレーション
  • カード付きの教育アプリ
  • デジタルポーカーまたはソリテアアプリ
  • カードを使用したUIプロトタイピング

主な機能

  • 事前構築されたカードウィジェット
  • クロスプラットフォーム対応
  • 高解像度カードデザイン
  • Flutterとの簡単な統合
  • カスタマイズ可能なカードレイアウト

適している対象

  • ゲーム開発者
  • UIデザイナー
  • 教育アプリの開発者
  • プロトタイピングチーム

注意事項

  • 標準の52枚カードデッキに限定
  • 組み込みのゲームロジックなし
  • カードのインタラクションを手動で処理する必要があります
  • 大規模なカードコレクションには最適化されていません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

playing_cards

The playing_cards package for Flutter allows you to easily render playing cards from a standard 52 card deck. Good defaults are provided out of box, but full customization is possible if a style object is provided.

Getting Started

Here's a quick video overview if you don't like reading :-) https://www.youtube.com/watch?v=f9tOu972nhI

To import:

import 'package:playing_cards/playing_cards.dart';

And here is a simple usage to render a nine of clubs:

PlayingCardView(card: PlayingCard(Suit.clubs, CardValue.nine))

Here is an example of a fully styled deck:

// This style object overrides the styles for spades.
PlayingCardViewStyle myCardStyles = PlayingCardViewStyle(suitStyles: {
  Suit.spades: SuitStyle(
    builder: (context) => FittedBox(
          fit: BoxFit.fitHeight,
          child: Text(
            "💩",
            style: TextStyle(fontSize: 500),
          ),
        ),
    style: TextStyle(color: Colors.brown),
    cardContentBuilders: {
      CardValue.jack: (context) =>
          Image.asset("assets/jack_of_spades.png"),
      CardValue.queen: (context) =>
          Image.asset("assets/queen_of_spades.png"),
      CardValue.king: (context) =>
          Image.asset("assets/king_of_spades.png"),
    })
});
List<PlayingCard> deck = standardFiftyTwoCardDeck();
Container(
  height: 150,
  child: SingleChildScrollView(
    scrollDirection: Axis.horizontal,
    child: Row(
      children: deck.map((e) => PlayingCardView(card: e, style: myCardStyles)).toList(),
    ),
  ),
),

PlayingCardViewStyle also accepts a suitBesideLabel: true option to render the suit next to the rank, instead of below:

A flat fan widget is also provided for the common use cases of fanning cards out horizontally:

ShapeBorder shape = RoundedRectangleBorder(
  borderRadius: BorderRadius.circular(8),
  side: BorderSide(color: Colors.black, width: 1));
FlatCardFan(children: [
  PlayingCardView(
    card: PlayingCard(Suit.hearts, CardValue.ace),
    showBack: true,
    elevation: 3.0,
    shape: shape),
  PlayingCardView(
      card: PlayingCard(Suit.hearts, CardValue.ace),
      showBack: true,
      elevation: 3.0,
      shape: shape),
  PlayingCardView(
      card: PlayingCard(Suit.hearts, CardValue.ace),
      showBack: true,
      elevation: 3.0,
      shape: shape),
  PlayingCardView(
      card: PlayingCard(Suit.hearts, CardValue.ace),
      elevation: 3.0,
      shape: shape)
])

Jokers

Jokers are modelled as two joker CardValues (joker_1, joker_2) in a single joker Suit.

You can use the standardFiftyFourCardDeck() function in deck.dart to create a deck with two Jokers.

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。