FittedBox内的PaginatedDataTable

时间:2019-04-05 18:02:22

标签: flutter

我正在使用PaginatedDataTable,但是不幸的是,它非常大且无法滚动显示在屏幕上,这就是为什么我想将其放在FittedBox中以缩小比例,但无法正常工作。

我有以下代码:

child: FittedBox(
                    fit: BoxFit.scaleDown,
                    alignment: Alignment.centerLeft,
                    child: PaginatedDataTable(
                        header: const Text(''),
                        columns: <DataColumn>[
                          DataColumn(
                            label: const Text('#'),
                          ),
                          DataColumn(
                            label: const Text('Timestamp'),
                          ),
                          DataColumn(
                            label: const Text('Source'),
                          ),
                          DataColumn(
                            label: const Text('Destination'),
                          ),
                        ],
                        source: new CurtainHistoryEntryDataSource(
                            curtain.curtainHistoryEntries)),
                  ))

调试器告诉我:

I/flutter (29086): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (29086): The following assertion was thrown during performLayout():
I/flutter (29086): BoxConstraints forces an infinite width.
I/flutter (29086): These invalid constraints were provided to RenderSemanticsAnnotations's layout() function by the
I/flutter (29086): following function, which probably computed the invalid constraints in question:
I/flutter (29086):   RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:738:15)
I/flutter (29086): The offending constraints were:
I/flutter (29086):   BoxConstraints(w=Infinity, 0.0<=h<=Infinity)

因此,显然这是行不通的。有人知道为什么以及如何使它起作用吗?

谢谢!

0 个答案:

没有答案