location_analyse_page.dart 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter/src/widgets/framework.dart';
  4. import 'package:flutter_screenutil/flutter_screenutil.dart';
  5. import 'package:get/get.dart';
  6. import 'package:get/get_core/src/get_main.dart';
  7. import 'package:location/base/base_page.dart';
  8. import 'package:location/resource/colors.gen.dart';
  9. import 'package:location/router/app_pages.dart';
  10. import 'package:location/utils/common_expand.dart';
  11. import 'package:lottie/lottie.dart';
  12. import 'package:video_player/video_player.dart';
  13. import '../../resource/assets.gen.dart';
  14. import '../../widget/common_view.dart';
  15. import 'location_analyse_controller.dart';
  16. class LocationAnalysePage extends BasePage<LocationAnalyseController> {
  17. LocationAnalysePage({super.key}) {
  18. Get.lazyPut(() => LocationAnalyseController(), fenix: true);
  19. }
  20. static void start() {
  21. Get.toNamed(RoutePath.locationAnalyse);
  22. }
  23. @override
  24. bool immersive() {
  25. return true;
  26. }
  27. @override
  28. Widget buildBody(BuildContext context) {
  29. return Container(
  30. width: double.infinity,
  31. height: double.infinity,
  32. decoration: BoxDecoration(
  33. gradient: LinearGradient(colors: [
  34. ColorName.white,
  35. '#D8D8FE'.color,
  36. ], begin: Alignment.topCenter, end: Alignment.bottomCenter)),
  37. child: Stack(
  38. children: [buildBackBtnView(), buildAnalyseView()],
  39. ),
  40. );
  41. }
  42. Widget buildAnalyseView() {
  43. return SizedBox(
  44. width: double.infinity,
  45. height: double.infinity,
  46. child: SingleChildScrollView(
  47. child: Column(
  48. children: [
  49. buildAIAnalyseView(),
  50. ],
  51. )),
  52. );
  53. }
  54. Widget buildAIAnalyseView() {
  55. return Stack(
  56. alignment: Alignment.center,
  57. children: [
  58. Assets.images.bgLocationAnalyse.image(width: double.infinity),
  59. buildRobotView(),
  60. Lottie.asset(
  61. Assets.anim.locationLabel,
  62. delegates: LottieDelegates(
  63. values: [
  64. ValueDelegate.text(['健身房', '健身房'], value: '占位符啊123')
  65. ],
  66. ),
  67. )
  68. ],
  69. );
  70. }
  71. Widget buildRobotView() {
  72. return SizedBox(
  73. width: 248.w,
  74. height: 248.w,
  75. child: Stack(
  76. children: [
  77. Assets.images.bgLocationAnalyseAi
  78. .image(width: double.infinity, height: double.infinity),
  79. Center(
  80. child: ClipOval(
  81. child: SizedBox(
  82. width: 144.w,
  83. height: 144.w,
  84. child: Obx(() {
  85. if (!controller.videoReady) {
  86. return Center(child: Text('视频还没准备好'));
  87. }
  88. return Transform.scale(
  89. scale: 1.012, // 放大 3%,可以试试 1.01 ~ 1.05
  90. child: VideoPlayer(controller.bgController),
  91. );
  92. }),
  93. ),
  94. ),
  95. )
  96. ],
  97. ),
  98. );
  99. }
  100. Widget buildBackBtnView() {
  101. return SafeArea(
  102. child: GestureDetector(
  103. onTap: controller.back,
  104. child: Container(
  105. margin: EdgeInsets.only(top: 14.w, left: 12.w),
  106. decoration: BoxDecoration(boxShadow: [
  107. BoxShadow(
  108. color: Colors.black.withOpacity(0.05),
  109. blurRadius: 10.w,
  110. offset: Offset(0, 2.w),
  111. ),
  112. ]),
  113. child: CommonView.getBackBtnView(),
  114. ),
  115. ),
  116. );
  117. }
  118. }