Browse Source

add loading bar in init security page

pull/18/head
Sun 4 years ago
parent
commit
2272a68e59
  1. 36
      lib/security.dart

36
lib/security.dart

@ -1,3 +1,4 @@
import 'dart:ui' show ImageFilter;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -62,7 +63,8 @@ class _SecurityPageState extends State<SecurityPage> {
body: AnnotatedRegion<SystemUiOverlayStyle>( body: AnnotatedRegion<SystemUiOverlayStyle>(
value: style.copyWith(statusBarColor: color.background), value: style.copyWith(statusBarColor: color.background),
child: SafeArea( child: SafeArea(
child: Container( child: Stack(children: [
Container(
padding: const EdgeInsets.all(20.0), padding: const EdgeInsets.all(20.0),
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height,
decoration: BoxDecoration( decoration: BoxDecoration(
@ -138,6 +140,9 @@ class _SecurityPageState extends State<SecurityPage> {
] ]
) )
) )
),
this._accountsLoaded ? Container() : LoaderTransparent(color: color.primary)
]
) )
) )
) )
@ -155,7 +160,6 @@ class _SecurityPageState extends State<SecurityPage> {
// check if has logined. // check if has logined.
final loginedAccounts = await getLogined(); final loginedAccounts = await getLogined();
if (loginedAccounts.length != 0) { if (loginedAccounts.length != 0) {
print("INFO: START LOGINED USE CACHE"); print("INFO: START LOGINED USE CACHE");
final mainAccount = loginedAccounts[0]; final mainAccount = loginedAccounts[0];
@ -279,3 +283,31 @@ class _SecurityPageState extends State<SecurityPage> {
)); ));
} }
} }
class LoaderTransparent extends StatelessWidget {
final Color color;
LoaderTransparent({required this.color});
@override
Widget build(BuildContext context) {
final height = MediaQuery.of(context).size.height;
final width = MediaQuery.of(context).size.width;
return BackdropFilter(
filter: ImageFilter.blur(sigmaX: 6.0, sigmaY: 6.0),
child: Container(
height: height,
width: width,
child: Center(
child: SizedBox(
height: 60.0,
width: 60.0,
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation(this.color),
strokeWidth: 12.0
)
)
)
));
}
}

Loading…
Cancel
Save