| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- import 'dart:io';
- import 'package:clean/module/image_picker/image_picker_util.dart';
- import 'package:clean/module/locations_photo/locations_single_photo_view.dart';
- import 'package:clean/module/people_photo/photo_group.dart';
- import 'package:get/get.dart';
- import 'package:path_provider/path_provider.dart';
- import 'package:path/path.dart' as p;
- import 'package:wechat_assets_picker/wechat_assets_picker.dart';
- class LocationsPhotoController extends GetxController {
- final RxList<PhotoGroup> photoGroups = <PhotoGroup>[].obs;
- @override
- onInit() {
- super.onInit();
- loadLocationPhoto();
- }
- void loadLocationPhoto() {
- photoGroups.clear();
- RxMap<String, List<AssetEntity>> locationPhotos =
- ImagePickerUtil.locationPhotos;
- if (locationPhotos.isNotEmpty) {
- for (var entry in locationPhotos.entries) {
- photoGroups.add(PhotoGroup(
- title: 'photo: ${entry.value.length}',
- imageCount: entry.value.length,
- isSelected: false,
- images: entry.value,
- location: entry.key,
- ));
- }
- }
- }
- void clickPhotoGroup(PhotoGroup photoGroup) {
- print('clickPhotoGroup ${photoGroup.location}');
- LocationsSinglePhotoPage.start(photoGroup: photoGroup);
- }
- PhotoGroup getGroupByLocation(String? location) {
- return photoGroups.firstWhere((group) => group.location == location);
- }
- // PhotoGroup getGroupByImages(List<AssetEntity> images) {
- // final imageIds = images.map((img) => img.id).toSet();
- // return photoGroups.firstWhere((group) =>
- // group.images.every((image) => imageIds.contains(image.id))
- // );
- // }
- }
|