Convert functions with immidiate returns to expressions
change () { return X; } to () => X
This commit is contained in:
parent
4deafcb29f
commit
45e42ac322
|
@ -95,48 +95,46 @@ class CommunityPage extends HookWidget {
|
||||||
body: DefaultTabController(
|
body: DefaultTabController(
|
||||||
length: 3,
|
length: 3,
|
||||||
child: NestedScrollView(
|
child: NestedScrollView(
|
||||||
headerSliverBuilder: (context, innerBoxIsScrolled) {
|
headerSliverBuilder: (context, innerBoxIsScrolled) => <Widget>[
|
||||||
return <Widget>[
|
// TODO: change top section to be more flexible
|
||||||
// TODO: change top section to be more flexible
|
SliverAppBar(
|
||||||
SliverAppBar(
|
expandedHeight: 300,
|
||||||
expandedHeight: 300,
|
floating: false,
|
||||||
floating: false,
|
pinned: true,
|
||||||
pinned: true,
|
elevation: 0,
|
||||||
elevation: 0,
|
backgroundColor: theme.cardColor,
|
||||||
backgroundColor: theme.cardColor,
|
iconTheme: theme.iconTheme,
|
||||||
iconTheme: theme.iconTheme,
|
title: Text('!${community.name}',
|
||||||
title: Text('!${community.name}',
|
style: TextStyle(color: colorOnCard)),
|
||||||
style: TextStyle(color: colorOnCard)),
|
actions: [
|
||||||
actions: [
|
IconButton(icon: Icon(Icons.share), onPressed: _share),
|
||||||
IconButton(icon: Icon(Icons.share), onPressed: _share),
|
IconButton(
|
||||||
IconButton(
|
icon: Icon(Icons.more_vert), onPressed: _openMoreMenu),
|
||||||
icon: Icon(Icons.more_vert), onPressed: _openMoreMenu),
|
],
|
||||||
],
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
background: _CommunityOverview(
|
||||||
background: _CommunityOverview(
|
community,
|
||||||
community,
|
instanceUrl: instanceUrl,
|
||||||
instanceUrl: instanceUrl,
|
goToInstance: _goToInstance,
|
||||||
goToInstance: _goToInstance,
|
subscribe: _subscribe,
|
||||||
subscribe: _subscribe,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SliverPersistentHeader(
|
),
|
||||||
delegate: _SliverAppBarDelegate(
|
SliverPersistentHeader(
|
||||||
TabBar(
|
delegate: _SliverAppBarDelegate(
|
||||||
labelColor: theme.textTheme.bodyText1.color,
|
TabBar(
|
||||||
unselectedLabelColor: Colors.grey,
|
labelColor: theme.textTheme.bodyText1.color,
|
||||||
tabs: [
|
unselectedLabelColor: Colors.grey,
|
||||||
Tab(text: 'Posts'),
|
tabs: [
|
||||||
Tab(text: 'Comments'),
|
Tab(text: 'Posts'),
|
||||||
Tab(text: 'About'),
|
Tab(text: 'Comments'),
|
||||||
],
|
Tab(text: 'About'),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
pinned: true,
|
|
||||||
),
|
),
|
||||||
];
|
pinned: true,
|
||||||
},
|
),
|
||||||
|
],
|
||||||
body: TabBarView(
|
body: TabBarView(
|
||||||
children: [
|
children: [
|
||||||
ListView(
|
ListView(
|
||||||
|
@ -351,9 +349,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool shouldRebuild(_SliverAppBarDelegate oldDelegate) {
|
bool shouldRebuild(_SliverAppBarDelegate oldDelegate) => false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AboutTab extends StatelessWidget {
|
class _AboutTab extends StatelessWidget {
|
||||||
|
@ -479,10 +475,8 @@ class _Badge extends StatelessWidget {
|
||||||
|
|
||||||
class _Divider extends StatelessWidget {
|
class _Divider extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) => Padding(
|
||||||
return Padding(
|
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
|
child: Divider(),
|
||||||
child: Divider(),
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue