| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238 |
- import 'dart:io';
- import 'package:clean/base/base_page.dart';
- import 'package:clean/module/locations_photo/locations_photo_controller.dart';
- import 'package:clean/resource/assets.gen.dart';
- import 'package:clean/router/app_pages.dart';
- import 'package:flutter/Material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:get/get.dart';
- import 'package:wechat_assets_picker/wechat_assets_picker.dart';
- class LocationsPhotoPage extends BasePage<LocationsPhotoController> {
- @override
- bool statusBarDarkFont() => false;
- @override
- bool immersive() => true;
- static void start() {
- Get.toNamed(RoutePath.locationsPhoto);
- }
- @override
- Widget buildBody(BuildContext context) {
- return Stack(children: [
- Container(
- child: SafeArea(
- child: Obx(() {
- if (controller.photoGroups.isEmpty) {
- return _noNoPicturesCard();
- } else {
- return photoDateCard();
- }
- }),
- ),
- ),
- IgnorePointer(
- child: Assets.images.bgHome.image(
- width: 360.w,
- ),
- ),
- ]);
- }
- Widget photoDateCard() {
- return Column(
- children: [
- _titleCard(),
- Expanded(
- child: Obx(() {
- return ListView(
- padding: EdgeInsets.symmetric(horizontal: 16.w),
- children: [
- ...controller.photoGroups.map((group) => Column(
- children: [
- _buildPhotoGroup(
- title: "photo: ${group.images.length}",
- location: group.location ?? '',
- imageCount: group.images.length,
- ),
- SizedBox(height: 15.h),
- ],
- ))
- ],
- );
- }),
- ),
- ],
- );
- }
- Widget _titleCard() {
- return Container(
- alignment: Alignment.centerLeft,
- padding: EdgeInsets.only(left: 16.w, top: 14.h),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- GestureDetector(
- onTap: () => Get.back(),
- child: Assets.images.iconBackArrow.image(
- width: 28.w,
- height: 28.h,
- ),
- ),
- (controller.photoGroups.isEmpty)
- ? const SizedBox()
- : Column(
- children: [
- SizedBox(height: 12.h),
- Text(
- 'Places Photos',
- style: TextStyle(
- color: Colors.white,
- fontSize: 24.sp,
- fontWeight: FontWeight.w700,
- ),
- ),
- SizedBox(height: 20.h),
- ],
- )
- ],
- ),
- );
- }
- Widget _buildPhotoGroup({
- required String location,
- required String title,
- required int imageCount,
- }) {
- return Container(
- margin: EdgeInsets.only(top: 14.h),
- width: 328.w,
- height: 227.h,
- decoration: ShapeDecoration(
- color: Colors.white.withValues(alpha: 0.12),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(14.sp),
- ),
- ),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- SizedBox(width: 16.w),
- Text(
- title,
- textAlign: TextAlign.center,
- style: TextStyle(
- color: Colors.white,
- fontSize: 14.sp,
- fontWeight: FontWeight.w500,
- ),
- ),
- ],
- ),
- SizedBox(
- child: GestureDetector(
- onTap: () => controller
- .clickPhotoGroup(controller.getGroupByLocation(location)),
- child: Obx(() {
- final group = controller.getGroupByLocation(location);
- final imagePath =
- group.images.isNotEmpty ? group.images.first : null;
- return imagePath != null
- ? Stack(
- children: [
- Container(
- width: 304.w,
- height: 171.h,
- decoration: ShapeDecoration(
- color: Colors.white.withValues(alpha: 0.12),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(8.r),
- ),
- image: DecorationImage(
- image: AssetEntityImageProvider(
- imagePath,
- thumbnailSize:
- const ThumbnailSize.square(300),
- isOriginal: false,
- ),
- fit: BoxFit.cover,
- ),
- ),
- ),
- Positioned(
- left: 1.w,
- right: 1.w,
- bottom: 16.sp,
- child: Text(
- location,
- textAlign: TextAlign.center,
- style: TextStyle(
- color: Colors.white,
- fontSize: 20.sp,
- fontWeight: FontWeight.w500,
- ),
- ))
- ],
- )
- : Container();
- }),
- ),
- ),
- ],
- ),
- );
- }
- Widget _noNoPicturesCard() {
- return Column(
- // mainAxisAlignment: MainAxisAlignment.start,
- children: [
- _titleCard(),
- SizedBox(
- height: 170.h,
- ),
- Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Container(
- width: 70.w,
- height: 70.h,
- clipBehavior: Clip.antiAlias,
- decoration: BoxDecoration(),
- child: Assets.images.iconNoPictures.image(),
- ),
- SizedBox(height: 22.h),
- Text(
- 'No pictures found',
- textAlign: TextAlign.center,
- style: TextStyle(
- color: Colors.white,
- fontSize: 20.sp,
- fontWeight: FontWeight.w700,
- ),
- ),
- SizedBox(height: 12.h),
- Text(
- 'No pictures available at the moment',
- textAlign: TextAlign.center,
- style: TextStyle(
- color: Colors.white.withValues(alpha: 0.6),
- fontSize: 14.sp,
- fontWeight: FontWeight.w400,
- ),
- ),
- ],
- ),
- ],
- );
- }
- }
|