Skip to content
Snippets Groups Projects
Commit d05e3716 authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Merge branch '6-add-drag-drop-swap-feature-on-tiles' into 'master'

Resolve "Add drag-drop / swap feature on tiles"

Closes #6

See merge request !7
parents 1271ede2 3e7d9c21
No related branches found
No related tags found
1 merge request!7Resolve "Add drag-drop / swap feature on tiles"
Pipeline #1233 passed
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
app.versionName=0.0.5
app.versionCode=5
app.versionName=0.0.6
app.versionCode=6
......@@ -17,13 +17,60 @@ class Tile {
@required this.originalRow,
);
Container widget() {
Container _tileWidget() {
return Container(
decoration: BoxDecoration(
color: Colors.black,
border: Border.all(
color: Colors.black,
width: 1,
),
),
child: Image(
image: this.image.image,
width: this.size,
height: this.size,
fit: BoxFit.fill
),
);
}
Container widget() {
return Container(
child: DragTarget<List<int>>(
builder: (
BuildContext context,
List<dynamic> accepted,
List<dynamic> rejected,
) {
return Container(
height: this.size,
width: this.size,
color: Colors.cyan,
child: Draggable<List<int>>(
data: [
this.currentCol,
this.currentRow,
],
// Widget when draggable is stationary
child: this._tileWidget(),
// Widget when draggable is being dragged
feedback: this._tileWidget(),
// Widget to display on original place when being dragged
childWhenDragging: Container(
height: this.size,
width: this.size,
color: Colors.pinkAccent,
),
),
);
},
onAccept: (List<int> data) {
print(data.toString());
},
)
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment