android - 如何在 Flutter 中的文本之间加载图像

标签 android flutter dart

我需要在我的 android 应用程序上显示包含来自 API 的文本和图像的内容,当我将它保存在字符串类型的变量中时,文本会显示,但图像显示为 url。如何加载获取链接以在文本之间加载?

最佳答案

enter image description here

我需要插入一个与文本句子内联的图像。 所以为此我使用了这个:

  final String paragraph1 =
  'Advanciti App is an app where you can study and make friends with people living near your home. Advanciti is an Edtech Startup based out of Pune, Maharashtra, India.\n';

 RichText(
          text: TextSpan(
            children: [
              TextSpan(text: "The "),
              WidgetSpan(child: Container(width: 20.0, child: Image.asset('assets/app_icon.png', scale: 1))),
              TextSpan(text: paragraph1),
            ],
          ),
        ),

关于android - 如何在 Flutter 中的文本之间加载图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61486993/

相关文章:

Android:如何在 Activity 之上获得覆盖

源自 OpenSSLSocketImpl(而非 SSLSocket)的 Android 自定义套接字

android - Android工具栏和 fragment 背景如何使用一种渐变颜色

flutter - 在 mac 和 windows 之间共享解决方案时对包的路径文件引用不正确

dart - 调用具有两个相同参数的函数,但在调用时设置第二个

Android LiveWallpaper 选择器崩溃

dart - 为什么将 TextField 放在 In Row 中时出现错误

ios - Flutter项目在ios13上运行

android - 构建 flutter com.android.builder.internal.aapt.v2.Aapt2Exception : Android resource linking failed

json - DART lang读取保存在客户端中的JSON文件,即不使用服务器