2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-16 12:15:31 +00:00

Scroll fix (#633)

* Fix scrolling behaviuor

* Debounce paginated search
This commit is contained in:
Oliver
2025-04-15 23:42:48 +10:00
committed by GitHub
parent 72a78291b2
commit 1d5377ea20
4 changed files with 54 additions and 32 deletions

View File

@ -39,21 +39,14 @@ mixin BaseWidgetProperties {
// Function to construct a body
Widget getBody(BuildContext context) {
// Default body calls getTiles()
return SingleChildScrollView(
// Default implementation is to return a ListView
// Override getTiles to replace the internal context
return ListView(
physics: AlwaysScrollableScrollPhysics(),
child: Column(
children: [
ListView(
children: getTiles(context),
shrinkWrap: true,
)
],
)
children: getTiles(context),
);
}
/*
* Construct the top AppBar for this view
*/
@ -274,14 +267,6 @@ abstract class RefreshableState<T extends StatefulWidget> extends State<T> with
Widget body = tabs.isEmpty ? getBody(context) : TabBarView(children: getTabs(context));
// predicateDepth needs to be different based on the child type
// hack, determined experimentally
int predicateDepth = 0;
if (tabs.isNotEmpty) {
predicateDepth = 1;
}
Scaffold view = Scaffold(
key: scaffoldKey,
appBar: buildAppBar(context, scaffoldKey),
@ -291,8 +276,9 @@ abstract class RefreshableState<T extends StatefulWidget> extends State<T> with
body: RefreshIndicator(
key: refreshKey,
notificationPredicate: (ScrollNotification notification) {
return notification.depth == predicateDepth;
return true;
},
onRefresh: () async {
refresh(context);
},