Flutter从Main开始启动,启动的时候需要最外层是MaterialApp
void main() => runApp(_widgetForRoute(window.defaultRouteName)); Widget _widgetForRoute(String route) { return MaterialApp( color: Colors.white, theme: ThemeData( primarySwatch: Colors.blue, ), home: findHome(route), ); } Widget findHome(String route) { switch (route) { case 'index': return IndexMain(); case 'detail': return ProductDetail(); default: return Center( child: Text('Unknown route: $route', textDirection: TextDirection.ltr), ); } } 如果背景是黑色的使用caffold嵌套 如果文字有黄色下划线,原因是theme的问题,两种方式: 使用顶层Material嵌套(推荐,使用这种方式,原生端页面展示会比其他的好看的) 对Text添加Style: style: new TextStyle(decoration: TextDecoration.