🐛 Bug fixes
This commit is contained in:
parent
06b4cb863e
commit
41f456893f
@ -47,11 +47,12 @@ class _ExploreScreenState extends State<ExploreScreen> {
|
|||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
final result =
|
final result =
|
||||||
PaginationResult.fromJson(jsonDecode(utf8.decode(res.bodyBytes)));
|
PaginationResult.fromJson(jsonDecode(utf8.decode(res.bodyBytes)));
|
||||||
final isLastPage = (result.data?.length ?? 0) < pageSize;
|
final isLastPage = (result.count - pageKey) < pageSize;
|
||||||
if (isLastPage) {
|
if (isLastPage || result.data == null) {
|
||||||
paginationController.appendLastPage(feed);
|
paginationController.appendLastPage(feed);
|
||||||
} else {
|
} else {
|
||||||
final feed = result.data!.map((x) => Feed.fromJson(x)).toList();
|
final feed =
|
||||||
|
result.data?.map((x) => Feed.fromJson(x)).toList() ?? List.empty();
|
||||||
final nextPageKey = pageKey + feed.length;
|
final nextPageKey = pageKey + feed.length;
|
||||||
paginationController.appendPage(feed, nextPageKey);
|
paginationController.appendPage(feed, nextPageKey);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ class _MomentEditorScreenState extends State<MomentEditorScreen> {
|
|||||||
bool showRecommendationBanner = true;
|
bool showRecommendationBanner = true;
|
||||||
|
|
||||||
Future<void> postMoment() async {
|
Future<void> postMoment() async {
|
||||||
if (authClient.client == null) return;
|
if (!await authClient.isAuthorized()) return;
|
||||||
|
|
||||||
setState(() => isSubmitting = true);
|
setState(() => isSubmitting = true);
|
||||||
var res = await authClient.client!.post(
|
var res = await authClient.client!.post(
|
||||||
|
Reference in New Issue
Block a user