Tencent / Tencent/tdesign-flutter
[TDTable]首列固定设定后再设定height超出后不会出现纵向滚动条
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 1.2k
- Forks
- 182
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 88
Description
tdesign-flutter 版本
0.2.4
重现链接
No response
重现步骤/代码
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:lens_erp_order/generated/l10n.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';
class TestPage extends ConsumerWidget {
const TestPage({super.key});
///标题
List get titles1 => List.generate(1 + 8, (index) {
double num = index * 0.25;
return TDTableCol(
title: num.toStringAsFixed(2),
colKey: "col$index",
width: 60,
);
});
///数据
List<List> get data1 =>
List.generate(41, (rowIndex) => List.generate(9, (index) => 0));
@override
Widget build(BuildContext context, WidgetRef ref) {
return Scaffold(
appBar: TDNavBar(title: S.of(context).test),
body: TDTable(
bordered: true,
stripe: true,
height: 100,
onScroll: (controller) {},
columns: [
TDTableCol(
title: "SPH/CYL",
colKey: "title",
fixed: TDTableColFixed.left, //注释此行后正常
width: 200,
),
...titles1,
],
data: data1.asMap().entries.map((entry) {
final items = entry.value;
final rowData = {"title": "title"};
for (int i = 0; i < items.length; i++) {
rowData["col$i"] = items[i] == 0 ? "" : items[i].toString();
}
return rowData;
}).toList(),
onCellTap: (colIndex, row, col) {
//typedef OnCellTap = void Function(int rowIndex, dynamic row, TDTableCol col);
//index 应该是colIndex
print("index:$colIndex");
},
),
);
}
}
期望结果
开启首列固定后如果超过高度也能纵向滚动
实际结果
Flutter版本
3.35.2
设备与机型信息
No response
系统版本
No response
补充说明
onCellTap的index实际返回是colIndex,但定义是rowIndex,容易引起歧义
IssueShoot
- 预估时长:5
- 期望完成时间:2025-11-30
- 开发难度:中
- 参与人数:1
- 需求对接人:zflyluo
- 验收标准:验证问题是否存在,实现期望改造效果,提 MR并通过 验收无误
- 备注:最终激励以实际提交 pr 并合并为准。TDesignFlutter贡献指南:https://tdesign.tencent.com/flutter/develop
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the example with TDTable, a fixed first column, height: 100, and enough rows to exceed the height. Inspect the TDTable entry point and related scrolling behavior, then verify that vertical scrolling appears while the first column remains fixed. Also check whether the onCellTap index documentation matches the reported callback value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100