Skip to content

Commit

Permalink
feat: add GA, update packages
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffsieu committed Jul 3, 2024
1 parent 1365c21 commit f435a7e
Show file tree
Hide file tree
Showing 8 changed files with 301 additions and 226 deletions.
60 changes: 29 additions & 31 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
39 changes: 22 additions & 17 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class MainPage extends StatefulWidget {
final String title;

@override
_MainPageState createState() => _MainPageState();
MainPageState createState() => MainPageState();
}

class HoverReleaseDetails {
Expand All @@ -57,7 +57,7 @@ class HoverReleaseDetails {
final SolitairePile acceptedPile;
}

class _MainPageState extends State<MainPage>
class MainPageState extends State<MainPage>
with SingleTickerProviderStateMixin {
SolitaireGame game = SolitaireGame();
SolitaireCardLocation? hoveredLocation;
Expand Down Expand Up @@ -159,11 +159,11 @@ class _MainPageState extends State<MainPage>
),
height: Theme.of(context)
.textTheme
.headline2!
.displayMedium!
.fontSize,
width: Theme.of(context)
.textTheme
.headline2!
.displayMedium!
.fontSize,
),
),
Expand All @@ -175,12 +175,14 @@ class _MainPageState extends State<MainPage>
),
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),
),
),
],
),
Expand Down Expand Up @@ -288,7 +290,7 @@ class _MainPageState extends State<MainPage>
},
child: Text(
'You won!',
style: Theme.of(context).textTheme.headline3,
style: Theme.of(context).textTheme.displaySmall,
),
),
const SizedBox(height: 16.0),
Expand Down Expand Up @@ -319,7 +321,7 @@ class _MainPageState extends State<MainPage>
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),
Expand All @@ -331,7 +333,7 @@ class _MainPageState extends State<MainPage>
),
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()
Expand Down Expand Up @@ -574,11 +576,12 @@ class _MainPageState extends State<MainPage>
return DragTarget<SolitaireCardLocation>(
key: pileKeys[pile],
onLeave: (details) {},
onWillAccept: (SolitaireCardLocation? location) {
if (location == null) {
onWillAcceptWithDetails:
(DragTargetDetails<SolitaireCardLocation>? details) {
if (details == null) {
return false;
} else {
return game.canMoveToPile(location, pile);
return game.canMoveToPile(details.data, pile);
}
},
onMove: (DragTargetDetails<SolitaireCardLocation> details) {
Expand All @@ -588,7 +591,9 @@ class _MainPageState extends State<MainPage>
});
}
},
onAccept: (SolitaireCardLocation originalLocation) {
onAcceptWithDetails: (DragTargetDetails<SolitaireCardLocation>? details) {
final originalLocation = details?.data;
if (originalLocation == null) return;
final movedCard = game.cardAt(originalLocation);
releasedCardOrigin[movedCard.standardCard] = originalLocation;
releasedCardDestination[movedCard.standardCard] =
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/draggable_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ class DraggableCard<T extends Object> extends StatefulWidget {
}

@override
_DraggableCardState createState() => _DraggableCardState();
DraggableCardState createState() => DraggableCardState();
}

class _DraggableCardState<T extends Object> extends State<DraggableCard<T>>
class DraggableCardState<T extends Object> extends State<DraggableCard<T>>
with TickerProviderStateMixin {
final double maxRotationDegrees = 15;
final double maxVelocity = 2500;
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/overlap_stack.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ class OverlapStack extends StatelessWidget {
Widget build(BuildContext context) {
List<Widget> children =
List.generate(itemCount, (index) => itemBuilder(context, index));
List<Widget> _childrenSortedByZIndex = List.from(children)
List<Widget> 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,
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/poker_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit f435a7e

Please sign in to comment.