forked from yaso_meth/mih-project
Merge pull request #52 from yaso-meth/BUG-Graphical-flicker-post-bio-auth
BUG-Graphical-flicker-post-bio-auth
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../main.dart';
|
||||
import 'package:gif/gif.dart';
|
||||
import 'package:gif_view/gif_view.dart';
|
||||
|
||||
class Mihloadingcircle extends StatefulWidget {
|
||||
const Mihloadingcircle({super.key});
|
||||
@@ -9,9 +9,8 @@ class Mihloadingcircle extends StatefulWidget {
|
||||
State<Mihloadingcircle> createState() => _MihloadingcircleState();
|
||||
}
|
||||
|
||||
class _MihloadingcircleState extends State<Mihloadingcircle>
|
||||
with TickerProviderStateMixin {
|
||||
late final GifController _controller;
|
||||
class _MihloadingcircleState extends State<Mihloadingcircle> {
|
||||
// final GifController _controller = GifController();
|
||||
late double popUpPaddingSize;
|
||||
late double popUpWidth;
|
||||
late double? popUpheight;
|
||||
@@ -37,60 +36,37 @@ class _MihloadingcircleState extends State<Mihloadingcircle>
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_controller = GifController(vsync: this);
|
||||
//_controller.animateTo(26);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
// _controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ImageProvider loading =
|
||||
MzanziInnovationHub.of(context)!.theme.loadingImage();
|
||||
var size = MediaQuery.of(context).size;
|
||||
setState(() {
|
||||
width = size.width;
|
||||
height = size.height;
|
||||
});
|
||||
checkScreenSize();
|
||||
return Dialog(
|
||||
//backgroundColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(popUpPaddingSize),
|
||||
width: 250,
|
||||
height: 250,
|
||||
decoration: BoxDecoration(
|
||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
borderRadius: BorderRadius.circular(25.0),
|
||||
border: Border.all(
|
||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
width: 5.0),
|
||||
),
|
||||
child: Gif(
|
||||
image: loading,
|
||||
controller:
|
||||
_controller, // if duration and fps is null, original gif fps will be used.
|
||||
fps: 15,
|
||||
//duration: const Duration(seconds: 3),
|
||||
autostart: Autostart.loop,
|
||||
placeholder: (context) => const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
padding: EdgeInsets.all(popUpPaddingSize),
|
||||
width: 250,
|
||||
height: 250,
|
||||
decoration: BoxDecoration(
|
||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
borderRadius: BorderRadius.circular(25.0),
|
||||
border: Border.all(
|
||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
width: 5.0),
|
||||
),
|
||||
onFetchCompleted: () {
|
||||
_controller.reset();
|
||||
_controller.forward();
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
// Center(
|
||||
// child: MzanziInnovationHub.of(context)!.theme.loadingImage()),
|
||||
// ),
|
||||
child: GifView.asset(
|
||||
MzanziInnovationHub.of(context)!.theme.loadingImageLocation(),
|
||||
height: 200,
|
||||
width: 200,
|
||||
frameRate: 30,
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||
import 'package:Mzansi_Innovation_Hub/mih_packages/authentication/biometric_check.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -62,8 +63,9 @@ class _AuthCheckState extends State<AuthCheck> {
|
||||
} else if (snapshot.data == false) {
|
||||
return const SignInOrRegister();
|
||||
} else {
|
||||
return const SizedBox(width: 5, height: 5);
|
||||
// const Mihloadingcircle();
|
||||
return
|
||||
// const SizedBox(width: 5, height: 5);
|
||||
const Mihloadingcircle();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -68,7 +68,7 @@ class _BiometricCheckState extends State<BiometricCheck> {
|
||||
|
||||
void authenticateUser() async {
|
||||
final bool canAuthWithBio = await _auth.canCheckBiometrics;
|
||||
print("Biomentric Available: $canAuthWithBio");
|
||||
// print("Biomentric Available: $canAuthWithBio");
|
||||
if (canAuthWithBio) {
|
||||
try {
|
||||
final bool didBioAuth = await _auth.authenticate(
|
||||
@@ -82,7 +82,7 @@ class _BiometricCheckState extends State<BiometricCheck> {
|
||||
_isBioAuthenticated = true;
|
||||
});
|
||||
}
|
||||
print("Authenticated: $didBioAuth");
|
||||
// print("Authenticated: $didBioAuth");
|
||||
} catch (error) {
|
||||
print(error);
|
||||
}
|
||||
@@ -123,22 +123,21 @@ class _BiometricCheckState extends State<BiometricCheck> {
|
||||
),
|
||||
//spacer
|
||||
const SizedBox(height: 25),
|
||||
if (!_isBioAuthenticated)
|
||||
Icon(
|
||||
Icons.lock,
|
||||
size: 200,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
if (_isBioAuthenticated)
|
||||
Icon(
|
||||
Icons.lock_open,
|
||||
size: 200,
|
||||
color: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
),
|
||||
// if (!_isBioAuthenticated)
|
||||
Icon(
|
||||
Icons.lock,
|
||||
size: 200,
|
||||
color:
|
||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
),
|
||||
// if (_isBioAuthenticated)
|
||||
// Icon(
|
||||
// Icons.lock_open,
|
||||
// size: 200,
|
||||
// color: MzanziInnovationHub.of(context)!
|
||||
// .theme
|
||||
// .secondaryColor(),
|
||||
// ),
|
||||
const SizedBox(height: 30),
|
||||
Container(
|
||||
alignment: Alignment.bottomCenter,
|
||||
@@ -187,7 +186,7 @@ class _BiometricCheckState extends State<BiometricCheck> {
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
if (widget.firstBoot == true) authenticateUser();
|
||||
// if (widget.firstBoot == true) authenticateUser();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -206,6 +205,7 @@ class _BiometricCheckState extends State<BiometricCheck> {
|
||||
personalSelected: widget.personalSelected,
|
||||
);
|
||||
} else {
|
||||
authenticateUser();
|
||||
return getBiomentricAuthScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ class MyTheme {
|
||||
late String mode;
|
||||
late String screenType;
|
||||
late AssetImage loading;
|
||||
late String loadingAssetText;
|
||||
late TargetPlatform platform;
|
||||
bool kIsWeb = const bool.fromEnvironment('dart.library.js_util');
|
||||
// Options:-
|
||||
@@ -227,6 +228,24 @@ class MyTheme {
|
||||
return loading;
|
||||
}
|
||||
|
||||
String loadingImageLocation() {
|
||||
if (mode == "Dark") {
|
||||
loadingAssetText = 'images/loading_light.gif';
|
||||
} else {
|
||||
loadingAssetText = 'images/loading_dark.gif';
|
||||
}
|
||||
return loadingAssetText;
|
||||
}
|
||||
|
||||
String altLoadingImageLocation() {
|
||||
if (mode == "Dark") {
|
||||
loadingAssetText = 'images/loading_dark.gif';
|
||||
} else {
|
||||
loadingAssetText = 'images/loading_light.gif';
|
||||
}
|
||||
return loadingAssetText;
|
||||
}
|
||||
|
||||
AssetImage aiLogoImage() {
|
||||
if (mode == "Dark") {
|
||||
return const AssetImage(
|
||||
|
||||
@@ -584,14 +584,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.3"
|
||||
gif:
|
||||
gif_view:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: gif
|
||||
sha256: ade95694f1471da737922806818ffade2814d1d7f8d10af38ebcf36ace012bc0
|
||||
name: gif_view
|
||||
sha256: d2441d98bcd56b3fd00e869513aeaefa56849ab62f63675e7d55f5fa4517f27e
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.0"
|
||||
version: "1.0.0"
|
||||
glob:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -46,7 +46,8 @@ dependencies:
|
||||
google_nav_bar: ^5.0.6
|
||||
mysql_client: ^0.0.27
|
||||
args: 2.5.0
|
||||
gif: ^2.3.0
|
||||
# gif: ^2.3.0
|
||||
gif_view: ^1.0.0
|
||||
intl: ^0.19.0
|
||||
flutter_native_splash: ^2.4.1
|
||||
#google_maps_flutter_web: ^0.5.10
|
||||
|
||||
Reference in New Issue
Block a user