qr page add animated bar

hmxc
小赖 5 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/tools/screen_tool.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_back_button.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_back_button.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
@ -15,10 +17,24 @@ class _ScanPageState extends State<ScanPage> {
GlobalKey qrKey = GlobalKey(debugLabel: 'QR'); GlobalKey qrKey = GlobalKey(debugLabel: 'QR');
QRViewController _qrViewController; QRViewController _qrViewController;
String tempText; 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 @override
void dispose() { void dispose() {
_qrViewController?.dispose(); _qrViewController?.dispose();
_timer?.cancel();
super.dispose(); super.dispose();
} }
@ -40,16 +56,30 @@ class _ScanPageState extends State<ScanPage> {
}, },
), ),
Center( Center(
child: Container( child: Stack(
height: 200, children: [
width: 200, Container(
decoration: BoxDecoration( height: 200,
borderRadius: BorderRadius.circular(8), width: 200,
border: Border.all( decoration: BoxDecoration(
color: Colors.red, borderRadius: BorderRadius.circular(8),
width: 1, 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( Positioned(

Loading…
Cancel
Save