feat(Picker): 新增 onColumnScrollEnd 支持按需加载#958
Conversation
- picker_column_wheel.dart → wheel_column.dart (PickerColumnWheel → WheelColumn) - t_picker_items.dart → picker_data.dart (TPickerItems/TPickerColumns/TPickerLinked → PickerItems/PickerColumns/PickerLinked) - t_picker_keys.dart → picker_keys.dart (TPickerKeys → PickerKeys) - t_picker_normalize.dart → picker_normalize.dart (TPickerNormalize → PickerNormalize) - t_item_widget.dart → picker_item.dart (TItemWidget → PickerItemWidget) - t_picker_option.dart → picker_option.dart (TPickerOption → PickerOption) - t_picker_value.dart → picker_value.dart (TPickerValue → PickerValue) - no_wave_behavior.dart → wheel_behavior.dart (NoWaveBehavior → WheelBehavior) 同时更新外部引用组件 (date_time_picker, calendar) 的类名和 import 路径
合并 calendar 重构(#926)等 develop 变更;冲突文件 t_date_picker.dart 按 develop 方向删除。 Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors the Picker implementation by extracting reusable wheel/row layout building blocks, adds accessibility (Semantics) support for picker columns, and introduces a column-aware callback API to better support linked/lazy-loading scenarios.
Changes:
- Refactor picker wheel rendering into new internal widgets (
WheelColumn,MultiWheelLayout) and update DateTimePicker to reuse them. - Update Picker API/docs/examples:
onChangenow includes the triggering column index, and a newonColumnScrollEndcallback is added for end-of-scroll pagination triggers. - Add/expand widget tests for disabled-item correction, controller rebuild regressions, a11y semantics behaviors, and
ItemDistanceCalculator.
Reviewed changes
Copilot reviewed 48 out of 50 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tdesign-site/src/picker/README.md | Updates docs and examples for new onChange(int col, TPickerValue) signature and mentions onColumnScrollEnd. |
| tdesign-component/test/t_picker_test.dart | Updates existing picker tests for new callback signature; adds regression/a11y/lazy-load related tests. |
| tdesign-component/test/item_distance_calculator_test.dart | Adds coverage for ItemDistanceCalculator style mapping behavior. |
| tdesign-component/test/helpers/popup_test_resource.dart | Extends test resource delegate with picker-related strings for semantics labels. |
| tdesign-component/lib/tdesign_flutter.dart | Updates exports to new picker file structure (data/keys/value/option/item). |
| tdesign-component/lib/src/theme/resource_delegate.dart | Adds picker semantics strings to TResourceDelegate and default delegate. |
| tdesign-component/lib/src/components/picker/wheel_column.dart | New internal single-column wheel with disabled-item correction + dedup logic. |
| tdesign-component/lib/src/components/picker/wheel_behavior.dart | Renames/marks internal scroll behavior for wheel use. |
| tdesign-component/lib/src/components/picker/t_picker.dart | Major refactor: new callbacks, initState-only initialValue semantics, partial column updates, and Semantics wrappers. |
| tdesign-component/lib/src/components/picker/picker_value.dart | Updates docs for new onChange(col, value) signature; imports renamed files. |
| tdesign-component/lib/src/components/picker/picker_option.dart | New file for TPickerOption definition (renamed from prior file). |
| tdesign-component/lib/src/components/picker/picker_normalize.dart | Updates imports to renamed picker files. |
| tdesign-component/lib/src/components/picker/picker_keys.dart | New file for TPickerKeys (renamed from prior file). |
| tdesign-component/lib/src/components/picker/picker_item.dart | Renames internal item widget and exposes ItemDistanceCalculator + builder type. |
| tdesign-component/lib/src/components/picker/picker_data.dart | Updates imports to renamed picker files; keeps picker data sealed-class model. |
| tdesign-component/lib/src/components/picker/picker_column_wheel.dart | Removes old per-column wheel widget in favor of WheelColumn. |
| tdesign-component/lib/src/components/picker/multi_wheel_layout.dart | New internal shared layout shell for multi-column wheel + highlight strip. |
| tdesign-component/lib/src/components/date_time_picker/t_date_time_picker.dart | Minor formatting change. |
| tdesign-component/lib/src/components/date_time_picker/t_date_time_picker_wheel.dart | Refactors to reuse WheelColumn + MultiWheelLayout; updates scroll behavior. |
| tdesign-component/lib/src/components/date_time_picker/t_date_time_picker_snapshot.part.dart | Formatting-only adjustments. |
| tdesign-component/lib/src/components/date_time_picker/t_date_time_picker_labels.part.dart | Formatting-only adjustments. |
| tdesign-component/lib/src/components/date_time_picker/t_date_time_picker_internal.dart | Updates imports to renamed picker data/option files. |
| tdesign-component/lib/src/components/date_time_picker/t_date_time_picker_enums.dart | Formatting-only adjustments. |
| tdesign-component/lib/src/components/date_time_picker/t_date_time_picker_bounds.part.dart | Formatting-only adjustments. |
| tdesign-component/lib/src/components/date_time_picker/CALENDAR_LEGACY.md | Removes legacy boundary documentation file. |
| tdesign-component/example/test/linked_lazy_picker_scope_test.dart | Adds widget tests for linked lazy picker demo scope behavior. |
| tdesign-component/example/test/linked_lazy_picker_policy_test.dart | Adds unit tests for lazy-load policy/cache helpers. |
| tdesign-component/example/lib/page/t_picker_page.dart | Updates demo page for new callback signature and lazy-load demo refactor/caching. |
| tdesign-component/example/lib/page/t_form_page.dart | Updates picker usage to new onChange(col, value) signature. |
| tdesign-component/example/lib/page/t_calendar_page.dart | Minor demo updates (button theme + comment/style tweaks). |
| tdesign-component/example/lib/page/linked_lazy_picker_scope.dart | Refactors demo lazy-load scope to use onColumnScrollEnd + caching policy. |
| tdesign-component/example/lib/page/linked_lazy_picker_policy.dart | Adds lazy-load page/policy/cache helper types for the demo scope. |
| tdesign-component/example/lib/l10n/app_zh.arb | Adds picker-related localized strings. |
| tdesign-component/example/lib/l10n/app_localizations.dart | Adds picker-related localization getters. |
| tdesign-component/example/lib/l10n/app_localizations_zh.dart | Implements picker-related zh localization strings. |
| tdesign-component/example/lib/l10n/app_localizations_en.dart | Implements picker-related en localization strings. |
| tdesign-component/example/lib/l10n/app_en.arb | Adds picker-related localized strings. |
| tdesign-component/example/lib/base/intl_resource_delegate.dart | Wires picker strings into the example’s resource delegate. |
| tdesign-component/example/assets/code/picker.buildTimeSelect.txt | Updates snippet for new onChange(col, value) signature. |
| tdesign-component/example/assets/code/picker.buildSingleColumn.txt | Updates snippet for new onChange(col, value) signature. |
| tdesign-component/example/assets/code/picker.buildPopupLinked.txt | Updates snippet for new onChange(col, value) signature. |
| tdesign-component/example/assets/code/picker.buildMonthDaySelect.txt | Updates snippet for new onChange(col, value) signature. |
| tdesign-component/example/assets/code/picker.buildLinkedFiveLevel.txt | Updates snippet for new onChange(col, value) signature. |
| tdesign-component/example/assets/code/picker.buildLazyLoad.txt | Updates snippet to recommend onColumnScrollEnd for pagination triggers. |
| tdesign-component/example/assets/code/picker.buildItemDisabled.txt | Updates snippet for new onChange(col, value) signature. |
| tdesign-component/example/assets/code/picker.buildGlobalDisabled.txt | Updates snippet for new onChange(col, value) signature. |
| tdesign-component/example/assets/code/picker.buildCustomSize.txt | Updates snippet for new onChange(col, value) signature. |
| tdesign-component/example/assets/code/picker.buildCustomKeys.txt | Updates snippet for cached items + new onChange(col, value) signature. |
| tdesign-component/example/assets/code/picker.buildCustomItemBuilder.txt | Updates snippet for new onChange(col, value) signature. |
| tdesign-component/demo_tool/all_build.sh | Updates API generation list for picker types (currently incorrect names). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
📱 APK 下载 |
onColumnScrollEnd 支持按需加载

🤔 这个 PR 的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
refactor(picker): rename files and class names, and fix the loop of initialization variables.
📝 更新日志
feat(Picker): 新增
onColumnScrollEnd支持按需加载并优化代码文件结构。本条 PR 不需要纳入 Changelog
☑️ 请求合并前的自查清单
组件类名: 修改描述(示例:TBottomTabBar: 修复iconText模式,底部溢出2.5像素)