Skip to content

Fix_feed_setting_not_applied #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/account/bloc/account_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ class AccountState extends Equatable {
status: status ?? this.status,
user: clearUser ? null : user ?? this.user,
preferences: clearPreferences ? null : preferences ?? this.preferences,
errorMessage:
clearErrorMessage ? null : errorMessage ?? this.errorMessage,
errorMessage: clearErrorMessage
? null
: errorMessage ?? this.errorMessage,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ class AddCategoryToFollowPage extends StatelessWidget {
final textTheme = theme.textTheme; // Get textTheme

return BlocProvider(
create:
(context) => CategoriesFilterBloc(
categoriesRepository: context.read<HtDataRepository<Category>>(),
)..add(CategoriesFilterRequested()),
create: (context) => CategoriesFilterBloc(
categoriesRepository: context.read<HtDataRepository<Category>>(),
)..add(CategoriesFilterRequested()),
child: Scaffold(
appBar: AppBar(
title: Text(
Expand Down Expand Up @@ -56,10 +55,9 @@ class AddCategoryToFollowPage extends StatelessWidget {
}
return FailureStateWidget(
message: errorMessage,
onRetry:
() => context.read<CategoriesFilterBloc>().add(
CategoriesFilterRequested(),
),
onRetry: () => context.read<CategoriesFilterBloc>().add(
CategoriesFilterRequested(),
),
);
}
if (categoriesState.categories.isEmpty &&
Expand All @@ -79,23 +77,23 @@ class AddCategoryToFollowPage extends StatelessWidget {
categoriesState.status == CategoriesFilterStatus.loadingMore;

return BlocBuilder<AccountBloc, AccountState>(
buildWhen:
(previous, current) =>
previous.preferences?.followedCategories !=
current.preferences?.followedCategories ||
previous.status != current.status,
buildWhen: (previous, current) =>
previous.preferences?.followedCategories !=
current.preferences?.followedCategories ||
previous.status != current.status,
builder: (context, accountState) {
final followedCategories =
accountState.preferences?.followedCategories ?? [];

return ListView.builder(
padding: const EdgeInsets.symmetric(
// Consistent padding
horizontal: AppSpacing.paddingMedium,
vertical: AppSpacing.paddingSmall,
).copyWith(
bottom: AppSpacing.xxl,
), // Ensure bottom space for loader
padding:
const EdgeInsets.symmetric(
// Consistent padding
horizontal: AppSpacing.paddingMedium,
vertical: AppSpacing.paddingSmall,
).copyWith(
bottom: AppSpacing.xxl,
), // Ensure bottom space for loader
itemCount: categories.length + (isLoadingMore ? 1 : 0),
itemBuilder: (context, index) {
if (index == categories.length && isLoadingMore) {
Expand Down Expand Up @@ -130,73 +128,66 @@ class AddCategoryToFollowPage extends StatelessWidget {
height: AppSpacing.xl + AppSpacing.xs,
child:
category.iconUrl != null &&
Uri.tryParse(
category.iconUrl!,
)?.isAbsolute ==
true
? ClipRRect(
borderRadius: BorderRadius.circular(
AppSpacing.xs,
),
child: Image.network(
category.iconUrl!,
fit: BoxFit.contain,
errorBuilder:
(context, error, stackTrace) => Icon(
Icons.category_outlined,
color: colorScheme.onSurfaceVariant,
size: AppSpacing.lg,
),
loadingBuilder: (
context,
child,
loadingProgress,
) {
if (loadingProgress == null) {
return child;
}
return Center(
child: CircularProgressIndicator(
strokeWidth: 2,
value:
loadingProgress
.expectedTotalBytes !=
null
? loadingProgress
Uri.tryParse(category.iconUrl!)?.isAbsolute ==
true
? ClipRRect(
borderRadius: BorderRadius.circular(
AppSpacing.xs,
),
child: Image.network(
category.iconUrl!,
fit: BoxFit.contain,
errorBuilder:
(context, error, stackTrace) => Icon(
Icons.category_outlined,
color: colorScheme.onSurfaceVariant,
size: AppSpacing.lg,
),
loadingBuilder:
(context, child, loadingProgress) {
if (loadingProgress == null) {
return child;
}
return Center(
child: CircularProgressIndicator(
strokeWidth: 2,
value:
loadingProgress
.expectedTotalBytes !=
null
? loadingProgress
.cumulativeBytesLoaded /
loadingProgress
.expectedTotalBytes!
: null,
),
);
},
),
)
: Icon(
Icons.category_outlined,
color: colorScheme.onSurfaceVariant,
size: AppSpacing.lg,
: null,
),
);
},
),
)
: Icon(
Icons.category_outlined,
color: colorScheme.onSurfaceVariant,
size: AppSpacing.lg,
),
),
title: Text(
category.name,
style: textTheme.titleMedium,
),
trailing: IconButton(
icon:
isFollowed
? Icon(
Icons.check_circle,
color: colorScheme.primary,
)
: Icon(
Icons.add_circle_outline,
color: colorScheme.onSurfaceVariant,
),
tooltip:
isFollowed
? l10n.unfollowCategoryTooltip(category.name)
: l10n.followCategoryTooltip(category.name),
icon: isFollowed
? Icon(
Icons.check_circle,
color: colorScheme.primary,
)
: Icon(
Icons.add_circle_outline,
color: colorScheme.onSurfaceVariant,
),
tooltip: isFollowed
? l10n.unfollowCategoryTooltip(category.name)
: l10n.followCategoryTooltip(category.name),
onPressed: () {
context.read<AccountBloc>().add(
AccountFollowCategoryToggled(category: category),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +75,25 @@ class FollowedCategoriesListPage extends StatelessWidget {
itemBuilder: (context, index) {
final category = followedCategories[index];
return ListTile(
leading:
category.iconUrl != null
? SizedBox(
width: 40,
height: 40,
child: Image.network(
category.iconUrl!,
errorBuilder:
(context, error, stackTrace) =>
const Icon(Icons.category_outlined),
),
)
: const Icon(Icons.category_outlined),
leading: category.iconUrl != null
? SizedBox(
width: 40,
height: 40,
child: Image.network(
category.iconUrl!,
errorBuilder: (context, error, stackTrace) =>
const Icon(Icons.category_outlined),
),
)
: const Icon(Icons.category_outlined),
title: Text(category.name),
subtitle:
category.description != null
? Text(
category.description!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
)
: null,
subtitle: category.description != null
? Text(
category.description!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
)
: null,
trailing: IconButton(
icon: const Icon(
Icons.remove_circle_outline,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ class AddSourceToFollowPage extends StatelessWidget {
Widget build(BuildContext context) {
final l10n = context.l10n;
return BlocProvider(
create:
(context) => SourcesFilterBloc(
sourcesRepository: context.read<HtDataRepository<Source>>(),
countriesRepository: context.read<HtDataRepository<Country>>(),
)..add(const LoadSourceFilterData()),
create: (context) => SourcesFilterBloc(
sourcesRepository: context.read<HtDataRepository<Source>>(),
countriesRepository: context.read<HtDataRepository<Country>>(),
)..add(const LoadSourceFilterData()),
child: Scaffold(
appBar: AppBar(title: Text(l10n.addSourcesPageTitle)),
body: BlocBuilder<SourcesFilterBloc, SourcesFilterState>(
Expand All @@ -38,10 +37,9 @@ class AddSourceToFollowPage extends StatelessWidget {
SourceFilterDataLoadingStatus.failure) {
return FailureStateWidget(
message: sourcesState.errorMessage ?? l10n.sourceFilterError,
onRetry:
() => context.read<SourcesFilterBloc>().add(
const LoadSourceFilterData(),
),
onRetry: () => context.read<SourcesFilterBloc>().add(
const LoadSourceFilterData(),
),
);
}
if (sourcesState.allAvailableSources.isEmpty) {
Expand All @@ -51,11 +49,10 @@ class AddSourceToFollowPage extends StatelessWidget {
}

return BlocBuilder<AccountBloc, AccountState>(
buildWhen:
(previous, current) =>
previous.preferences?.followedSources !=
current.preferences?.followedSources ||
previous.status != current.status,
buildWhen: (previous, current) =>
previous.preferences?.followedSources !=
current.preferences?.followedSources ||
previous.status != current.status,
builder: (context, accountState) {
final followedSources =
accountState.preferences?.followedSources ?? [];
Expand All @@ -74,18 +71,15 @@ class AddSourceToFollowPage extends StatelessWidget {
child: ListTile(
title: Text(source.name),
trailing: IconButton(
icon:
isFollowed
? Icon(
Icons.check_circle,
color:
Theme.of(context).colorScheme.primary,
)
: const Icon(Icons.add_circle_outline),
tooltip:
isFollowed
? l10n.unfollowSourceTooltip(source.name)
: l10n.followSourceTooltip(source.name),
icon: isFollowed
? Icon(
Icons.check_circle,
color: Theme.of(context).colorScheme.primary,
)
: const Icon(Icons.add_circle_outline),
tooltip: isFollowed
? l10n.unfollowSourceTooltip(source.name)
: l10n.followSourceTooltip(source.name),
onPressed: () {
context.read<AccountBloc>().add(
AccountFollowSourceToggled(source: source),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,13 @@ class FollowedSourcesListPage extends StatelessWidget {
return ListTile(
leading: const Icon(Icons.source_outlined), // Generic icon
title: Text(source.name),
subtitle:
source.description != null
? Text(
source.description!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
)
: null,
subtitle: source.description != null
? Text(
source.description!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
)
: null,
trailing: IconButton(
icon: const Icon(
Icons.remove_circle_outline,
Expand Down
Loading
Loading