stashed
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import 'dart:io';
|
||||
import 'dart:async';
|
||||
import 'package:imagini/core/imagini_application.dart';
|
||||
import 'package:imagini/api/imagini_api_repository.dart';
|
||||
import 'package:imagini/graphql/imagini_graphql.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
|
||||
import 'package:photo_manager/photo_manager.dart';
|
||||
|
||||
class HomeBloc{
|
||||
|
||||
final ImaginiApplication _application;
|
||||
@@ -27,6 +30,31 @@ class HomeBloc{
|
||||
|
||||
void _init(){
|
||||
_imaginiAPI = _application.imaginiAPI;
|
||||
_init_photo_manager();
|
||||
}
|
||||
|
||||
void _init_photo_manager() async {
|
||||
var result = await PhotoManager.requestPermission();
|
||||
if (!result) {
|
||||
PhotoManager.openSetting();
|
||||
return;
|
||||
}
|
||||
|
||||
// Gets list of "Albums"
|
||||
List<AssetPathEntity> list = await PhotoManager.getAssetPathList();
|
||||
|
||||
// iOS - Select Gallery (predefined settings?)
|
||||
// TODO: Filters: https://pub.dev/packages/photo_manager#filteroption
|
||||
final assetList = await list[0].getAssetListPaged(0, 50);
|
||||
|
||||
// Example entity. This should be done through a loop
|
||||
AssetEntity currEntity = assetList[0];
|
||||
|
||||
// File, Create, Modified, Title
|
||||
File file = await currEntity.file;
|
||||
DateTime createDt = currEntity.createDateTime;
|
||||
DateTime modifiedDt = currEntity.modifiedDateTime;
|
||||
String title = await currEntity.titleAsync;
|
||||
}
|
||||
|
||||
void dispose(){
|
||||
@@ -34,7 +62,7 @@ class HomeBloc{
|
||||
_authenticatedController.close();
|
||||
}
|
||||
|
||||
Future<CachedNetworkImage> getMedia(int index, derivedContentWidth) async {
|
||||
CachedNetworkImage getMedia(int index, derivedContentWidth) {
|
||||
MediaItems$Query$MediaItemResponse$MediaItem mediaDetails = await getMediaDetails(index);
|
||||
if (mediaDetails == null)
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user