одинаковый размер нескольким элементам flutter
ListView(children: [
Row(children: [
Container(child: Text("TextTextText"),),
]),
Row(children: [
Container(child: Text("TextText"),),
]),
Row(children: [
Container(child: Text("Text"),),
]),
])
Как сделать чтобы у всех контейнеров была ширина самого большого из них?
Ответы (1 шт):
Автор решения: VAndrJ
→ Ссылка
Используйте стандартный виджет DataTable.
Для прокрутки заверните в ScrollView. И по примеру из документации результат:
Код:
// ну или используйте какой package, к примеру, bidirectional_scroll_view
return SingleChildScrollView(
scrollDirection: Axis.vertical,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
columns: const <DataColumn>[
DataColumn(
label: Text(
'Name',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
DataColumn(
label: Text(
'Age',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
DataColumn(
label: Text(
'Role',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
],
rows: const <DataRow>[
DataRow(
cells: <DataCell>[
DataCell(Text('Sarah')),
DataCell(Text('19')),
DataCell(Text('Student')),
],
),
// Здесь много копипасты
DataRow(
cells: <DataCell>[
DataCell(Text('William')),
DataCell(Text('27')),
DataCell(Text(
'Associate ProfessorAssociate ProfessorAssociate Professor')),
],
),
],
),
),
);
