Repository navigation
feat: integrate customizable smooth scroll duration and update contro… #11
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -154,12 +154,20 @@ class _SelectableEllipsis extends StatelessWidget { | |||||
| painter.dispose(); | ||||||
|
|
||||||
| if (!didOverflow) { | ||||||
| // Text fits within [maxLines] — we pass `maxLines: null` here | ||||||
| // intentionally. Flutter's SelectableText (backed by a multiline | ||||||
| // TextField) reserves vertical height for every line slot up to the | ||||||
| // maxLines limit even when the content is short, which creates | ||||||
| // unwanted whitespace in compact rows (e.g. network header values). | ||||||
| // Since the TextPainter check above already confirmed the text does | ||||||
| // NOT exceed the constraint, clamping is unnecessary and null | ||||||
| // lets the widget collapse to its natural single-line height. | ||||||
| return SelectableText(data, | ||||||
| style: style, | ||||||
| strutStyle: strutStyle, | ||||||
| textAlign: textAlign, | ||||||
| textDirection: textDirection, | ||||||
| maxLines: maxLines, | ||||||
| maxLines: null, | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoding
Suggested change
|
||||||
| textWidthBasis: textWidthBasis, | ||||||
| textHeightBehavior: textHeightBehavior, | ||||||
| semanticsLabel: semanticsLabel, | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import 'dart:convert'; | ||
|
|
||
| /// Convert a raw log message into a one-line preview suitable for | ||
| /// list-row titles and search-result previews. | ||
| /// | ||
| /// Special handling for JSON objects/arrays so the user sees something | ||
| /// like `Object {3 keys: foo, bar, baz}` instead of just `{` (the first | ||
| /// character of the pretty-printed payload that the SDK sent over the | ||
| /// wire, which the list-row `maxLines: 1` would otherwise truncate to). | ||
| /// | ||
| /// Non-JSON messages are returned unchanged. | ||
| String summarizeLogMessage(String message) { | ||
| final trimmed = message.trimLeft(); | ||
| if (trimmed.isEmpty) return message; | ||
| if (trimmed[0] != '{' && trimmed[0] != '[') return message; | ||
|
|
||
| // Skip expensive JSON parsing for very large payloads — decoding a | ||
| // multi-MB log synchronously on the main thread can cause noticeable | ||
| // jank. In practice a JSON preview is not useful for such payloads. | ||
| if (trimmed.length > 5000) return message; | ||
|
|
||
| // Try to parse as JSON — RN's `toStr` (and Flutter's `jsonEncode`) ship | ||
| // pretty-printed payloads, so we can't rely on a single line. | ||
| dynamic parsed; | ||
| try { | ||
| parsed = jsonDecode(trimmed); | ||
|
Comment on lines
+24
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Synchronously calling if (trimmed.length > 5000) return message;\n\n dynamic parsed;\n try {\n parsed = jsonDecode(trimmed); |
||
| } catch (_) { | ||
| return message; // not valid JSON — show the original text | ||
| } | ||
|
|
||
| if (parsed is Map) { | ||
| final keys = parsed.keys.cast<String>().toList(); | ||
| if (keys.isEmpty) return 'Object {}'; | ||
| final preview = keys.take(3).join(', '); | ||
| final more = keys.length > 3 ? ', …' : ''; | ||
| return 'Object {${keys.length} key${keys.length == 1 ? '' : 's'}: $preview$more}'; | ||
| } | ||
| if (parsed is List) { | ||
| if (parsed.isEmpty) return 'Array []'; | ||
| return 'Array [${parsed.length}]'; | ||
| } | ||
| return message; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🌐 Web query:
Does Flutter's default ScrollBehavior route unmodified vertical mouse wheel scrollDelta to horizontal-only ListViews, or does it require Shift by default?💡 Result:
Yes, Flutter's default ScrollBehavior requires the Shift key to be held down when using a vertical mouse wheel to scroll a horizontal ListView [1][2]. This behavior is governed by the pointerAxisModifiers property in the ScrollBehavior class, which defaults to including LogicalKeyboardKey.shiftLeft and LogicalKeyboardKey.shiftRight [1][3]. When these keys are pressed in combination with a mouse scroll event, Flutter flips the scroll axes, allowing vertical wheel input to move a horizontal ScrollView [1][3]. This is considered the standard desktop convention for horizontal scrolling [2]. If you wish to modify this behavior, you can override the ScrollBehavior in your app (e.g., via ScrollConfiguration or within your MaterialApp/CupertinoApp) to customize the pointerAxisModifiers set [1][4][5]. However, simply clearing the set does not automatically cause a horizontal list to scroll with a vertical wheel; it effectively disables the axis-flipping mechanism [4][6]. Top results: [1], [2], [5]
Citations:
shiftwhen on desktop flutter/flutter#83065🏁 Script executed:
Repository: ridelinktechs/devconnect-manage-kit
Length of output: 17929
🏁 Script executed:
Repository: ridelinktechs/devconnect-manage-kit
Length of output: 450
🏁 Script executed:
Repository: ridelinktechs/devconnect-manage-kit
Length of output: 4391
Horizontal wheel scrolling still needs a behavior override
lib/components/layout/device_bottom_bar.dart:80-82— Flutter keeps horizontalListViewwheel scrolling on Shift+wheel by default, soSmoothScrollControllerwon’t change plain mouse-wheel input here. Add aScrollBehavior/ScrollConfigurationif desktop wheel scrolling is expected.🤖 Prompt for AI Agents