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