|
|
@@ -6,6 +6,7 @@ import 'package:get/get.dart';
|
|
|
import 'package:keyboard/base/base_controller.dart';
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
import 'package:keyboard/data/repository/account_repository.dart';
|
|
|
+import 'package:keyboard/module/main/main_controller.dart';
|
|
|
import 'package:keyboard/utils/toast_util.dart';
|
|
|
import '../../data/consts/constants.dart';
|
|
|
import '../../data/consts/event_report.dart';
|
|
|
@@ -23,49 +24,54 @@ class IntroController extends BaseController {
|
|
|
var currentPage = 0.obs;
|
|
|
Timer? _autoPageTimer;
|
|
|
|
|
|
+ late Worker _loginSubscription;
|
|
|
IntroController();
|
|
|
|
|
|
/// 页面数据列表
|
|
|
final List<PageBean> pageList = [
|
|
|
PageBean(
|
|
|
- title: Text.rich(
|
|
|
- textAlign: TextAlign.center,
|
|
|
- TextSpan(
|
|
|
- children: [
|
|
|
- TextSpan(
|
|
|
- text: '想知道\n',
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.black.withAlpha(153),
|
|
|
- fontSize: 14.sp,
|
|
|
- fontWeight: FontWeight.w500,
|
|
|
+ title: () {
|
|
|
+ return Text.rich(
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ TextSpan(
|
|
|
+ children: [
|
|
|
+ TextSpan(
|
|
|
+ text: '想知道\n',
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.black.withAlpha(153),
|
|
|
+ fontSize: 14.sp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- TextSpan(
|
|
|
- text: 'Ta ',
|
|
|
- style: TextStyle(
|
|
|
- color: const Color(0xFF7D46FC),
|
|
|
- fontSize: 24.sp,
|
|
|
- fontWeight: FontWeight.w600,
|
|
|
+ TextSpan(
|
|
|
+ text: 'Ta ',
|
|
|
+ style: TextStyle(
|
|
|
+ color: const Color(0xFF7D46FC),
|
|
|
+ fontSize: 24.sp,
|
|
|
+ fontWeight: FontWeight.w600,
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- TextSpan(
|
|
|
- text: '对你到底是‘朋友’还是‘心动’?',
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.black.withAlpha(153),
|
|
|
- fontSize: 14.sp,
|
|
|
- fontWeight: FontWeight.w500,
|
|
|
+ TextSpan(
|
|
|
+ text: '对你到底是‘朋友’还是‘心动’?',
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.black.withAlpha(153),
|
|
|
+ fontSize: 14.sp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ },
|
|
|
animUrl: Assets.anim.animIntroFirstData,
|
|
|
- stayDuration: const Duration(milliseconds:4100),
|
|
|
+ stayDuration: const Duration(milliseconds: 4100),
|
|
|
),
|
|
|
PageBean(
|
|
|
- title: const SizedBox(),
|
|
|
+ title: () {
|
|
|
+ return const SizedBox();
|
|
|
+ },
|
|
|
animUrl: Assets.anim.animIntroSecondData,
|
|
|
- stayDuration:const Duration(milliseconds: 5500)
|
|
|
+ stayDuration: const Duration(milliseconds: 5500),
|
|
|
),
|
|
|
];
|
|
|
|
|
|
@@ -81,7 +87,7 @@ class IntroController extends BaseController {
|
|
|
_startAutoSwitchTimer();
|
|
|
EventHandler.report(EventId.event_01000);
|
|
|
// 监听登录状态
|
|
|
- ever(AccountRepository.getInstance().isLogin, (bool isLogin) {
|
|
|
+ _loginSubscription= ever(AccountRepository.getInstance().isLogin, (bool isLogin) {
|
|
|
if (isLogin) {
|
|
|
// 登录后跳转新用户页
|
|
|
Future.delayed(const Duration(milliseconds: 300), () {
|
|
|
@@ -146,13 +152,14 @@ class IntroController extends BaseController {
|
|
|
|
|
|
@override
|
|
|
void onClose() {
|
|
|
+ _loginSubscription.dispose();
|
|
|
_autoPageTimer?.cancel();
|
|
|
super.onClose();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
class PageBean {
|
|
|
- final Widget title;
|
|
|
+ final WidgetFunction title;
|
|
|
final String animUrl;
|
|
|
final Duration stayDuration; // 每页停留时间
|
|
|
|