splash_view.dart 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 safeArea => false;
  16. @override
  17. bool get resizeToAvoidBottomInset => false;
  18. @override
  19. Widget buildContent(BuildContext context) {
  20. return SafeArea(
  21. child: Column(
  22. children: [
  23. Expanded(child: _buildContent()),
  24. // 底部内容
  25. _buildBottomContent(),
  26. ],
  27. ),
  28. );
  29. }
  30. // 已登录状态的内容
  31. Widget _buildContent() {
  32. return Center(
  33. child: Stack(
  34. alignment: Alignment.topCenter,
  35. children: [
  36. Container(
  37. margin: EdgeInsets.only(top: 120.w),
  38. child: IXImage(
  39. source: Assets.splashCenterBg,
  40. width: 356.w,
  41. height: 356.w,
  42. sourceType: ImageSourceType.asset,
  43. ),
  44. ),
  45. Container(
  46. margin: EdgeInsets.only(top: 52.w),
  47. child: IXImage(
  48. source: Assets.splashLogo,
  49. width: 104.w,
  50. height: 148.w,
  51. sourceType: ImageSourceType.asset,
  52. ),
  53. ),
  54. ],
  55. ),
  56. );
  57. }
  58. // 构建底部内容
  59. Widget _buildBottomContent() {
  60. return Container(
  61. padding: EdgeInsets.only(bottom: 20.h),
  62. child: Obx(
  63. () => !controller.hasLogin
  64. ? FadeInUp(
  65. duration: const Duration(milliseconds: 700),
  66. delay: const Duration(milliseconds: 800),
  67. child: PrivacyAgreement(
  68. textColor: Get.reactiveTheme.textTheme.bodyLarge!.color,
  69. linkColor: Get.reactiveTheme.primaryColor,
  70. height: 1.8,
  71. ),
  72. )
  73. : FadeInUp(
  74. duration: const Duration(milliseconds: 600),
  75. child: Column(
  76. children: [
  77. Obx(
  78. () => controller.showLoading
  79. ? SpinKitRing(
  80. size: 24.w,
  81. lineWidth: 2.w,
  82. color: Get.reactiveTheme.primaryColor,
  83. )
  84. : const SizedBox.shrink(),
  85. ),
  86. 16.verticalSpaceFromWidth,
  87. Text(
  88. 'V${controller.versionName}',
  89. textAlign: TextAlign.center,
  90. style: TextStyle(
  91. color: Get.reactiveTheme.textTheme.bodyLarge!.color,
  92. fontSize: 14.sp,
  93. ),
  94. ),
  95. ],
  96. ),
  97. ),
  98. ),
  99. );
  100. }
  101. }