Skip to content
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

Refactor ListState and paginated screens #334

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

DeD1rk
Copy link
Member

@DeD1rk DeD1rk commented Jan 31, 2023

Part of #99.

Summary

This replaces the old ListState in a way similar to what I did in #325. Introduces PaginatedScrollView and a PaginatedCubit abstract class to handle most logic for paginated lists/grids.

How to test

Steps to test the changes you made:

  1. Try out all of the paginated list screens (including search).
  2. Check out their botton padding, which should now be consistent and include a SafeArea.

lib/blocs/registrations_cubit.dart Outdated Show resolved Hide resolved
Comment on lines +68 to +71
final state = cubit.state;
if (state is ResultsListState &&
state is! DoneListState &&
state is! LoadingMoreListState) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed as more already checks this.

Comment on lines +112 to +125
slivers = [
...resultSlivers,
if (state is LoadingMoreListState)
const SliverPadding(
padding: EdgeInsets.only(top: 16),
sliver: SliverToBoxAdapter(
child: Center(child: CircularProgressIndicator()),
),
),
const SliverSafeArea(
minimum: EdgeInsets.only(bottom: 8),
sliver: SliverPadding(padding: EdgeInsets.zero),
),
];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only adds a safe area at the bottom, and if there needs to be a safearea at the top it will also add that in this widget.

Maybe just use the scrollview from #264 since that handles all the padding? or merge that first but this could result in weird UI in some phones, like maybe the samsung fold when rotated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants