flutter 隐藏appbar下划线

时间:2020-09-23

通过设置主题,即可将flutter app的所有appbar的下划线隐藏

elevation: 0,

完整参考代码

class MyApp extends StatelessWidget {
  static const String _title = '我要找答案';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: _title,
      theme: ThemeData(
        brightness: Brightness.light,
        primaryColor: Color.fromARGB(255, 85, 132, 250),
        accentColor: Color.fromARGB(255, 85, 132, 250),
        appBarTheme: AppBarTheme(
          textTheme: TextTheme(
            headline6: TextStyle(fontSize: 16.0, fontStyle: FontStyle.normal),
          ),
          elevation: 0,
        ),
      ),
      home: MyStatefulWidget(),
    );
  }
}