location_analyse_page.dart 3.1 KB

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