mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-26 13:30:12 +08:00
@@ -549,7 +549,6 @@ class RefreshIndicatorState extends State<RefreshIndicator>
|
||||
if (widget.isClampingScrollPhysics) {
|
||||
return ScrollConfiguration(
|
||||
behavior: RefreshScrollBehavior(
|
||||
desktopDragDevices,
|
||||
scrollPhysics: RefreshScrollPhysicsIOS(
|
||||
parent: const RangeMaintainingScrollPhysics(),
|
||||
onDrag: _onDrag,
|
||||
@@ -562,7 +561,6 @@ class RefreshIndicatorState extends State<RefreshIndicator>
|
||||
}
|
||||
return ScrollConfiguration(
|
||||
behavior: RefreshScrollBehavior(
|
||||
desktopDragDevices,
|
||||
scrollPhysics: RefreshScrollPhysics(
|
||||
parent: const RangeMaintainingScrollPhysics(),
|
||||
onDrag: _onDrag,
|
||||
@@ -625,8 +623,7 @@ class RefreshIndicatorState extends State<RefreshIndicator>
|
||||
typedef refreshIndicator = RefreshIndicator;
|
||||
|
||||
class RefreshScrollBehavior extends CustomScrollBehavior {
|
||||
const RefreshScrollBehavior(
|
||||
super.dragDevices, {
|
||||
const RefreshScrollBehavior({
|
||||
required this.scrollPhysics,
|
||||
});
|
||||
|
||||
|
||||
@@ -1,8 +1,19 @@
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
import 'package:flutter/gestures.dart' show PointerDeviceKind;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
const Set<PointerDeviceKind> desktopDragDevices = {
|
||||
.touch,
|
||||
.mouse,
|
||||
.trackpad,
|
||||
.stylus,
|
||||
.invertedStylus,
|
||||
.unknown,
|
||||
};
|
||||
|
||||
class CustomScrollBehavior extends MaterialScrollBehavior {
|
||||
const CustomScrollBehavior(this.dragDevices);
|
||||
const CustomScrollBehavior();
|
||||
|
||||
@override
|
||||
Widget buildScrollbar(
|
||||
@@ -12,14 +23,32 @@ class CustomScrollBehavior extends MaterialScrollBehavior {
|
||||
) => child;
|
||||
|
||||
@override
|
||||
final Set<PointerDeviceKind> dragDevices;
|
||||
Widget buildOverscrollIndicator(
|
||||
BuildContext context,
|
||||
Widget child,
|
||||
ScrollableDetails details,
|
||||
) {
|
||||
if (Platform.isAndroid) {
|
||||
return StretchingOverscrollIndicator(
|
||||
axisDirection: details.direction,
|
||||
clipBehavior: details.decorationClipBehavior ?? .hardEdge,
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
@override
|
||||
Set<PointerDeviceKind> get dragDevices => desktopDragDevices;
|
||||
}
|
||||
|
||||
const Set<PointerDeviceKind> desktopDragDevices = <PointerDeviceKind>{
|
||||
PointerDeviceKind.touch,
|
||||
PointerDeviceKind.stylus,
|
||||
PointerDeviceKind.invertedStylus,
|
||||
PointerDeviceKind.trackpad,
|
||||
PointerDeviceKind.unknown,
|
||||
PointerDeviceKind.mouse,
|
||||
};
|
||||
class NoOverscrollIndicator extends CustomScrollBehavior {
|
||||
const NoOverscrollIndicator();
|
||||
|
||||
@override
|
||||
Widget buildOverscrollIndicator(
|
||||
BuildContext context,
|
||||
Widget child,
|
||||
ScrollableDetails details,
|
||||
) => child;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user