"Update SearchPage itemBuilder to load more results and fix Checkbox layout"

The SearchPage's itemBuilder has been updated to load more results as the user scrolls down. It now checks if the current index is a multiple of
This commit is contained in:
MohammadTaha Basiri 2024-04-15 22:38:05 +03:30
parent f749dbaf0e
commit dba3668c4c
2 changed files with 13 additions and 7 deletions

View File

@ -30,12 +30,19 @@ class SearchPage extends StatelessWidget {
builder: (context, state) => ListView.builder( builder: (context, state) => ListView.builder(
padding: const EdgeInsets.all(16) padding: const EdgeInsets.all(16)
.copyWith(top: state.selectedCats.length <= 1 ? 72 : 16), .copyWith(top: state.selectedCats.length <= 1 ? 72 : 16),
itemBuilder: (context, index) => Padding( itemBuilder: (context, index) {
padding: const EdgeInsets.only(bottom: 8), index += 2;
child: SearchResultItem( if (index % 15 == 0 && state.lastPage != state.page) {
item: state.results[index], state.searchAll(page: state.page + 1);
), }
), index -= 2;
return Padding(
padding: const EdgeInsets.only(bottom: 8),
child: SearchResultItem(
item: state.results[index],
),
);
},
itemCount: state.results.length, itemCount: state.results.length,
), ),
), ),

View File

@ -49,7 +49,6 @@ class _DidvanCheckboxState extends State<DidvanCheckbox> {
widget.onChanged(_value); widget.onChanged(_value);
}, },
), ),
const SizedBox(width: 4),
DidvanText(widget.title), DidvanText(widget.title),
], ],
), ),