dreampad/lib/app/modules/splash/views/splash_view.dart

111 lines
3.6 KiB
Dart
Raw Normal View History

2023-11-28 10:44:58 +08:00
import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:dreampad/app/routes/app_pages.dart';
import 'package:dreampad/app/shared/shared.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../controllers/splash_controller.dart';
class SplashView extends GetView<SplashController> {
const SplashView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: Images.splashBg,
fit: BoxFit.fill,
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
body: buildBody(context),
),
),
);
}
Widget buildBody(BuildContext context) {
return Obx(
() => Stack(
children: [
Positioned(
left: 368.w,
top: 228.h,
child: RSizedBox(
width: 434.0,
child: DefaultTextStyle(
style: TextStyles.mediumWhiteShadowHeight26_034,
child: AnimatedTextKit(
totalRepeatCount: 1,
animatedTexts: [
TypewriterAnimatedText(
'上古时期,天帝颛顼命重黎绝地天通斩断了连接天界与人间之桥——建木为重生建木,探梦者们踏上了旅途……',
speed: const Duration(milliseconds: 150),
cursor: '',
),
],
onFinished: () {
controller.animatedCount.value++;
},
),
),
),
),
Positioned(
left: 483.w,
top: 367.h,
child: controller.animatedCount.value >= 1
? RSizedBox(
width: 260.0,
child: DefaultTextStyle(
style: TextStyles.mediumWhiteShadow16_034,
child: AnimatedTextKit(
totalRepeatCount: 1,
animatedTexts: [
TypewriterAnimatedText(
'故事源于《山海经·大荒西经》',
speed: const Duration(milliseconds: 150),
cursor: '',
),
],
onFinished: () {
controller.animatedCount.value++;
},
),
),
)
: Container(),
),
Positioned(
left: 564.w,
bottom: 120.h,
child: controller.animatedCount.value >= 2
? GestureDetector(
onVerticalDragStart: (details) async {
await Get.offAllNamed(Routes.WELCOME);
},
child: Images.up,
)
: Container(),
),
Positioned(
left: 402.w,
bottom: 33.h,
child: controller.animatedCount.value >= 2
? GestureDetector(
onVerticalDragStart: (details) async {
await Get.offAllNamed(Routes.WELCOME);
},
child: Images.splashBegin,
)
: Container(),
),
],
),
);
}
}