splash_view.dart 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import 'package:animate_do/animate_do.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import 'package:flutter_spinkit/flutter_spinkit.dart';
  5. import 'package:get/get.dart';
  6. import 'package:nomo/app/base/base_view.dart';
  7. import 'package:nomo/app/widgets/ix_image.dart';
  8. import 'package:nomo/config/theme/theme_extensions/theme_extension.dart';
  9. import '../../../constants/assets.dart';
  10. import '../../../widgets/privacy_agreement.dart';
  11. import '../controllers/splash_controller.dart';
  12. class SplashView extends BaseView<SplashController> {
  13. const SplashView({super.key});
  14. @override
  15. bool get resizeToAvoidBottomInset => false;
  16. @override
  17. Widget buildContent(BuildContext context) {
  18. return SafeArea(
  19. child: Column(
  20. children: [
  21. Expanded(child: _buildContent()),
  22. // 底部内容
  23. _buildBottomContent(),
  24. ],
  25. ),
  26. );
  27. }
  28. // 已登录状态的内容
  29. Widget _buildContent() {
  30. return Center(
  31. child: Stack(
  32. alignment: Alignment.topCenter,
  33. children: [
  34. Container(
  35. margin: EdgeInsets.only(top: 120.w),
  36. child: IXImage(
  37. source: Assets.splashCenterBg,
  38. width: 356.w,
  39. height: 356.w,
  40. sourceType: ImageSourceType.asset,
  41. ),
  42. ),
  43. Container(
  44. margin: EdgeInsets.only(top: 52.w),
  45. child: IXImage(
  46. source: Assets.splashLogo,
  47. width: 104.w,
  48. height: 148.w,
  49. sourceType: ImageSourceType.asset,
  50. ),
  51. ),
  52. ],
  53. ),
  54. );
  55. }
  56. // 构建底部内容
  57. Widget _buildBottomContent() {
  58. return Obx(
  59. () => !controller.hasLogin
  60. ? FadeInUp(
  61. duration: const Duration(milliseconds: 700),
  62. delay: const Duration(milliseconds: 800),
  63. child: PrivacyAgreement(
  64. textColor: Get.reactiveTheme.textTheme.bodyLarge!.color,
  65. linkColor: Get.reactiveTheme.primaryColor,
  66. height: 1.8,
  67. ),
  68. )
  69. : FadeInUp(
  70. duration: const Duration(milliseconds: 600),
  71. child: Column(
  72. children: [
  73. Obx(
  74. () => controller.showLoading
  75. ? SpinKitRing(
  76. size: 24.w,
  77. lineWidth: 2.w,
  78. color: Get.reactiveTheme.primaryColor,
  79. )
  80. : const SizedBox.shrink(),
  81. ),
  82. 16.verticalSpaceFromWidth,
  83. Text(
  84. 'V${controller.versionName}',
  85. textAlign: TextAlign.center,
  86. style: TextStyle(
  87. color: Get.reactiveTheme.textTheme.bodyLarge!.color,
  88. fontSize: 14.sp,
  89. ),
  90. ),
  91. ],
  92. ),
  93. ),
  94. );
  95. }
  96. }