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,25 +29,25 @@ 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) { return Padding(
bio = Padding( padding: const EdgeInsets.all(10),
padding: const EdgeInsets.all(10), child: Text(userViewSnap.data.bio),
child: Text(userViewSnap.data.bio), );
); } else {
return Center(
child: Text(
'no bio',
style: const TextStyle(fontStyle: FontStyle.italic),
),
);
}
} else { } else {
bio = Center( return Center(child: CircularProgressIndicator());
child: Text(
'no bio',
style: const TextStyle(fontStyle: FontStyle.italic),
),
);
} }
} else { }();
bio = Center(child: CircularProgressIndicator());
}
Widget tabs() => DefaultTabController( Widget tabs() => DefaultTabController(
length: 3, length: 3,