2022-09-19 16:06:03 +08:00
|
|
|
import 'package:flutter/widgets.dart';
|
2022-09-19 17:10:12 +08:00
|
|
|
import 'package:flutter_hbb/consts.dart';
|
2022-09-19 16:06:03 +08:00
|
|
|
import 'package:flutter_improved_scrolling/flutter_improved_scrolling.dart';
|
|
|
|
|
|
|
|
class DesktopScrollWrapper extends StatelessWidget {
|
|
|
|
final ScrollController scrollController;
|
|
|
|
final Widget child;
|
|
|
|
const DesktopScrollWrapper(
|
|
|
|
{Key? key, required this.scrollController, required this.child})
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return ImprovedScrolling(
|
|
|
|
scrollController: scrollController,
|
2022-09-19 19:18:05 +08:00
|
|
|
enableCustomMouseWheelScrolling: true,
|
2022-09-19 21:09:54 +08:00
|
|
|
customMouseWheelScrollConfig: CustomMouseWheelScrollConfig(
|
|
|
|
scrollDuration: kDefaultScrollDuration,
|
|
|
|
scrollCurve: Curves.linearToEaseOut,
|
|
|
|
mouseWheelTurnsThrottleTimeMs:
|
|
|
|
kDefaultMouseWhellThrottleDuration.inMilliseconds,
|
2022-09-19 17:10:12 +08:00
|
|
|
scrollAmountMultiplier: kDefaultScrollAmountMultiplier),
|
2022-09-19 16:06:03 +08:00
|
|
|
child: child,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|