美文网首页
Flutter报错:No MaterialLocalizatio

Flutter报错:No MaterialLocalizatio

作者: 豆大人007 | 来源:发表于2021-03-11 15:15 被阅读0次

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════ The following assertion was thrown building AppBar(dirty, dependencies: [_LocalizationsScope-[GlobalKey#17f6b]], state: _AppBarState#a8384): No MaterialLocalizations found.

AppBar widgets require MaterialLocalizations to be provided by a Localizations widget ancestor. The material library uses Localizations to generate messages, labels, and abbreviations.

To introduce a MaterialLocalizations, either use a MaterialApp at the root of your application to include them automatically, or add a Localization widget with a MaterialLocalizations delegate.

APP风格选用的cupertino,在page中使用了Scaffold对appBar进行了设置,导致的该原因。 解决方法:将Scaffold替换为cupertino中的CupertinoPageScaffold就可以了。

相关文章

网友评论

      本文标题:Flutter报错:No MaterialLocalizatio

      本文链接:https://www.haomeiwen.com/subject/icxoqltx.html