简体   繁体   English

如何在 Flutter 的文本小部件中显示值?

[英]How to Display value in Text widget in Flutter?

How can I display the value on Text Widget since I am using Getx由于我使用的是Getx ,如何在 Text Widget 上显示值

I trying to display the value of balance using as map but fail (and I guess it is not efficient) the method I know is using index but cant work using Text widget (need builder)我尝试使用 map 显示余额值但失败(我猜它效率不高)我知道的方法是使用索引但无法使用文本小部件(需要生成器)

where I can get index???我在哪里可以得到索引??? or any advice to make it work and efficient since this is to show all value in the balance或任何使其工作和高效的建议,因为这是为了显示余额中的所有价值

This is a text widget I work but need an index这是我工作的文本小部件,但需要索引
截屏

Here is the model, I want to show the value of balance in my Text widget这是 model,我想在我的文本小部件中显示余额值
截屏

Obx(
  () => ListView.builder(
  itemCount: cashMain.transData.length,
  itemBuilder: (context, index) {
    return Text('${cashMain.transData[index].balance}')
  },
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM