💄 Optimized post editor

This commit is contained in:
2024-08-16 21:06:50 +08:00
parent af93a8386a
commit cf767a1d94
5 changed files with 132 additions and 100 deletions

View File

@@ -15,6 +15,7 @@ class AttachmentItem extends StatefulWidget {
final Attachment item;
final bool showBadge;
final bool showHideButton;
final bool autoload;
final BoxFit fit;
final String? badge;
final Function? onHide;
@@ -27,6 +28,7 @@ class AttachmentItem extends StatefulWidget {
this.fit = BoxFit.cover,
this.showBadge = true,
this.showHideButton = true,
this.autoload = false,
this.onHide,
});
@@ -49,7 +51,10 @@ class _AttachmentItemState extends State<AttachmentItem> {
onHide: widget.onHide,
);
case 'video':
return _AttachmentItemVideo(item: widget.item);
return _AttachmentItemVideo(
item: widget.item,
autoload: widget.autoload,
);
default:
return Center(
child: Container(

View File

@@ -17,6 +17,7 @@ class AttachmentList extends StatefulWidget {
final List<int> attachmentsId;
final bool isGrid;
final bool isForceGrid;
final bool autoload;
final double flatMaxHeight;
final double? width;
@@ -28,6 +29,7 @@ class AttachmentList extends StatefulWidget {
required this.attachmentsId,
this.isGrid = false,
this.isForceGrid = false,
this.autoload = false,
this.flatMaxHeight = 720,
this.width,
this.viewport,
@@ -208,6 +210,7 @@ class AttachmentListEntry extends StatelessWidget {
final bool showBadge;
final bool showMature;
final bool isDense;
final bool autoload;
final Function(bool) onReveal;
const AttachmentListEntry({
@@ -221,6 +224,7 @@ class AttachmentListEntry extends StatelessWidget {
this.showBadge = false,
this.showMature = false,
this.isDense = false,
this.autoload = false,
});
@override
@@ -259,6 +263,7 @@ class AttachmentListEntry extends StatelessWidget {
item: item!,
badge: showBadge ? badgeContent : null,
showHideButton: !item!.isMature || showMature,
autoload: autoload,
onHide: () {
onReveal(false);
},