fix: Fixed threshold and added instant load page
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:example/group_info_screen.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
@@ -102,11 +103,12 @@ class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
|
||||
|
||||
var now = DateTime.now().millisecondsSinceEpoch;
|
||||
|
||||
if (now - timeOfStartMs > 1000) {
|
||||
if (now - timeOfStartMs > 1500) {
|
||||
SchedulerBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
_animationController.forward();
|
||||
});
|
||||
} else {
|
||||
var diff = 1000 - (now - timeOfStartMs);
|
||||
Future.delayed(Duration(milliseconds: diff)).then((value) {
|
||||
Future.delayed(Duration(milliseconds: 1500)).then((value) {
|
||||
_animationController.forward();
|
||||
});
|
||||
}
|
||||
@@ -137,7 +139,7 @@ class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
|
||||
color: _colorAnimation == null
|
||||
? Color(0xff005FFF)
|
||||
: _colorAnimation.value,
|
||||
child: _initData == null
|
||||
child: !_animationController.isAnimating
|
||||
? Lottie.asset(
|
||||
'assets/floating_boat.json',
|
||||
alignment: Alignment.center,
|
||||
@@ -145,7 +147,6 @@ class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
|
||||
: Container(),
|
||||
);
|
||||
}),
|
||||
if (_initData != null)
|
||||
AnimatedBuilder(
|
||||
animation: _animation,
|
||||
builder: (context, snapshot) {
|
||||
@@ -170,11 +171,11 @@ class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_initData == null || !_animCompleted) {
|
||||
return _buildAnimation();
|
||||
}
|
||||
|
||||
return PreferenceBuilder<int>(
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
if (_initData != null)
|
||||
PreferenceBuilder<int>(
|
||||
preference: _initData.preferences.getInt(
|
||||
'theme',
|
||||
defaultValue: 0,
|
||||
@@ -212,6 +213,9 @@ class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
|
||||
? Routes.CHOOSE_USER
|
||||
: Routes.HOME,
|
||||
),
|
||||
),
|
||||
if (!_animCompleted) _buildAnimation(),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user