当先锋百科网

首页 1 2 3 4 5 6 7
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包裹起来即可
 

return Scaffold(
      appBar: AppBar( ),
      bottomNavigationBar: BottomNavigationBar( ),
      floatingActionButton: FloatingActionButton( ),
      drawer: Drawer(),
      .....
    );