Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
org.benoitharrault.solitaire
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
android
org.benoitharrault.solitaire
Commits
d755815e
Commit
d755815e
authored
6 months ago
by
Benoît Harrault
Browse files
Options
Downloads
Patches
Plain Diff
Normalize Activity application architecture
parent
77607ceb
No related branches found
No related tags found
1 merge request
!27
Resolve "Normalize Activity application architecture"
Pipeline
#6678
passed
6 months ago
Stage: build-debug
Changes
43
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/ui/widgets/game/tile_widget.dart
+25
-25
25 additions, 25 deletions
lib/ui/widgets/game/tile_widget.dart
pubspec.lock
+4
-4
4 additions, 4 deletions
pubspec.lock
pubspec.yaml
+1
-1
1 addition, 1 deletion
pubspec.yaml
with
30 additions
and
30 deletions
lib/ui/widgets/game/tile_widget.dart
+
25
−
25
View file @
d755815e
import
'package:flutter/material.dart'
;
import
'package:flutter_custom_toolbox/flutter_toolbox.dart'
;
import
'package:solitaire/cubit/
game
_cubit.dart'
;
import
'package:solitaire/models/
game
/cell.dart'
;
import
'package:solitaire/models/
game/game
.dart'
;
import
'package:solitaire/cubit/
activity/activity
_cubit.dart'
;
import
'package:solitaire/models/
activity
/cell.dart'
;
import
'package:solitaire/models/
activity/activity
.dart'
;
class
TileWidget
extends
StatelessWidget
{
const
TileWidget
({
...
...
@@ -17,18 +17,18 @@ class TileWidget extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
BlocBuilder
<
GameCubit
,
Game
State
>(
builder:
(
BuildContext
context
,
GameState
game
State
)
{
final
Game
currentGame
=
game
State
.
current
Game
;
return
BlocBuilder
<
ActivityCubit
,
Activity
State
>(
builder:
(
BuildContext
context
,
ActivityState
activity
State
)
{
final
Activity
currentActivity
=
activity
State
.
current
Activity
;
if
(
tile
.
hasHole
)
{
return
render
(
current
Game
:
current
Game
,
game
Cubit:
BlocProvider
.
of
<
Game
Cubit
>(
context
),
current
Activity
:
current
Activity
,
activity
Cubit:
BlocProvider
.
of
<
Activity
Cubit
>(
context
),
);
}
else
{
return
Image
(
image:
AssetImage
(
'assets/skins/
${current
Game
.globalSettings.skin}
_board.png'
),
image:
AssetImage
(
'assets/skins/
${current
Activity
.globalSettings.skin}
_board.png'
),
width:
tileSize
,
height:
tileSize
,
fit:
BoxFit
.
fill
,
...
...
@@ -39,19 +39,19 @@ class TileWidget extends StatelessWidget {
}
Widget
render
({
required
Game
currentGame
,
required
GameCubit
game
Cubit
,
required
Activity
currentActivity
,
required
ActivityCubit
activity
Cubit
,
})
{
List
<
Widget
>
stack
=
[
hole
(
current
Game
:
current
Game
,
gameCubit:
game
Cubit
,
current
Activity
:
current
Activity
,
activityCubit:
activity
Cubit
,
),
];
if
(
tile
.
hasPeg
)
{
stack
.
add
(
draggable
(
current
Game
:
current
Game
,
current
Activity
:
current
Activity
,
));
}
...
...
@@ -62,10 +62,10 @@ class TileWidget extends StatelessWidget {
}
Widget
hole
({
required
Game
currentGame
,
required
GameCubit
game
Cubit
,
required
Activity
currentActivity
,
required
ActivityCubit
activity
Cubit
,
})
{
String
image
=
'assets/skins/
${current
Game
.globalSettings.skin}
_hole.png'
;
String
image
=
'assets/skins/
${current
Activity
.globalSettings.skin}
_hole.png'
;
return
DragTarget
<
List
<
int
>>(
builder:
(
...
...
@@ -83,12 +83,12 @@ class TileWidget extends StatelessWidget {
onAcceptWithDetails:
(
DragTargetDetails
<
List
<
int
>>
source
)
{
List
<
int
>
target
=
[
tile
.
location
.
col
,
tile
.
location
.
row
]
;
// printlog('(drag) Pick from ' + source.toString() + ' and drop on ' + target.toString());
if
(
current
Game
.
board
.
isMoveAllowed
(
if
(
current
Activity
.
board
.
isMoveAllowed
(
source
:
source
.
data
,
target:
target
,
))
{
game
Cubit
.
move
(
current
Game
:
current
Game
,
activity
Cubit
.
move
(
current
Activity
:
current
Activity
,
source
:
source
.
data
,
target:
target
,
)
;
...
...
@@ -98,14 +98,14 @@ class TileWidget extends StatelessWidget {
}
Widget
draggable
({
required
Game
currentGame
,
required
Activity
currentActivity
,
})
{
return
Draggable
<
List
<
int
>>(
data:
[
tile
.
location
.
col
,
tile
.
location
.
row
],
// Widget when draggable is being dragged
feedback:
peg
(
current
Game
:
current
Game
,
current
Activity
:
current
Activity
,
),
// Widget to display on original place when being dragged
...
...
@@ -113,15 +113,15 @@ class TileWidget extends StatelessWidget {
// Widget when draggable is stationary
child:
peg
(
current
Game
:
current
Game
,
current
Activity
:
current
Activity
,
),
)
;
}
Widget
peg
({
required
Game
currentGame
,
required
Activity
currentActivity
,
})
{
String
image
=
'assets/skins/
${current
Game
.globalSettings.skin}
_peg.png'
;
String
image
=
'assets/skins/
${current
Activity
.globalSettings.skin}
_peg.png'
;
return
Image
(
image:
AssetImage
(
image
),
...
...
This diff is collapsed.
Click to expand it.
pubspec.lock
+
4
−
4
View file @
d755815e
...
...
@@ -245,10 +245,10 @@ packages:
dependency: transitive
description:
name: path_provider
sha256:
fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378
sha256:
"50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd"
url: "https://pub.dev"
source: hosted
version: "2.1.
4
"
version: "2.1.
5
"
path_provider_android:
dependency: transitive
description:
...
...
@@ -442,10 +442,10 @@ packages:
dependency: transitive
description:
name: win32
sha256: "
2735daae5150e8b1dfeb3eb0544b4d3af0061e9e82cef063adcd583bdae4306a
"
sha256: "
10169d3934549017f0ae278ccb07f828f9d6ea21573bab0fb77b0e1ef0fce454
"
url: "https://pub.dev"
source: hosted
version: "5.7.
0
"
version: "5.7.
2
"
xdg_directories:
dependency: transitive
description:
...
...
This diff is collapsed.
Click to expand it.
pubspec.yaml
+
1
−
1
View file @
d755815e
...
...
@@ -3,7 +3,7 @@ description: Solitaire Game
publish_to
:
"
none"
version
:
0.
3.1
+2
4
version
:
0.
4.0
+2
5
environment
:
sdk
:
"
^3.0.0"
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
3
Next
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment