小编uyh*_*haW的帖子

如何防止platformViewRegistry [flutter-web] 出错

我正在尝试在我的网页中添加 pdf 视图(flutter web)。这是代码的一部分

ui.platformViewRegistry.registerViewFactory(
        'hello-world-html',
        (int viewId) => html.IFrameElement()
          ..width = '700'
          ..height = '4000'
          ..src = 'http:xxx.pdf'
          ..style.border = 'none');
Run Code Online (Sandbox Code Playgroud)

代码像我想要的那样运行,但我收到这样的错误

The name 'platformViewRegistry' is being referenced through the prefix 'ui', but it isn't defined in any of the libraries imported using that prefix.
Try correcting the prefix or importing the library that defines 'platformViewRegistry'.
Run Code Online (Sandbox Code Playgroud)

有没有办法防止这种错误发生?

在此处输入图片说明

pdf flutter flutter-web

4
推荐指数
2
解决办法
2997
查看次数

如何处理 ListTile flutter 中的右溢出

我有 listTile 来显示标题和副标题......这是代码

ListTile(
              leading: InkWell(
                onTap: () {},
                child: Icon(Icons.fingerprint),
              ),
              title: Text("name xxx"),
              subtitle: 
              Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Row(
                    children: [
                      Text(
                        "xxxxxxxx",
                      ),
                      Text(
                        ' - ',
                        style: TextStyle(
                          fontSize: 10.0,
                        ),
                      ),
                      Text(
                        "yyyyyyyyyy",
                        style: TextStyle(
                          fontSize: 10.0,
                        ),
                      ),
                    ],
                  ),
                ],
              ),
              trailing: ...
            )
Run Code Online (Sandbox Code Playgroud)

当我用长句子替换xxxxxxyyyyyyy时......我明白了right overflowed by 69 pixels,有没有办法显示我的长字幕并防止这个问题

list dart flutter

2
推荐指数
1
解决办法
1971
查看次数

如何在颤振中更新共享首选项中的值

实际上在共享首选项中保存数据时..我正在使用此代码

add() async {
  SharedPreferences prefs = await SharedPreferences.getInstance();
  prefs.setString('data', "ok");
}
Run Code Online (Sandbox Code Playgroud)

但是,有没有办法来更新的值data,例如我想换okfine ,因为当我使用该代码试图重新保存我的数据...并使用叫它prefs.getString('data');它总是显示旧的数据未更新一个

sharedpreferences flutter

0
推荐指数
1
解决办法
3353
查看次数

标签 统计

flutter ×3

dart ×1

flutter-web ×1

list ×1

pdf ×1

sharedpreferences ×1