Change Align to Position

This commit is contained in:
DMK
2021-01-08 16:21:05 +03:00
parent ebfb6551f4
commit b9cc2e4a22

View File

@@ -26,16 +26,15 @@ class AppState extends State<App> {
fit: BoxFit.cover,
),
ColorFiltered(
colorFilter: ColorFilter.mode(Colors.black.withOpacity(0.8),
BlendMode.srcOut), // This one will create the magic
colorFilter:
ColorFilter.mode(Colors.black.withOpacity(0.8), BlendMode.srcOut), // This one will create the magic
child: Stack(
fit: StackFit.expand,
children: [
Container(
decoration: BoxDecoration(
color: Colors.black,
backgroundBlendMode: BlendMode
.dstOut), // This one will handle background + difference out
backgroundBlendMode: BlendMode.dstOut), // This one will handle background + difference out
),
MovingHole(),
],
@@ -55,13 +54,15 @@ class MovingHole extends StatefulWidget {
class MovingHoleState extends State<MovingHole> {
double _width = 200;
double _height = 200;
Alignment _alignment = Alignment.topLeft;
Offset _alignment = Offset(100, 200);
bool end = true;
@override
Widget build(BuildContext context) {
return Align(
alignment: _alignment,
return Positioned(
top: _alignment.dx,
left: _alignment.dy,
// alignment: _alignment,
child: GestureDetector(
onTap: () async {
end == true
@@ -69,7 +70,7 @@ class MovingHoleState extends State<MovingHole> {
setState(() {
_width = 100;
_height = 100;
_alignment = Alignment.topRight;
_alignment = Offset(120, 200);
end = false;
});
})
@@ -77,7 +78,7 @@ class MovingHoleState extends State<MovingHole> {
setState(() {
_width = 200;
_height = 200;
_alignment = Alignment.bottomLeft;
_alignment = Offset(50, 29);
end = true;
});
});