From 45e42ac3220db972eeba7c6c57e913c51799db90 Mon Sep 17 00:00:00 2001 From: krawieck Date: Mon, 7 Sep 2020 23:13:05 +0200 Subject: [PATCH] Convert functions with immidiate returns to expressions change () { return X; } to () => X --- lib/pages/community.dart | 88 +++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 47 deletions(-) diff --git a/lib/pages/community.dart b/lib/pages/community.dart index d96f5dd..bec194a 100644 --- a/lib/pages/community.dart +++ b/lib/pages/community.dart @@ -95,48 +95,46 @@ class CommunityPage extends HookWidget { body: DefaultTabController( length: 3, child: NestedScrollView( - headerSliverBuilder: (context, innerBoxIsScrolled) { - return [ - // TODO: change top section to be more flexible - SliverAppBar( - expandedHeight: 300, - floating: false, - pinned: true, - elevation: 0, - backgroundColor: theme.cardColor, - iconTheme: theme.iconTheme, - title: Text('!${community.name}', - style: TextStyle(color: colorOnCard)), - actions: [ - IconButton(icon: Icon(Icons.share), onPressed: _share), - IconButton( - icon: Icon(Icons.more_vert), onPressed: _openMoreMenu), - ], - flexibleSpace: FlexibleSpaceBar( - background: _CommunityOverview( - community, - instanceUrl: instanceUrl, - goToInstance: _goToInstance, - subscribe: _subscribe, - ), + headerSliverBuilder: (context, innerBoxIsScrolled) => [ + // TODO: change top section to be more flexible + SliverAppBar( + expandedHeight: 300, + floating: false, + pinned: true, + elevation: 0, + backgroundColor: theme.cardColor, + iconTheme: theme.iconTheme, + title: Text('!${community.name}', + style: TextStyle(color: colorOnCard)), + actions: [ + IconButton(icon: Icon(Icons.share), onPressed: _share), + IconButton( + icon: Icon(Icons.more_vert), onPressed: _openMoreMenu), + ], + flexibleSpace: FlexibleSpaceBar( + background: _CommunityOverview( + community, + instanceUrl: instanceUrl, + goToInstance: _goToInstance, + subscribe: _subscribe, ), ), - SliverPersistentHeader( - delegate: _SliverAppBarDelegate( - TabBar( - labelColor: theme.textTheme.bodyText1.color, - unselectedLabelColor: Colors.grey, - tabs: [ - Tab(text: 'Posts'), - Tab(text: 'Comments'), - Tab(text: 'About'), - ], - ), + ), + SliverPersistentHeader( + delegate: _SliverAppBarDelegate( + TabBar( + labelColor: theme.textTheme.bodyText1.color, + unselectedLabelColor: Colors.grey, + tabs: [ + Tab(text: 'Posts'), + Tab(text: 'Comments'), + Tab(text: 'About'), + ], ), - pinned: true, ), - ]; - }, + pinned: true, + ), + ], body: TabBarView( children: [ ListView( @@ -351,9 +349,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate { } @override - bool shouldRebuild(_SliverAppBarDelegate oldDelegate) { - return false; - } + bool shouldRebuild(_SliverAppBarDelegate oldDelegate) => false; } class _AboutTab extends StatelessWidget { @@ -479,10 +475,8 @@ class _Badge extends StatelessWidget { class _Divider extends StatelessWidget { @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10), - child: Divider(), - ); - } + Widget build(BuildContext context) => Padding( + padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10), + child: Divider(), + ); }