这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/view/widget/media_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class MediaCard extends HookConsumerWidget {
super.key,
required this.account,
required this.files,
this.index = 0,
required this.index,
this.user,
this.fit = BoxFit.contain,
});
Expand All @@ -47,7 +47,10 @@ class MediaCard extends HookConsumerWidget {

@override
Widget build(BuildContext context, WidgetRef ref) {
final file = files[index];
final file = files.elementAtOrNull(index);
if (file == null) {
return const SizedBox.shrink();
}
final (highlightSensitiveMedia, sensitive, openMediaOnDoubleTap) = ref
.watch(
generalSettingsNotifierProvider.select(
Expand Down
73 changes: 73 additions & 0 deletions lib/view/widget/media_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,84 @@ class MediaList extends ConsumerWidget {
child: MediaCard(
account: account,
files: files,
index: 0,
user: user,
fit: fit,
),
),
);
case 2:
return AspectRatio(
aspectRatio: 16 / 9,
child: Row(
children: [
Expanded(
child: MediaCard(
account: account,
files: files,
index: 0,
user: user,
fit: fit,
),
),
const SizedBox(width: 4.0),
Expanded(
child: MediaCard(
account: account,
files: files,
index: 1,
user: user,
fit: fit,
),
),
],
),
);
case 3:
return AspectRatio(
aspectRatio: 16 / 9,
child: Row(
children: [
Expanded(
flex: 3,
child: MediaCard(
account: account,
files: files,
index: 0,
user: user,
fit: fit,
),
),
const SizedBox(width: 4.0),
Expanded(
flex: 2,
child: Column(
children: [
Expanded(
child: MediaCard(
account: account,
files: files,
index: 1,
user: user,
fit: fit,
),
),
const SizedBox(height: 4.0),
Expanded(
child: MediaCard(
account: account,
files: files,
index: 2,
user: user,
fit: fit,
),
),
],
),
),
],
),
);
default:
return GridView.count(
physics: const NeverScrollableScrollPhysics(),
Expand Down
Loading