qr page add animated bar

hmxc
小赖 4 years ago
parent ffd34620f6
commit 0bdb559a09

@ -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<ScanPage> {
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,7 +56,9 @@ class _ScanPageState extends State<ScanPage> {
},
),
Center(
child: Container(
child: Stack(
children: [
Container(
height: 200,
width: 200,
decoration: BoxDecoration(
@ -51,6 +69,18 @@ class _ScanPageState extends State<ScanPage> {
),
),
),
AnimatedPositioned(
top: _barMove ? 10 : 190,
child: Container(
width: 200,
height: 2,
color: Colors.red,
),
curve: Curves.easeInOutCubic,
duration: Duration(milliseconds: 300),
),
],
),
),
Positioned(
left: 10,

Loading…
Cancel
Save