前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >flutter No Material widget found.

flutter No Material widget found.

作者头像
yechaoa
发布2022-06-10 14:06:53
发布2022-06-10 14:06:53
46200
代码可运行
举报
文章被收录于专栏:移动开发专栏移动开发专栏
运行总次数:0
代码可运行
代码语言:javascript
代码运行次数:0
运行
复制
I/flutter (25517): No Material widget found.
I/flutter (25517): ListTile widgets require a Material widget ancestor.
I/flutter (25517): In material design, most widgets are conceptually "printed" on a sheet of material. In Flutter's
I/flutter (25517): material library, that material is represented by the Material widget. It is the Material widget
I/flutter (25517): that renders ink splashes, for instance. Because of this, many material library widgets require that
I/flutter (25517): there be a Material widget in the tree above them.
I/flutter (25517): To introduce a Material widget, you can either directly include one, or use a widget that contains
I/flutter (25517): Material itself, such as a Card, Dialog, Drawer, or Scaffold.
I/flutter (25517): The specific widget that could not find a Material ancestor was:
I/flutter (25517):   ListTile

简而言之:

使用了Material 风格的widget 就需要Scaffold作为根布局

什么是Material 风格的widget,比如

  • AppBar
  • BottomAppBar
  • FloatingActionButton
  • Drawer
  • SnackBar
  • BottomSheet
  • BottomNavigationBar
  • ListTile
  • 等等

需要Scaffold作为根布局,意为用Scaffold包裹起来即可

代码语言:javascript
代码运行次数:0
运行
复制
return Scaffold(
      appBar: AppBar( ),
      bottomNavigationBar: BottomNavigationBar( ),
      floatingActionButton: FloatingActionButton( ),
      drawer: Drawer(),
      .....
    );
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019-05-30,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 简而言之:
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档