🐛 Fix album page user cache issue

This commit is contained in:
LittleSheep 2024-12-08 11:30:20 +08:00
parent ed4fcf9944
commit be9b3f76d2
2 changed files with 5 additions and 1 deletions

View File

@ -59,7 +59,7 @@ class NavigationProvider extends ChangeNotifier {
label: 'screenRealm',
),
AppNavDestination(
icon: Icon(Symbols.album, weight: 400, opticalSize: 20),
icon: Icon(Symbols.photo_library, weight: 400, opticalSize: 20),
screen: 'album',
label: 'screenAlbum',
),

View File

@ -5,6 +5,7 @@ import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:provider/provider.dart';
import 'package:styled_widget/styled_widget.dart';
import 'package:surface/providers/sn_network.dart';
import 'package:surface/providers/user_directory.dart';
import 'package:surface/types/attachment.dart';
import 'package:surface/widgets/app_bar_leading.dart';
import 'package:surface/widgets/attachment/attachment_zoom.dart';
@ -35,6 +36,7 @@ class _AlbumScreenState extends State<AlbumScreen> {
try {
final sn = context.read<SnNetworkProvider>();
final ud = context.read<UserDirectoryProvider>();
final resp = await sn.client.get('/cgi/uc/attachments', queryParameters: {
'take': 10,
'offset': _attachments.length,
@ -45,6 +47,8 @@ class _AlbumScreenState extends State<AlbumScreen> {
_attachments.addAll(attachments);
_heroTags.addAll(_attachments.map((_) => uuid.v4()));
await ud.listAccount(attachments.map((e) => e.accountId).toSet());
_totalCount = resp.data['count'] as int?;
} catch (err) {
if (!mounted) return;