locations_photo_view.dart 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. import 'dart:io';
  2. import 'package:clean/base/base_page.dart';
  3. import 'package:clean/module/locations_photo/locations_photo_controller.dart';
  4. import 'package:clean/resource/assets.gen.dart';
  5. import 'package:clean/router/app_pages.dart';
  6. import 'package:flutter/Material.dart';
  7. import 'package:flutter_screenutil/flutter_screenutil.dart';
  8. import 'package:get/get.dart';
  9. import 'package:wechat_assets_picker/wechat_assets_picker.dart';
  10. class LocationsPhotoPage extends BasePage<LocationsPhotoController> {
  11. @override
  12. bool statusBarDarkFont() => false;
  13. @override
  14. bool immersive() => true;
  15. static void start() {
  16. Get.toNamed(RoutePath.locationsPhoto);
  17. }
  18. @override
  19. Widget buildBody(BuildContext context) {
  20. return Stack(children: [
  21. Container(
  22. child: SafeArea(
  23. child: Column(
  24. children: [
  25. _titleCard(),
  26. Expanded(
  27. child: Obx(() {
  28. return ListView(
  29. padding: EdgeInsets.symmetric(horizontal: 16.w),
  30. children: [
  31. ...controller.photoGroups.map((group) => Column(
  32. children: [
  33. _buildPhotoGroup(
  34. title: group.title,
  35. imageCount: group.imageCount,
  36. ),
  37. SizedBox(height: 15.h),
  38. ],
  39. ))
  40. ],
  41. );
  42. }),
  43. ),
  44. ],
  45. ),
  46. ),
  47. ),
  48. IgnorePointer(
  49. child: Assets.images.bgHome.image(
  50. width: 360.w,
  51. height: 234.h,
  52. ),
  53. ),
  54. ]);
  55. }
  56. Widget _titleCard() {
  57. return Container(
  58. alignment: Alignment.centerLeft,
  59. padding: EdgeInsets.only(left: 16.w, top: 14.h),
  60. child: Column(
  61. crossAxisAlignment: CrossAxisAlignment.start,
  62. children: [
  63. GestureDetector(
  64. onTap: () => Get.back(),
  65. child: Assets.images.iconBackArrow.image(
  66. width: 28.w,
  67. height: 28.h,
  68. ),
  69. ),
  70. SizedBox(height: 12.h),
  71. Text(
  72. 'Places Photos',
  73. style: TextStyle(
  74. color: Colors.white,
  75. fontSize: 24.sp,
  76. fontWeight: FontWeight.w700,
  77. ),
  78. ),
  79. SizedBox(height: 20.h),
  80. ],
  81. ),
  82. );
  83. }
  84. Widget _buildPhotoGroup({
  85. required String title,
  86. required int imageCount,
  87. }) {
  88. return Container(
  89. margin: EdgeInsets.only(top: 14.h),
  90. width: 328.w,
  91. height: 227.h,
  92. decoration: ShapeDecoration(
  93. color: Colors.white.withValues(alpha: 0.12),
  94. shape: RoundedRectangleBorder(
  95. borderRadius: BorderRadius.circular(14.sp),
  96. ),
  97. ),
  98. child: Column(
  99. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  100. children: [
  101. Row(
  102. mainAxisAlignment: MainAxisAlignment.start,
  103. children: [
  104. SizedBox(width: 16.w),
  105. Text(
  106. title,
  107. textAlign: TextAlign.center,
  108. style: TextStyle(
  109. color: Colors.white,
  110. fontSize: 14.sp,
  111. fontWeight: FontWeight.w500,
  112. ),
  113. ),
  114. ],
  115. ),
  116. SizedBox(
  117. child: GestureDetector(
  118. // onTap: () => controller.toggleImageSelection(title, 0),
  119. child: Obx(() {
  120. final group =
  121. controller.photoGroups.firstWhere((g) => g.title == title);
  122. final imagePath = group.images[0];
  123. final location = group.location?.value?? '';
  124. return Stack(
  125. children: [
  126. Container(
  127. width: 304.w,
  128. height: 171.h,
  129. decoration: ShapeDecoration(
  130. color: Colors.white.withValues(alpha: 0.12),
  131. shape: RoundedRectangleBorder(
  132. borderRadius: BorderRadius.circular(8.r),
  133. ),
  134. image: DecorationImage(
  135. image: AssetEntityImageProvider(imagePath),
  136. fit: BoxFit.cover,
  137. ),
  138. ),
  139. ),
  140. Positioned(
  141. left: 1.w,
  142. right: 1.w,
  143. bottom: 16.sp,
  144. child: Text(
  145. location,
  146. textAlign: TextAlign.center,
  147. style: TextStyle(
  148. color: Colors.white,
  149. fontSize: 20.sp,
  150. fontWeight: FontWeight.w500,
  151. ),
  152. ))
  153. ],
  154. );
  155. }),
  156. ),
  157. ),
  158. ],
  159. ),
  160. );
  161. }
  162. }