People of noble ambition should not belittle themselves. zhugeliang
以上效果是谷歌团队创建的AppBar最初版,经典呀!!!
[知乎]听 Flutter 创始人 Eric 为你讲述 Flutter 的故事
App 应用
Bar 条
简称 应用导航条
/ 圆角/
AppBar( title: Text('AppBarTitle'), backgroundColor: Colors.greenAccent, elevation: 4, shape: RoundedRectangleBorder( side: BorderSide.none, borderRadius: BorderRadius.only( bottomLeft: Radius.circular(50.0), bottomRight: Radius.circular(30.0))), actions: <Widget>[ IconButton( icon: const Icon(Icons.add), ), IconButton( icon: const Icon(Icons.clear), ), IconButton( icon: const Icon(Icons.arrow_drop_down), ), ], )
/斜角/
AppBar( title: Text('AppBarTitle'), backgroundColor: Colors.greenAccent, elevation: 4, shape: BeveledRectangleBorder( side: BorderSide.none, borderRadius: BorderRadius.only( bottomLeft: Radius.circular(20.0), bottomRight: Radius.circular(20.0))), actions: <Widget>[ IconButton( icon: const Icon(Icons.add), ), IconButton( icon: const Icon(Icons.clear), ), IconButton( icon: const Icon(Icons.arrow_drop_down), ), ], )
class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { return Scaffold( body: CustomScrollView( physics: const BouncingScrollPhysics(), slivers: <Widget>[ SliverAppBar( stretch: false, onStretchTrigger: () { // Function callback for stretch return; }, pinned: true, expandedHeight: 300.0, flexibleSpace: FlexibleSpaceBar( stretchModes: <StretchMode>[ StretchMode.zoomBackground, StretchMode.blurBackground, StretchMode.fadeTitle, ], centerTitle: true, title: const Text('Flight Report'), background: Stack( fit: StackFit.expand, children: [ Image.network( 'https://flutter.github.io/assets-for-api-docs/assets/widgets/owl-2.jpg', fit: BoxFit.cover, ), const DecoratedBox( decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment(0.0, 0.5), end: Alignment(0.0, 0.0), colors: <Color>[ Color(0x60000000), Color(0x00000000), ], ), ), ), ], ), ), ), SliverList( delegate: SliverChildListDelegate([ ListTile( leading: Icon(Icons.wb_sunny), title: Text('Sunday'), subtitle: Text('sunny, h: 80, l: 65'), ), ListTile( leading: Icon(Icons.wb_sunny), title: Text('Monday'), subtitle: Text('sunny, h: 80, l: 65'), ), ListTile( leading: Icon(Icons.wb_sunny), title: Text('Sunday'), subtitle: Text('sunny, h: 80, l: 65'), ), ListTile( leading: Icon(Icons.wb_sunny), title: Text('Monday'), subtitle: Text('sunny, h: 80, l: 65'), ), ListTile( leading: Icon(Icons.wb_sunny), title: Text('Sunday'), subtitle: Text('sunny, h: 80, l: 65'), ), ListTile( leading: Icon(Icons.wb_sunny), title: Text('Monday'), subtitle: Text('sunny, h: 80, l: 65'), ), ListTile( leading: Icon(Icons.wb_sunny), title: Text('Sunday'), subtitle: Text('sunny, h: 80, l: 65'), ), ListTile( leading: Icon(Icons.wb_sunny), title: Text('Monday'), subtitle: Text('sunny, h: 80, l: 65'), ), ListTile( leading: Icon(Icons.wb_sunny), title: Text('Sunday'), subtitle: Text('sunny, h: 80, l: 65'), ), ListTile( leading: Icon(Icons.wb_sunny), title: Text('Monday'), subtitle: Text('sunny, h: 80, l: 65'), ), ListTile( leading: Icon(Icons.wb_sunny), title: Text('Monday'), subtitle: Text('sunny, h: 80, l: 65'), ), ListTile( leading: Icon(Icons.wb_sunny), title: Text('Monday'), subtitle: Text('sunny, h: 80, l: 65'), ), ListTile( leading: Icon(Icons.wb_sunny), title: Text('Monday'), subtitle: Text('sunny, h: 80, l: 65'), ), ListTile( leading: Icon(Icons.wb_sunny), title: Text('Monday'), subtitle: Text('sunny, h: 80, l: 65'), ), ListTile( leading: Icon(Icons.wb_sunny), title: Text('Monday'), subtitle: Text('sunny, h: 80, l: 65'), ), // ListTiles++ ]), ), ], ), ); } }
Flutter 基础Widgets之AppBar详解
Flutter 来实现一个渐变色的 AppBar
Flutter之AppBar属性分析
Flutter AppBar设置渐变色背景