Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class IdeasMainPage extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return BaseView<IdeasMainPageController>(onControllerReady: (controller) {
- controller.initialize();
- }, builder: (context, controller, child) {
- return Scaffold(
- backgroundColor: Colors.white.withOpacity(0.9),
- appBar: AppBar(
- title: Text('Ideas'),
- ),
- floatingActionButton: FloatingActionButton(
- onPressed: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => CreateIdeaPage('Create Idea')));
- },
- child: Icon(Icons.add),
- ),
- body: controller.ideas.isEmpty
- ? NoIdeas()
- : IdeasList(
- ideas: controller.ideas,
- ),
- );
- });
- }
- }
- class IdeasList extends StatelessWidget {
- final List<Idea> ideas;
- const IdeasList({Key key, this.ideas}) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return ListView.builder(
- itemCount: ideas.length,
- itemBuilder: (context, index) {
- return IdeaCard(
- idea: ideas[index],
- );
- });
- }
- }
- class NoIdeas extends StatelessWidget {
- const NoIdeas({Key key}) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return Container();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement