我正在尝试在我的网页中添加 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)
有没有办法防止这种错误发生?
我有 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)
当我用长句子替换xxxxxx和yyyyyyy时......我明白了right overflowed by 69 pixels,有没有办法显示我的长字幕并防止这个问题
实际上在共享首选项中保存数据时..我正在使用此代码
add() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setString('data', "ok");
}
Run Code Online (Sandbox Code Playgroud)
但是,有没有办法来更新的值data,例如我想换ok到fine
,因为当我使用该代码试图重新保存我的数据...并使用叫它prefs.getString('data');它总是显示旧的数据未更新一个