This commit is contained in:
2023-12-22 07:32:13 +08:00
parent 1414bd4bb4
commit a8f9b5265e
21 changed files with 175 additions and 26 deletions

View File

@@ -1,24 +1,64 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';
import 'splash_state.dart';
class SplashLogic extends GetxController {
import '../../utils/utils.dart';
class SplashLogic extends GetxController with GetTickerProviderStateMixin {
final SplashState state = SplashState();
late AnimationController animationController;
late Animation<Offset> animation;
@override
void onInit() {
super.onInit();
initAnimation();
animationController.forward();
isLoginFn();
}
@override
void onReady() {
// TODO: implement onReady
debugPrint('onReady');
super.onReady();
}
@override
void onClose() {
// TODO: implement onClose
animationController.dispose();
super.onClose();
}
void showText(context) {
TDToast.showText('轻提示文字内容', context: context);
void initAnimation() {
animationController = AnimationController(
vsync: this,
duration: const Duration(seconds: 1),
);
animation = Tween<Offset>(
begin: const Offset(0.0, 1.0),
end: Offset.zero,
).animate(CurvedAnimation(
parent: animationController,
curve: Curves.easeInOut,
));
}
Future<void> isLoginFn() async {
// 倒计时3秒
await Future.delayed(const Duration(seconds: 3), () {
final token = StorageUtil().getString("token");
if (!ToolFn.isBlank(token)) {
Get.offAllNamed('/home');
} else {
Get.offAllNamed('/login');
// Get.toNamed('/login');
}
});
}
}