Widget getTextWidgets(List<String> strings)
{
return new Row(children: strings.map((item) => new Text(item)).toList());
}
Widget getTextWidgets(List<String> strings)
{
List<Widget> list = new List<Widget>();
for(var i = 0; i < strings.length; i++){
list.add(new Text(strings[i]));
}
return new Row(children: list);
}
Reference
Iterating through a list to render multiple widgets in Flutter?
I have a list of strings defined like this: var list = ["one", "two", "three", "four"]; I want to render the values on the screen side by side using text w...
stackoverflow.com
728x90
'Flutter' 카테고리의 다른 글
| [Flutter] flutter multiple api calls ; 여러개의 response 처리하기 (0) | 2022.04.27 |
|---|---|
| [Flutter] sizedbox shrink with max height ; child의 크기에 따라서 박스 높이 조절하기 (0) | 2022.04.25 |
| [Flutter] table 셀 너비 자동 맞춤 (0) | 2022.04.23 |
| [Flutter] move scrollController to top or bottom; scroll 위치 이동하기 (0) | 2022.04.23 |
| [Flutter] swipe page to show next week data; 주간 달력 ; 옆으로 밀어서 다음주 데이터 보여주기 (0) | 2022.04.23 |