rustdesk/flutter/lib/desktop/widgets/scroll_wrapper.dart

27 lines
941 B
Dart
Raw Normal View History

import 'package:flutter/widgets.dart';
2022-09-19 17:10:12 +08:00
import 'package:flutter_hbb/consts.dart';
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,
customMouseWheelScrollConfig: CustomMouseWheelScrollConfig(
scrollDuration: kDefaultScrollDuration,
scrollCurve: Curves.linearToEaseOut,
mouseWheelTurnsThrottleTimeMs:
2022-09-27 23:08:01 +08:00
kDefaultMouseWheelThrottleDuration.inMilliseconds,
2022-09-19 17:10:12 +08:00
scrollAmountMultiplier: kDefaultScrollAmountMultiplier),
child: child,
);
}
}