-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mouse wheel scrolling on Windows not precise #194
Comments
在PC和web上都有类似的问题。不能准确地控制滚动,而是一次跳几个。 |
我采用了一个比较丑的解决方法,在PC上,套上一层GestureDetector,用来支持拖拉,从而精确控制。 |
Me too!Any solutions?I increased the itemExtent parameter and it solved the problem, but when I run it on a large-screen computer, the problem still exists. |
I solved it,Related to this:flutter/flutter#119500. First localize flutter_picker: 2.1.0, just copy the four files in the lib directory to your project, and then replace the code of the picker.dart file with the following code: /// Picker selected callback. /// Picker confirm callback. /// Picker confirm before callback. /// Picker value format callback. /// Picker widget builder /// Picker build item, If 'null' is returned, the default build is used /// Picker /// Index of currently selected items /// Picker adapter, Used to provide data and generate widgets /// insert separator before picker columns final VoidCallback? onCancel; /// When the previous level selection changes, scroll the child to the first item. /// Specify flex for each column final Widget? title; final double height; /// Height of list item final TextStyle? textStyle, /// Text scaling factor final EdgeInsetsGeometry? columnPadding; /// Hide head /// Show pickers in reversed order /// Generate a custom header, [hideHeader] = true /// Generate a custom item widget, If 'null' is returned, the default builder is used /// List item loop /// Delay generation for smoother animation, This is the number of milliseconds to wait. It is recommended to > = 200 final Widget? footer; /// A widget overlaid on the picker to highlight the currently selected entry. final Decoration? headerDecoration; final double magnification; final bool printDebug; Widget? _widget; Picker( Widget? get widget => _widget; /// 生成picker控件 /// show picker bottom sheet /// show picker bottom sheet /// Display modal picker /// show dialog picker /// 获取当前选择的值 /// 取消 /// 确定 /// 弹制更新指定列的内容 static ButtonStyle _getButtonStyle(ButtonThemeData? theme, /// 分隔符 /// picker data list item /// 数据值 /// 子项 PickerItem({this.text, this.value, this.children}); class PickerWidget extends InheritedWidget { static PickerWidget of(BuildContext context) { class _PickerWidget extends StatefulWidget { @OverRide class PickerWidgetState extends State<_PickerWidget> { ThemeData? theme; @OverRide
} void update() { // var ref = 0;
} List? _headerItems; List _buildHeaderViews(BuildContext context) {
} static Widget? _buildButton( bool _changing = false; List _buildViews() {
} Map m = {}; Widget _buildCupertinoPicker(BuildContext context, int i, int _length,
} void updateScrollController(int col) { @OverRide /// 选择器数据适配器 int getLength(); /// 是否需要更新前面的列 Widget makeText(Widget? child, String? text, bool isSel) { Widget makeTextEx(
} String getText() { List getSelectedValues() { void doShow() {} int getColumnFlex(int column) { int get maxLevel => getMaxLevel(); /// Content length of current column String get text => getText(); // 是否联动,即后面的列受前面列数据影响 @OverRide bool getIsLinkage() { /// 通知适配器数据改变 /// 数据适配器 PickerDataAdapter( @OverRide void _parseData(List? pickerData) { _parseArrayPickerDataItem(List? pickerData, List data) {
} _parsePickerDataItem(List? pickerData, List data) {
} void setColumn(int index) { @OverRide @OverRide @OverRide @OverRide @OverRide _checkPickerDataLevel(List? data, int level) { class NumberPickerColumn { const NumberPickerColumn({ int indexOf(int? value) { int valueOf(int index) { String getValueText(int index) { int count() { class NumberPickerAdapter extends PickerAdapter { final List data; @OverRide @OverRide @OverRide @OverRide @OverRide @OverRide @OverRide @OverRide /// Picker DateTime Adapter Type static const int kYMD = 7; // y, m, d static const int kYM = 11; // y, m class DateTimePickerAdapter extends PickerAdapter { /// Whether to display the month in numerical form.If true, months is not used. /// custom months strings /// Custom AM, PM strings /// year begin...end. /// hour min ... max, min >= 0, max <= 23, max > min /// minimum datetime /// jump minutes, user could select time in intervals of 30min, 5mins, etc.... /// Year, month, day suffix /// use two-digit year, 2019, displayed as 19 /// year 0, month 1, day 2, hour 3, minute 4, sec 5, am/pm 6, hour-ap: 7 static const List MonthsList_EN = const [ static const List MonthsList_EN_L = const [ DateTimePickerAdapter({ bool _existSec = false; /// Currently selected value // but it can improve the performance, so keep it. static const Map<int, int> columnTypeLength = { /// year 0, month 1, day 2, hour 3, minute 4, sec 5, am/pm 6, hour-ap: 7 // static const List leapYearMonths = const [1, 3, 5, 7, 8, 10, 12]; // 获取当前列的类型 // 判断是否存在秒 @OverRide @OverRide @OverRide @OverRide @OverRide @OverRide
} @OverRide @OverRide @OverRide @OverRide
} bool _verificationMinMaxValue() { // Calculate am/pm time transfer int _getAPColIndex() { int _calcDateCount(int year, int month) { String intToStr(int v) { String _checkStr(String? v) { |
Hi,
OS: Windows.
Topic: Select a number form a NumberPickerColumn with the mouse wheel
Problem: Every move of the mouse wheel results in a jump of 3 values. It is not possible to select every value from the picker.
Note: jump is already set to 1. If I set it e.g. to 5, the actual jumps are 5x3 = 15
Any solutions?
Thx
The text was updated successfully, but these errors were encountered: