Skip to content

Commit

Permalink
Fix scroll pinned notes (#941)
Browse files Browse the repository at this point in the history
* add one scroll

* add space

* fix scroll to only apply to lists
  • Loading branch information
gonzalovelasco committed Sep 29, 2023
1 parent 4684327 commit a0930db
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions lib/screens/search/search_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,38 @@ class _SearchScreenState extends ConsumerState<SearchScreen> {
deleteNotes: deleteNotes,
onToggleNotesPinned: onToggleNotesPinned),
),
if (pinnedNotes.isNotEmpty) const CustomTitleRow(title: "PINNED"),
if (pinnedNotes.isNotEmpty) Expanded(child: getSearchList(pinnedNotes)),
if (pinnedNotes.isNotEmpty && notes.isNotEmpty)
const CustomTitleRow(title: "OTHERS"),
Expanded(child: getSearchList(notes)),
Expanded(
child: CustomScrollView(
slivers: [
if (pinnedNotes.isNotEmpty)
const SliverToBoxAdapter(
child: CustomTitleRow(title: "PINNED"),
),
if (pinnedNotes.isNotEmpty)
SliverList(
delegate: SliverChildListDelegate(
[
getSearchList(pinnedNotes),
],
),
),
if (pinnedNotes.isNotEmpty && notes.isNotEmpty)
const SliverToBoxAdapter(
child: SizedBox(height: 44.0),
),
if (pinnedNotes.isNotEmpty && notes.isNotEmpty)
const SliverToBoxAdapter(
child: CustomTitleRow(title: "OTHERS"),
),
SliverList(
delegate: SliverChildListDelegate(
[
getSearchList(notes),
],
),
),
],
)),
],
);
}
Expand Down Expand Up @@ -345,6 +372,8 @@ class NoteGrid extends StatelessWidget {
child: (crossAxisCount == 1 && childAspectRatio == null)
? ListView.builder(
key: const PageStorageKey('ListOfNotes'),
physics: const NeverScrollableScrollPhysics(),
// shrinkWrap: true,
padding: padding,
controller: controller,
itemCount: notes.length,
Expand All @@ -361,9 +390,10 @@ class NoteGrid extends StatelessWidget {
),
)
: GridView.builder(
physics: const AlwaysScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(),
key: const PageStorageKey('ListOfNotes'),
padding: padding,
shrinkWrap: true,
controller: controller,
itemCount: notes.length,
itemBuilder: (context, index) => NoteCard(
Expand Down

0 comments on commit a0930db

Please sign in to comment.