Skip to content

Commit dd5f7c1

Browse files
committed
refactor(entity_details): improve entity icon display and remove description
- Update entity icon padding, size, and error handling - Remove unused description section from the UI - Adjust layout for better alignment and consistency
1 parent e828106 commit dd5f7c1

File tree

1 file changed

+10
-42
lines changed

1 file changed

+10
-42
lines changed

lib/entity_details/view/entity_details_page.dart

Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,6 @@ class _EntityDetailsViewState extends State<EntityDetailsView> {
156156
appBarTitleText = l10n.detailsPageTitle;
157157
}
158158

159-
final description = state.entity is Topic
160-
? (state.entity! as Topic).description
161-
: state.entity is Source
162-
? (state.entity! as Source).description
163-
: state.entity is Country
164-
? (state.entity! as Country)
165-
.name // Using name as description for country
166-
: null;
167-
168159
final followButton = IconButton(
169160
icon: Icon(
170161
state.isFollowing ? Icons.check_circle : Icons.add_circle_outline,
@@ -191,28 +182,32 @@ class _EntityDetailsViewState extends State<EntityDetailsView> {
191182
children: [
192183
if (entityIconUrl != null)
193184
Padding(
194-
padding: const EdgeInsets.only(right: AppSpacing.sm),
185+
padding: Directionality.of(context) == TextDirection.ltr
186+
? const EdgeInsets.only(right: AppSpacing.md)
187+
: const EdgeInsets.only(left: AppSpacing.md),
195188
child: ClipRRect(
196189
borderRadius: BorderRadius.circular(AppSpacing.xs),
197190
child: Image.network(
198191
entityIconUrl,
199-
width: kToolbarHeight - AppSpacing.lg,
200-
height: kToolbarHeight - AppSpacing.lg,
192+
width: AppSpacing.xxl,
193+
height: AppSpacing.xxl,
201194
fit: BoxFit.contain,
202195
errorBuilder: (context, error, stackTrace) => Icon(
203196
appBarIconData ?? Icons.info_outline,
204-
size: kToolbarHeight - AppSpacing.xl,
197+
size: AppSpacing.xxl,
205198
color: colorScheme.onSurfaceVariant,
206199
),
207200
),
208201
),
209202
)
210203
else if (appBarIconData != null)
211204
Padding(
212-
padding: const EdgeInsets.only(right: AppSpacing.sm),
205+
padding: Directionality.of(context) == TextDirection.ltr
206+
? const EdgeInsets.only(right: AppSpacing.md)
207+
: const EdgeInsets.only(left: AppSpacing.md),
213208
child: Icon(
214209
appBarIconData,
215-
size: kToolbarHeight - AppSpacing.xl,
210+
size: AppSpacing.xxl,
216211
color: colorScheme.onSurface,
217212
),
218213
),
@@ -251,33 +246,6 @@ class _EntityDetailsViewState extends State<EntityDetailsView> {
251246
const SizedBox(width: AppSpacing.sm),
252247
],
253248
),
254-
SliverPadding(
255-
padding: const EdgeInsets.all(AppSpacing.paddingMedium),
256-
sliver: SliverList(
257-
delegate: SliverChildListDelegate([
258-
if (description != null && description.isNotEmpty) ...[
259-
Text(
260-
description,
261-
style: textTheme.bodyLarge?.copyWith(
262-
color: colorScheme.onSurfaceVariant,
263-
height: 1.5,
264-
),
265-
),
266-
const SizedBox(height: AppSpacing.lg),
267-
],
268-
if (state.feedItems.isNotEmpty ||
269-
state.status == EntityDetailsStatus.loadingMore) ...[
270-
Text(
271-
l10n.headlinesSectionTitle,
272-
style: textTheme.titleLarge?.copyWith(
273-
fontWeight: FontWeight.bold,
274-
),
275-
),
276-
const Divider(height: AppSpacing.lg, thickness: 1),
277-
],
278-
]),
279-
),
280-
),
281249
if (state.feedItems.isEmpty &&
282250
state.status != EntityDetailsStatus.initial &&
283251
state.status != EntityDetailsStatus.loadingMore &&

0 commit comments

Comments
 (0)