-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b4d356
commit b76436e
Showing
8 changed files
with
71 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:stacker_news/data/models/session.dart'; | ||
import 'package:stacker_news/utils.dart'; | ||
import 'package:stacker_news/views/pages/new_post/new_post_page.dart'; | ||
|
||
class MaybeNewPostFab extends StatefulWidget { | ||
const MaybeNewPostFab({super.key}); | ||
|
||
@override | ||
State<MaybeNewPostFab> createState() => _MaybeNewPostFabState(); | ||
} | ||
|
||
class _MaybeNewPostFabState extends State<MaybeNewPostFab> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return FutureBuilder( | ||
future: Utils.getSession(), | ||
builder: (context, snapshot) { | ||
if (snapshot.hasData && snapshot.data is Session) { | ||
return FloatingActionButton.extended( | ||
onPressed: () { | ||
Navigator.pushNamed(context, NewPostPage.id); | ||
}, | ||
icon: const Icon(Icons.add), | ||
label: const Text('New Post'), | ||
); | ||
} | ||
|
||
return Container(); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters