From b9cc2e4a22abe5152b2278a524d78bee7e8cbe39 Mon Sep 17 00:00:00 2001 From: DMK Date: Fri, 8 Jan 2021 16:21:05 +0300 Subject: [PATCH] Change Align to Position --- lib/main.dart | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 733c416..b8db24f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -26,16 +26,15 @@ class AppState extends State { 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 { 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 { setState(() { _width = 100; _height = 100; - _alignment = Alignment.topRight; + _alignment = Offset(120, 200); end = false; }); }) @@ -77,7 +78,7 @@ class MovingHoleState extends State { setState(() { _width = 200; _height = 200; - _alignment = Alignment.bottomLeft; + _alignment = Offset(50, 29); end = true; }); });