Skip to content

Commit f2fc776

Browse files
committed
refactor(discover): improve source card and category row UI
- Replace source icon with network image in source card - Add error handling for network image - Implement text truncation for source category title - Adjust layout to use available space more efficiently
1 parent 6cb738a commit f2fc776

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

lib/discover/view/discover_page.dart

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,13 @@ class _SourceCategoryRow extends StatelessWidget {
133133
child: Row(
134134
mainAxisAlignment: MainAxisAlignment.spaceBetween,
135135
children: [
136-
Text(
137-
sourceType.l10nPlural(l10n), // This will now work correctly
138-
style: theme.textTheme.titleLarge,
136+
Expanded(
137+
child: Text(
138+
sourceType.l10nPlural(l10n),
139+
style: theme.textTheme.titleLarge,
140+
maxLines: 1,
141+
overflow: TextOverflow.ellipsis,
142+
),
139143
),
140144
TextButton(
141145
onPressed: () {
@@ -196,7 +200,20 @@ class _SourceCard extends StatelessWidget {
196200
child: Column(
197201
mainAxisAlignment: MainAxisAlignment.center,
198202
children: [
199-
const Icon(Icons.source_outlined, size: AppSpacing.xxl),
203+
Expanded(
204+
child: Padding(
205+
padding: const EdgeInsets.all(AppSpacing.md),
206+
child: Image.network(
207+
source.logoUrl,
208+
fit: BoxFit.contain,
209+
errorBuilder: (context, error, stackTrace) => Icon(
210+
Icons.source_outlined,
211+
size: AppSpacing.xxl,
212+
color: theme.colorScheme.onSurfaceVariant,
213+
),
214+
),
215+
),
216+
),
200217
const SizedBox(height: AppSpacing.sm),
201218
Padding(
202219
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.xs),

0 commit comments

Comments
 (0)