Turn bio into IIFE

This commit is contained in:
krawieck 2020-09-04 11:04:10 +02:00
parent e788ed03e5
commit 8f9bf91056
1 changed files with 17 additions and 17 deletions

View File

@ -29,16 +29,15 @@ class UserProfile extends HookWidget {
var userViewSnap = useFuture(_userView, preserveState: false); var userViewSnap = useFuture(_userView, preserveState: false);
Widget bio; Widget bio = () {
if (userViewSnap.hasData) { if (userViewSnap.hasData) {
if (userViewSnap.data.bio != null) { if (userViewSnap.data.bio != null) {
bio = Padding( return Padding(
padding: const EdgeInsets.all(10), padding: const EdgeInsets.all(10),
child: Text(userViewSnap.data.bio), child: Text(userViewSnap.data.bio),
); );
} else { } else {
bio = Center( return Center(
child: Text( child: Text(
'no bio', 'no bio',
style: const TextStyle(fontStyle: FontStyle.italic), style: const TextStyle(fontStyle: FontStyle.italic),
@ -46,8 +45,9 @@ class UserProfile extends HookWidget {
); );
} }
} else { } else {
bio = Center(child: CircularProgressIndicator()); return Center(child: CircularProgressIndicator());
} }
}();
Widget tabs() => DefaultTabController( Widget tabs() => DefaultTabController(
length: 3, length: 3,