mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-24 19:20:15 +08:00
@@ -3,6 +3,10 @@ import 'dart:io' show Platform;
|
||||
import 'package:flutter/gestures.dart' show PointerDeviceKind;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
const _clampingPhysics = ClampingScrollPhysics();
|
||||
const _bouncingPhysics = BouncingScrollPhysics();
|
||||
const _bouncingDesktopPhysics = BouncingScrollPhysics(decelerationRate: .fast);
|
||||
|
||||
class CustomScrollBehavior extends MaterialScrollBehavior {
|
||||
const CustomScrollBehavior();
|
||||
|
||||
@@ -29,6 +33,17 @@ class CustomScrollBehavior extends MaterialScrollBehavior {
|
||||
return child;
|
||||
}
|
||||
|
||||
@override
|
||||
ScrollPhysics getScrollPhysics(BuildContext context) {
|
||||
if (Platform.isIOS) {
|
||||
return _bouncingPhysics;
|
||||
}
|
||||
if (Platform.isMacOS) {
|
||||
return _bouncingDesktopPhysics;
|
||||
}
|
||||
return _clampingPhysics;
|
||||
}
|
||||
|
||||
@override
|
||||
Set<PointerDeviceKind> get dragDevices => desktopDragDevices;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user