Skip to content

Commit

Permalink
fix: change scroll physics to clamping (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
poppingmoon authored May 26, 2024
1 parent 593fbfc commit 0d32a54
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/view/widget/notifications_list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ class NotificationsListView extends HookConsumerWidget {
super.key,
required this.account,
this.controller,
this.physics,
});

final Account account;
final ScrollController? controller;
final ScrollPhysics? physics;

@override
Widget build(BuildContext context, WidgetRef ref) {
Expand Down Expand Up @@ -105,6 +107,7 @@ class NotificationsListView extends HookConsumerWidget {
margin: const EdgeInsets.symmetric(horizontal: 8.0),
child: CustomScrollView(
controller: controller,
physics: physics,
center: centerKey,
slivers: [
if ((notifications.valueOrNull?.items.isNotEmpty ?? false) ||
Expand Down
6 changes: 5 additions & 1 deletion lib/view/widget/timeline_list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ class TimelineListView extends HookConsumerWidget {
const TimelineListView({
super.key,
required this.tabSettings,
this.physics,
this.postFormFocusNode,
this.lastViewedAtKey,
});

final TabSettings tabSettings;
final ScrollPhysics? physics;
final FocusNode? postFormFocusNode;
final Key? lastViewedAtKey;

Expand All @@ -41,6 +43,7 @@ class TimelineListView extends HookConsumerWidget {
return NotificationsListView(
account: tabSettings.account,
controller: controller,
physics: physics,
);
}
final centerId = ref.watch(timelineCenterNotifierProvider(tabSettings));
Expand Down Expand Up @@ -192,8 +195,9 @@ class TimelineListView extends HookConsumerWidget {
width: 800.0,
margin: const EdgeInsets.symmetric(horizontal: 8.0),
child: CustomScrollView(
center: centerKey,
controller: controller,
physics: physics,
center: centerKey,
slivers: [
if (centerId != null)
SliverToBoxAdapter(
Expand Down
1 change: 1 addition & 0 deletions lib/view/widget/timeline_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ class TimelineWidget extends HookConsumerWidget {
Expanded(
child: TimelineListView(
tabSettings: tabSettings,
physics: const ClampingScrollPhysics(),
postFormFocusNode: postFormFocusNode,
lastViewedAtKey: lastViewedAtKey,
),
Expand Down

0 comments on commit 0d32a54

Please sign in to comment.