diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index 1e81926..2e7371f 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -1,41 +1,39 @@ name: web on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - - name: Install flutter - uses: subosito/flutter-action@v1.5.3 - with: - # The Flutter version to make available on the path - flutter-version: '3.0.5' - - - run: flutter pub get - - - run: flutter build web - - - name: Archive Production Artifact - uses: actions/upload-artifact@master - with: - name: web-build - path: build/web - - - name: Download Artifact - uses: actions/download-artifact@master - with: - name: web-build - - - name: Deploy to Github Pages - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./build/web - cname: quards.jeffsieu.com + - uses: actions/checkout@v4 + - name: Install flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: "3.22.2" + + - run: flutter pub get + + - run: flutter build web + + - name: Archive Production Artifact + uses: actions/upload-artifact@master + with: + name: web-build + path: build/web + + - name: Download Artifact + uses: actions/download-artifact@master + with: + name: web-build + + - name: Deploy to Github Pages + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./build/web + cname: quards.jeffsieu.com diff --git a/lib/main.dart b/lib/main.dart index 964ca24..30e2d6e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -46,7 +46,7 @@ class MainPage extends StatefulWidget { final String title; @override - _MainPageState createState() => _MainPageState(); + MainPageState createState() => MainPageState(); } class HoverReleaseDetails { @@ -57,7 +57,7 @@ class HoverReleaseDetails { final SolitairePile acceptedPile; } -class _MainPageState extends State +class MainPageState extends State with SingleTickerProviderStateMixin { SolitaireGame game = SolitaireGame(); SolitaireCardLocation? hoveredLocation; @@ -159,11 +159,11 @@ class _MainPageState extends State ), height: Theme.of(context) .textTheme - .headline2! + .displayMedium! .fontSize, width: Theme.of(context) .textTheme - .headline2! + .displayMedium! .fontSize, ), ), @@ -175,12 +175,14 @@ class _MainPageState extends State ), Text( 'Solitaire', - style: - Theme.of(context).textTheme.headline4?.copyWith( - color: Theme.of(context) - .hintColor - .withOpacity(0.1), - ), + style: Theme.of(context) + .textTheme + .headlineMedium + ?.copyWith( + color: Theme.of(context) + .hintColor + .withOpacity(0.1), + ), ), ], ), @@ -288,7 +290,7 @@ class _MainPageState extends State }, child: Text( 'You won!', - style: Theme.of(context).textTheme.headline3, + style: Theme.of(context).textTheme.displaySmall, ), ), const SizedBox(height: 16.0), @@ -319,7 +321,7 @@ class _MainPageState extends State children: [ Text( 'quards', - style: Theme.of(context).textTheme.headline2?.copyWith( + style: Theme.of(context).textTheme.displayMedium?.copyWith( // color: Theme.of(context) // .hintColor // .withOpacity(0.1), @@ -331,7 +333,7 @@ class _MainPageState extends State ), Text( 'quards', - style: Theme.of(context).textTheme.headline2?.copyWith( + style: Theme.of(context).textTheme.displayMedium?.copyWith( color: Color.lerp(Theme.of(context).hintColor, Theme.of(context).scaffoldBackgroundColor, 0.9), // foreground: Paint() @@ -574,11 +576,12 @@ class _MainPageState extends State return DragTarget( key: pileKeys[pile], onLeave: (details) {}, - onWillAccept: (SolitaireCardLocation? location) { - if (location == null) { + onWillAcceptWithDetails: + (DragTargetDetails? details) { + if (details == null) { return false; } else { - return game.canMoveToPile(location, pile); + return game.canMoveToPile(details.data, pile); } }, onMove: (DragTargetDetails details) { @@ -588,7 +591,9 @@ class _MainPageState extends State }); } }, - onAccept: (SolitaireCardLocation originalLocation) { + onAcceptWithDetails: (DragTargetDetails? details) { + final originalLocation = details?.data; + if (originalLocation == null) return; final movedCard = game.cardAt(originalLocation); releasedCardOrigin[movedCard.standardCard] = originalLocation; releasedCardDestination[movedCard.standardCard] = diff --git a/lib/widgets/draggable_card.dart b/lib/widgets/draggable_card.dart index a141d8c..b2a69ff 100644 --- a/lib/widgets/draggable_card.dart +++ b/lib/widgets/draggable_card.dart @@ -54,10 +54,10 @@ class DraggableCard extends StatefulWidget { } @override - _DraggableCardState createState() => _DraggableCardState(); + DraggableCardState createState() => DraggableCardState(); } -class _DraggableCardState extends State> +class DraggableCardState extends State> with TickerProviderStateMixin { final double maxRotationDegrees = 15; final double maxVelocity = 2500; diff --git a/lib/widgets/overlap_stack.dart b/lib/widgets/overlap_stack.dart index 142a658..a91f4a9 100644 --- a/lib/widgets/overlap_stack.dart +++ b/lib/widgets/overlap_stack.dart @@ -24,13 +24,13 @@ class OverlapStack extends StatelessWidget { Widget build(BuildContext context) { List children = List.generate(itemCount, (index) => itemBuilder(context, index)); - List _childrenSortedByZIndex = List.from(children) + List childrenSortedByZIndex = List.from(children) ..sort((child, otherChild) => child.zIndex.compareTo(otherChild.zIndex)); return Stack( // fit: StackFit.expand, clipBehavior: Clip.none, children: [ - for (Widget child in _childrenSortedByZIndex) ...{ + for (Widget child in childrenSortedByZIndex) ...{ Container( padding: EdgeInsets.only( left: children.indexOf(child) * childrenOffset.dx, diff --git a/lib/widgets/poker_card.dart b/lib/widgets/poker_card.dart index a96e23f..f496339 100644 --- a/lib/widgets/poker_card.dart +++ b/lib/widgets/poker_card.dart @@ -111,7 +111,7 @@ class PokerCard extends StatelessWidget { return Text( '${card?.valueString}\n${card?.suit.toDisplayString()}', textAlign: TextAlign.center, - style: Theme.of(context).textTheme.headline3?.copyWith( + style: Theme.of(context).textTheme.displaySmall?.copyWith( color: (card?.isRed ?? false) ? Colors.red.shade300 : Theme.of(context).colorScheme.onSurface, diff --git a/pubspec.lock b/pubspec.lock index 5f5bc28..443ddab 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,86 +5,82 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.8.2" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.3.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.18.0" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.3" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.8" equatable: dependency: "direct main" description: name: equatable - url: "https://pub.dartlang.org" + sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 + url: "https://pub.dev" source: hosted - version: "2.0.3" + version: "2.0.5" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.3.1" ffi: dependency: transitive description: name: ffi - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.2" - file: - dependency: transitive - description: - name: file - url: "https://pub.dartlang.org" + sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" + url: "https://pub.dev" source: hosted - version: "6.1.2" + version: "2.1.2" flutter: dependency: "direct main" description: flutter @@ -94,9 +90,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - url: "https://pub.dartlang.org" + sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" + url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "4.0.0" flutter_test: dependency: "direct dev" description: flutter @@ -106,135 +103,170 @@ packages: dependency: "direct main" description: name: google_fonts - url: "https://pub.dartlang.org" + sha256: b1ac0fe2832c9cc95e5e88b57d627c5e68c223b9657f4b96e1487aa9098c7b82 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "6.2.1" http: dependency: transitive description: name: http - url: "https://pub.dartlang.org" + sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938" + url: "https://pub.dev" source: hosted - version: "0.13.3" + version: "1.2.1" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.dartlang.org" + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.0.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + url: "https://pub.dev" + source: hosted + version: "10.0.4" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lints: dependency: transitive description: name: lints - url: "https://pub.dartlang.org" + sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" + url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "4.0.0" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" source: hosted - version: "0.12.11" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + url: "https://pub.dev" source: hosted - version: "0.1.4" + version: "0.8.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.12.0" nested: dependency: transitive description: name: nested - url: "https://pub.dartlang.org" + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" source: hosted version: "1.0.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "1.9.0" path_provider: dependency: transitive description: name: path_provider - url: "https://pub.dartlang.org" + sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161 + url: "https://pub.dev" source: hosted - version: "2.0.2" - path_provider_linux: + version: "2.1.3" + path_provider_android: dependency: transitive description: - name: path_provider_linux - url: "https://pub.dartlang.org" + name: path_provider_android + sha256: bca87b0165ffd7cdb9cad8edd22d18d2201e886d9a9f19b4fb3452ea7df3a72a + url: "https://pub.dev" source: hosted - version: "2.0.0" - path_provider_macos: + version: "2.2.6" + path_provider_foundation: dependency: transitive description: - name: path_provider_macos - url: "https://pub.dartlang.org" + name: path_provider_foundation + sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.4.0" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - url: "https://pub.dartlang.org" + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.1.2" path_provider_windows: dependency: transitive description: name: path_provider_windows - url: "https://pub.dartlang.org" + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + url: "https://pub.dev" source: hosted - version: "2.0.1" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.11.1" + version: "2.2.1" platform: dependency: transitive description: name: platform - url: "https://pub.dartlang.org" + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" + url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "3.1.5" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.dartlang.org" + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" source: hosted - version: "2.0.0" - process: - dependency: transitive - description: - name: process - url: "https://pub.dartlang.org" - source: hosted - version: "4.2.1" + version: "2.1.8" provider: dependency: "direct main" description: name: provider - url: "https://pub.dartlang.org" + sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c + url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "6.1.2" sky_engine: dependency: transitive description: flutter @@ -244,72 +276,98 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + url: "https://pub.dev" source: hosted - version: "0.4.9" + version: "0.7.0" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.3.2" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" + url: "https://pub.dev" + source: hosted + version: "14.2.1" + web: + dependency: transitive + description: + name: web + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + url: "https://pub.dev" + source: hosted + version: "0.5.1" win32: dependency: transitive description: name: win32 - url: "https://pub.dartlang.org" + sha256: a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4 + url: "https://pub.dev" source: hosted - version: "2.2.5" + version: "5.5.1" xdg_directories: dependency: transitive description: name: xdg_directories - url: "https://pub.dartlang.org" + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "1.0.4" sdks: - dart: ">=2.17.0-0 <3.0.0" - flutter: ">=1.20.0" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" diff --git a/pubspec.yaml b/pubspec.yaml index 0526975..0015587 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,12 +13,12 @@ dependencies: sdk: flutter cupertino_icons: ^1.0.2 - google_fonts: ^2.1.0 - provider: ^5.0.0 - equatable: 2.0.3 + google_fonts: ^6.2.1 + provider: ^6.1.2 + equatable: ^2.0.5 dev_dependencies: - flutter_lints: ^1.0.4 + flutter_lints: ^4.0.0 flutter_test: sdk: flutter diff --git a/web/index.html b/web/index.html index 755d586..0897394 100644 --- a/web/index.html +++ b/web/index.html @@ -1,7 +1,7 @@ - - - + - - - + + + - - - - - - + + + + + + - quards - - - - - - + // If service worker doesn't succeed in a reasonable amount of time, + // fallback to plaint + + + +