locations_photo_view.dart 5.1 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: "photo: ${group.images.length}",
  35. location: group.location?? '',
  36. imageCount: group.images.length,
  37. ),
  38. SizedBox(height: 15.h),
  39. ],
  40. ))
  41. ],
  42. );
  43. }),
  44. ),
  45. ],
  46. ),
  47. ),
  48. ),
  49. IgnorePointer(
  50. child: Assets.images.bgHome.image(
  51. width: 360.w,
  52. height: 234.h,
  53. ),
  54. ),
  55. ]);
  56. }
  57. Widget _titleCard() {
  58. return Container(
  59. alignment: Alignment.centerLeft,
  60. padding: EdgeInsets.only(left: 16.w, top: 14.h),
  61. child: Column(
  62. crossAxisAlignment: CrossAxisAlignment.start,
  63. children: [
  64. GestureDetector(
  65. onTap: () => Get.back(),
  66. child: Assets.images.iconBackArrow.image(
  67. width: 28.w,
  68. height: 28.h,
  69. ),
  70. ),
  71. SizedBox(height: 12.h),
  72. Text(
  73. 'Places Photos',
  74. style: TextStyle(
  75. color: Colors.white,
  76. fontSize: 24.sp,
  77. fontWeight: FontWeight.w700,
  78. ),
  79. ),
  80. SizedBox(height: 20.h),
  81. ],
  82. ),
  83. );
  84. }
  85. Widget _buildPhotoGroup({
  86. required String location,
  87. required String title,
  88. required int imageCount,
  89. }) {
  90. return Container(
  91. margin: EdgeInsets.only(top: 14.h),
  92. width: 328.w,
  93. height: 227.h,
  94. decoration: ShapeDecoration(
  95. color: Colors.white.withValues(alpha: 0.12),
  96. shape: RoundedRectangleBorder(
  97. borderRadius: BorderRadius.circular(14.sp),
  98. ),
  99. ),
  100. child: Column(
  101. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  102. children: [
  103. Row(
  104. mainAxisAlignment: MainAxisAlignment.start,
  105. children: [
  106. SizedBox(width: 16.w),
  107. Text(
  108. title,
  109. textAlign: TextAlign.center,
  110. style: TextStyle(
  111. color: Colors.white,
  112. fontSize: 14.sp,
  113. fontWeight: FontWeight.w500,
  114. ),
  115. ),
  116. ],
  117. ),
  118. SizedBox(
  119. child: GestureDetector(
  120. onTap: () => controller.clickPhotoGroup(controller.getGroupByLocation(location)),
  121. child: Obx(() {
  122. final group =
  123. controller.getGroupByLocation(location);
  124. final imagePath = group.images.first;
  125. return Stack(
  126. children: [
  127. Container(
  128. width: 304.w,
  129. height: 171.h,
  130. decoration: ShapeDecoration(
  131. color: Colors.white.withValues(alpha: 0.12),
  132. shape: RoundedRectangleBorder(
  133. borderRadius: BorderRadius.circular(8.r),
  134. ),
  135. image: DecorationImage(
  136. image: AssetEntityImageProvider(imagePath),
  137. fit: BoxFit.cover,
  138. ),
  139. ),
  140. ),
  141. Positioned(
  142. left: 1.w,
  143. right: 1.w,
  144. bottom: 16.sp,
  145. child: Text(
  146. location,
  147. textAlign: TextAlign.center,
  148. style: TextStyle(
  149. color: Colors.white,
  150. fontSize: 20.sp,
  151. fontWeight: FontWeight.w500,
  152. ),
  153. ))
  154. ],
  155. );
  156. }),
  157. ),
  158. ),
  159. ],
  160. ),
  161. );
  162. }
  163. }