44 lines
1.2 KiB
Dart
44 lines
1.2 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||
|
import 'package:solaragent/models/feed.dart';
|
||
|
|
||
|
class FeedItem extends StatelessWidget {
|
||
|
final Feed item;
|
||
|
|
||
|
const FeedItem({super.key, required this.item});
|
||
|
|
||
|
String getDescription(String desc) =>
|
||
|
desc.isEmpty ? "No description yet." : desc;
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Container(
|
||
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||
|
child: Column(
|
||
|
children: [
|
||
|
Container(
|
||
|
color: Colors.grey[50],
|
||
|
child: ListTile(
|
||
|
title: Text(item.author.name),
|
||
|
leading: CircleAvatar(
|
||
|
backgroundImage: NetworkImage(item.author.avatar),
|
||
|
),
|
||
|
subtitle: Text(
|
||
|
getDescription(item.author.description),
|
||
|
overflow: TextOverflow.ellipsis,
|
||
|
maxLines: 1,
|
||
|
softWrap: false,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
Markdown(
|
||
|
data: item.content,
|
||
|
shrinkWrap: true,
|
||
|
physics: const NeverScrollableScrollPhysics(),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|