✨ Basis personalize
This commit is contained in:
@ -12,6 +12,7 @@ class AttachmentItem extends StatefulWidget {
|
||||
final String url;
|
||||
final String? tag;
|
||||
final String? badge;
|
||||
final bool noTag;
|
||||
|
||||
const AttachmentItem({
|
||||
super.key,
|
||||
@ -19,6 +20,7 @@ class AttachmentItem extends StatefulWidget {
|
||||
required this.url,
|
||||
this.tag,
|
||||
this.badge,
|
||||
this.noTag = false,
|
||||
});
|
||||
|
||||
@override
|
||||
@ -50,7 +52,7 @@ class _AttachmentItemState extends State<AttachmentItem> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
const borderRadius = Radius.circular(8);
|
||||
final tag = getTag();
|
||||
final tag = widget.noTag ? const Uuid().v4() : getTag();
|
||||
|
||||
Widget content;
|
||||
|
||||
@ -128,12 +130,16 @@ class _AttachmentItemState extends State<AttachmentItem> {
|
||||
class AttachmentList extends StatelessWidget {
|
||||
final List<Attachment> items;
|
||||
final String provider;
|
||||
final bool noTag;
|
||||
|
||||
const AttachmentList(
|
||||
{super.key, required this.items, required this.provider});
|
||||
const AttachmentList({
|
||||
super.key,
|
||||
required this.items,
|
||||
required this.provider,
|
||||
this.noTag = false,
|
||||
});
|
||||
|
||||
Uri getFileUri(String fileId) =>
|
||||
getRequestUri(provider, '/api/attachments/o/$fileId');
|
||||
Uri getFileUri(String fileId) => getRequestUri(provider, '/api/attachments/o/$fileId');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -156,6 +162,7 @@ class AttachmentList extends StatelessWidget {
|
||||
tag: item.fileId,
|
||||
url: getFileUri(item.fileId).toString(),
|
||||
badge: items.length <= 1 ? null : badge,
|
||||
noTag: noTag,
|
||||
),
|
||||
);
|
||||
},
|
||||
|
@ -47,8 +47,7 @@ class _PostItemState extends State<PostItem> {
|
||||
}
|
||||
|
||||
void viewComments() {
|
||||
final PagingController<int, Post> commentPaging =
|
||||
PagingController(firstPageKey: 0);
|
||||
final PagingController<int, Post> commentPaging = PagingController(firstPageKey: 0);
|
||||
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
@ -88,12 +87,17 @@ class _PostItemState extends State<PostItem> {
|
||||
Widget renderAttachments() {
|
||||
if (widget.item.modelType == 'article') return Container();
|
||||
|
||||
if (widget.item.attachments != null &&
|
||||
widget.item.attachments!.isNotEmpty) {
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
final isLargeScreen = screenWidth >= 600;
|
||||
|
||||
if (widget.item.attachments != null && widget.item.attachments!.isNotEmpty) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: AttachmentList(
|
||||
items: widget.item.attachments!, provider: 'interactive'),
|
||||
items: widget.item.attachments!,
|
||||
provider: 'interactive',
|
||||
noTag: isLargeScreen && widget.brief,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container();
|
||||
@ -133,9 +137,8 @@ class _PostItemState extends State<PostItem> {
|
||||
);
|
||||
}
|
||||
|
||||
String getAuthorDescribe() => widget.item.author.description.isNotEmpty
|
||||
? widget.item.author.description
|
||||
: 'No description yet.';
|
||||
String getAuthorDescribe() =>
|
||||
widget.item.author.description.isNotEmpty ? widget.item.author.description : 'No description yet.';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -181,8 +184,7 @@ class _PostItemState extends State<PostItem> {
|
||||
children: [
|
||||
...headingParts,
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 12, right: 12, top: 4),
|
||||
padding: const EdgeInsets.only(left: 12, right: 12, top: 4),
|
||||
child: renderContent(),
|
||||
),
|
||||
renderAttachments(),
|
||||
|
Reference in New Issue
Block a user