diff --git a/lib/ui/tool_pages/scan_page.dart b/lib/ui/tool_pages/scan_page.dart index 429bd06..ac7ebaf 100644 --- a/lib/ui/tool_pages/scan_page.dart +++ b/lib/ui/tool_pages/scan_page.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_back_button.dart'; import 'package:bot_toast/bot_toast.dart'; @@ -15,10 +17,24 @@ class _ScanPageState extends State { GlobalKey qrKey = GlobalKey(debugLabel: 'QR'); QRViewController _qrViewController; String tempText; + Timer _timer; + bool _barMove = false; + + @override + void initState() { + super.initState(); + _timer = Timer.periodic(Duration(milliseconds: 1000), (timer) { + if (mounted) + setState(() { + _barMove = !_barMove; + }); + }); + } @override void dispose() { _qrViewController?.dispose(); + _timer?.cancel(); super.dispose(); } @@ -40,16 +56,30 @@ class _ScanPageState extends State { }, ), Center( - child: Container( - height: 200, - width: 200, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - border: Border.all( - color: Colors.red, - width: 1, + child: Stack( + children: [ + Container( + height: 200, + width: 200, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + border: Border.all( + color: Colors.red, + width: 1, + ), + ), + ), + AnimatedPositioned( + top: _barMove ? 10 : 190, + child: Container( + width: 200, + height: 2, + color: Colors.red, + ), + curve: Curves.easeInOutCubic, + duration: Duration(milliseconds: 300), ), - ), + ], ), ), Positioned(