-
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: the end of
PhotoManager.getAssetListRange
- Loading branch information
1 parent
1819691
commit 194134b
Showing
4 changed files
with
93 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:oktoast/oktoast.dart'; | ||
import 'package:photo_manager/photo_manager.dart'; | ||
|
||
import 'issue_index_page.dart'; | ||
|
||
class Issue962 extends StatefulWidget { | ||
const Issue962({Key? key}) : super(key: key); | ||
|
||
@override | ||
State<Issue962> createState() => _Issue962State(); | ||
} | ||
|
||
class _Issue962State extends State<Issue962> with IssueBase<Issue962> { | ||
int start = 0; | ||
int end = 5; | ||
|
||
ValueNotifier<String> logNotifier = ValueNotifier<String>(''); | ||
|
||
void onChange() async { | ||
if (start >= end) { | ||
logNotifier.value = 'start must less than end'; | ||
return; | ||
} | ||
|
||
final assetList = await PhotoManager.getAssetListRange( | ||
start: start, | ||
end: end, | ||
filterOption: FilterOptionGroup( | ||
imageOption: const FilterOption(needTitle: true), | ||
videoOption: const FilterOption(needTitle: true), | ||
orders: [ | ||
const OrderOption(type: OrderOptionType.createDate), | ||
], | ||
), | ||
); | ||
|
||
logNotifier.value = 'The assetList count: ${assetList.length}'; | ||
} | ||
|
||
final node = FocusScopeNode(); | ||
|
||
@override | ||
void dispose() { | ||
node.dispose(); | ||
super.dispose(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return buildScaffold([ | ||
TextFormField( | ||
initialValue: start.toString(), | ||
decoration: const InputDecoration( | ||
labelText: 'start', | ||
), | ||
onChanged: (value) { | ||
start = int.tryParse(value) ?? 0; | ||
onChange(); | ||
}, | ||
), | ||
TextFormField( | ||
initialValue: end.toString(), | ||
decoration: const InputDecoration( | ||
labelText: 'end', | ||
), | ||
onChanged: (value) { | ||
end = int.tryParse(value) ?? 0; | ||
onChange(); | ||
}, | ||
), | ||
buildButton('Reproduct issue 962', onChange), | ||
AnimatedBuilder( | ||
animation: logNotifier, | ||
builder: (context, w) { | ||
return Text( | ||
logNotifier.value, | ||
style: const TextStyle( | ||
fontSize: 12, | ||
), | ||
); | ||
}, | ||
), | ||
]); | ||
} | ||
|
||
@override | ||
int get issueNumber => 962; | ||
} |
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