Compare commits

...

2 Commits

Author SHA1 Message Date
e74aba2d8b 💄 Optimized image browsing 2024-03-24 11:20:59 +08:00
41f456893f 🐛 Bug fixes 2024-03-24 11:07:36 +08:00
4 changed files with 8 additions and 6 deletions

View File

@ -47,11 +47,12 @@ class _ExploreScreenState extends State<ExploreScreen> {
if (res.statusCode == 200) {
final result =
PaginationResult.fromJson(jsonDecode(utf8.decode(res.bodyBytes)));
final isLastPage = (result.data?.length ?? 0) < pageSize;
if (isLastPage) {
final isLastPage = (result.count - pageKey) < pageSize;
if (isLastPage || result.data == null) {
paginationController.appendLastPage(feed);
} 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;
paginationController.appendPage(feed, nextPageKey);
}

View File

@ -22,7 +22,7 @@ class _MomentEditorScreenState extends State<MomentEditorScreen> {
bool showRecommendationBanner = true;
Future<void> postMoment() async {
if (authClient.client == null) return;
if (!await authClient.isAuthorized()) return;
setState(() => isSubmitting = true);
var res = await authClient.client!.post(

View File

@ -51,15 +51,15 @@ class FeedItem extends StatelessWidget {
child: FlutterCarousel(
options: CarouselOptions(
height: 240.0,
viewportFraction: 1.0,
showIndicator: true,
slideIndicator: const CircularSlideIndicator(),
),
items: item.attachments?.map((x) {
return Builder(
builder: (BuildContext context) {
return Container(
return SizedBox(
width: MediaQuery.of(context).size.width,
margin: const EdgeInsets.symmetric(horizontal: 5.0),
child: InkWell(
child: Image.network(
getFileUrl(x.fileId),

View File

@ -12,6 +12,7 @@ class ImageLightbox extends StatelessWidget {
child: Center(
child: SizedBox(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: InteractiveViewer(
boundaryMargin: const EdgeInsets.all(128),
minScale: 0.1,