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