mirror of
https://github.com/feeddeck/feeddeck.git
synced 2026-03-12 01:54:51 -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.
|
||||
///
|
||||
/// 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) {
|
||||
if (content == '') {
|
||||
return Container();
|
||||
@@ -91,7 +95,7 @@ class ItemDescription extends StatelessWidget {
|
||||
bottom: Constants.spacingExtraSmall,
|
||||
),
|
||||
child: Text(
|
||||
content.trim(),
|
||||
content.trim().split('\n').where((line) => line != '').join('\n'),
|
||||
maxLines: 5,
|
||||
style: const TextStyle(
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
||||
Reference in New Issue
Block a user