mirror of
https://github.com/feeddeck/feeddeck.git
synced 2026-04-29 19:11:45 -05:00
[core] Remove Blank in Item Preview Description (#86)
This commit removes all blank lines in the item preview description, so that we do not render a blank line as the last line. This was done to improve the style of the item previews, which looked ugly when the last line was a blank line.
This commit is contained in:
@@ -81,6 +81,10 @@ class ItemDescription extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// [_buildPlain] renders the provided [content] as plain text.
|
/// [_buildPlain] renders the provided [content] as plain text.
|
||||||
|
///
|
||||||
|
/// To not have some trailing newlines, the [content] is trimmed and splitted
|
||||||
|
/// on newline characters, so that we can filter out empty lines, before the
|
||||||
|
/// the content is rendered.
|
||||||
Widget _buildPlain(String content) {
|
Widget _buildPlain(String content) {
|
||||||
if (content == '') {
|
if (content == '') {
|
||||||
return Container();
|
return Container();
|
||||||
@@ -91,7 +95,7 @@ class ItemDescription extends StatelessWidget {
|
|||||||
bottom: Constants.spacingExtraSmall,
|
bottom: Constants.spacingExtraSmall,
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
content.trim(),
|
content.trim().split('\n').where((line) => line != '').join('\n'),
|
||||||
maxLines: 5,
|
maxLines: 5,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
|
|||||||
Reference in New Issue
Block a user