-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
fetchPathProperties
for API 28 (#1161)
Signed-off-by: Caijinglong <[email protected]>
- Loading branch information
1 parent
67f9ba9
commit ad17424
Showing
4 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:oktoast/oktoast.dart'; | ||
import 'package:photo_manager/photo_manager.dart'; | ||
|
||
import 'issue_index_page.dart'; | ||
|
||
class Issus1152 extends StatefulWidget { | ||
const Issus1152({super.key}); | ||
|
||
@override | ||
State<Issus1152> createState() => _Issus1152State(); | ||
} | ||
|
||
class _Issus1152State extends State<Issus1152> with IssueBase<Issus1152> { | ||
@override | ||
List<TargetPlatform>? get supportPlatforms => [ | ||
TargetPlatform.android, | ||
]; | ||
|
||
List<RequestType> checkStatus = []; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
PhotoManager.setLog(true); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return buildScaffold([ | ||
buildButton( | ||
'Test API 28 get images', | ||
reproduce, | ||
), | ||
buildLogWidget(), | ||
]); | ||
} | ||
|
||
@override | ||
int get issueNumber => 1152; | ||
|
||
Future<void> reproduce() async { | ||
final pathList = await PhotoManager.getAssetPathList(); | ||
final noAllPathList = pathList.where((element) => !element.isAll); | ||
if (noAllPathList.isEmpty) { | ||
showToast('No path found'); | ||
return; | ||
} | ||
|
||
final path = noAllPathList.first; | ||
|
||
// final name = path.name; | ||
// final count = await path.assetCountAsync; | ||
// addLog('assetCount of "$name": $count'); | ||
|
||
// final list = await path.getAssetListPaged(page: 0, size: 50); | ||
// addLog('list.length: ${list.length}'); | ||
|
||
await fetchNewProperties(path); | ||
} | ||
|
||
Future<void> fetchNewProperties(AssetPathEntity path) async { | ||
try { | ||
await path.obtainForNewProperties(); | ||
} catch (e) { | ||
addLog('error: $e'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters