This document provides a step-by-step guide to build a To-Do app with Flutter. It discusses creating the app structure, data model, displaying and creating tasks, adding state management and navigation. It also covers integrating Firebase authentication to add a login screen. Key aspects covered include creating routes, callbacks to handle state changes, and using Firebase APIs to authenticate users. The guide is intended to help learn Flutter development and understand how to build a complete To-Do app with features like data storage and user authentication.
A brief wrap up and introduction to SwiftUI and Combine brought by Apple in WWDC 2019, as well as utilizing both to propose a View-Model-ViewModel (MVVM) structure.
In JavaScript, almost "everything" is an object.
-Booleans can be objects (if defined with the new keyword)
-Numbers can be objects (if defined with the new keyword)
-Strings can be objects (if defined with the new keyword)
-Dates are always objects
-Maths are always objects
-Regular expressions are always objects
-Arrays are always objects
-Functions are always objects
-Objects are always objects
In this core java training session, you will learn Collections - Maps. Topics covered in this session are:
• Collections – Maps
• Map Interface
• Map methods
• Mapuse
• Hashmap
• Treemap
• Utilities
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
Test Driven Development emphasises quick iterations for your code. You won't code faster, but perhaps you will be more accurate.
TDD has been around for a while and I have avoided it for most of my career. I decided for the month of October all code I write I will do TDD. The result was much more positive than I thought it would be and made me rethink how I code. This talk covers the testing pyramid, the importance of unit testing and the tools I use for testing React. As part of the talk I will work through a trivial example to demonstrate how to do TDD.
A brief wrap up and introduction to SwiftUI and Combine brought by Apple in WWDC 2019, as well as utilizing both to propose a View-Model-ViewModel (MVVM) structure.
In JavaScript, almost "everything" is an object.
-Booleans can be objects (if defined with the new keyword)
-Numbers can be objects (if defined with the new keyword)
-Strings can be objects (if defined with the new keyword)
-Dates are always objects
-Maths are always objects
-Regular expressions are always objects
-Arrays are always objects
-Functions are always objects
-Objects are always objects
In this core java training session, you will learn Collections - Maps. Topics covered in this session are:
• Collections – Maps
• Map Interface
• Map methods
• Mapuse
• Hashmap
• Treemap
• Utilities
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
Test Driven Development emphasises quick iterations for your code. You won't code faster, but perhaps you will be more accurate.
TDD has been around for a while and I have avoided it for most of my career. I decided for the month of October all code I write I will do TDD. The result was much more positive than I thought it would be and made me rethink how I code. This talk covers the testing pyramid, the importance of unit testing and the tools I use for testing React. As part of the talk I will work through a trivial example to demonstrate how to do TDD.
Presentation used for my session on Facebook Developer Circle Chennai - React Native for beginners meetup.
Repository for code files can be found at https://github.com/DaniAkash/FBDevCChennai-ReactNative-for-beginners
Event website: https://fbdc-chennai-1.splashthat.com/
This talk is about Nestjs and how it can help you build clean Nodejs backend apps, we will be covering also essential web development and JavaScript must know technologies and tools such as TypeScript and others.
JavaScript is an object-based scripting language that is lightweight and cross-platform.
JavaScript is a solution of client side dynamic pages.
JavaScript is helpful in designing interactive web-pages.
CSS stands for Cascading Style Sheets
Styles define how to display HTML elements
External Style Sheets can save a lot of work
Styles are normally saved in external .css files. External style sheets enable you to change the appearance and layout of all the pages in a Web site, just by editing one single file!
A simple tutorial for understanding the basics of angular JS. Very useful for the beginners. Also useful for the quick revision. Very attractive design for the tutorial of angular js.
How to build to do app using vue composition api and vuex 4 with typescriptKaty Slemon
In this tutorial, we will build a to-do app using Vue Composition API & Vuex 4 with Typescript. We will learn and explore Composition API & Options API as well
Presentation used for my session on Facebook Developer Circle Chennai - React Native for beginners meetup.
Repository for code files can be found at https://github.com/DaniAkash/FBDevCChennai-ReactNative-for-beginners
Event website: https://fbdc-chennai-1.splashthat.com/
This talk is about Nestjs and how it can help you build clean Nodejs backend apps, we will be covering also essential web development and JavaScript must know technologies and tools such as TypeScript and others.
JavaScript is an object-based scripting language that is lightweight and cross-platform.
JavaScript is a solution of client side dynamic pages.
JavaScript is helpful in designing interactive web-pages.
CSS stands for Cascading Style Sheets
Styles define how to display HTML elements
External Style Sheets can save a lot of work
Styles are normally saved in external .css files. External style sheets enable you to change the appearance and layout of all the pages in a Web site, just by editing one single file!
A simple tutorial for understanding the basics of angular JS. Very useful for the beginners. Also useful for the quick revision. Very attractive design for the tutorial of angular js.
How to build to do app using vue composition api and vuex 4 with typescriptKaty Slemon
In this tutorial, we will build a to-do app using Vue Composition API & Vuex 4 with Typescript. We will learn and explore Composition API & Options API as well
Everybody knows : Web is the platform of the future. Developing for the browser unfortunately requires us to learn and write JavaScript. Not only that but we also have to integrate the JavaScript client code with the server side, which often runs on the JVM (i.e. is written in Java). So we have to work in two different languages with completely different tools and APIs, and cannot share code between the client and the server.
The Google Web Toolkit (GWT) provides a way to write your client side web application entirely in Java and have it automatically translated to fast and compact JavaScript. It allows you to access all the browser functionality through a statically typed API. You only have to learn and use one language and you can use your code on the client as well as on the server.
The downside : Java is a bad match for the asynchronous programming model required on the browser and generally forces us to write and read a lot of boilerplate code.
In this session you'll see how programming GWT applications with Eclipse Xtend provides the best of both worlds:
Static typing with advanced IDE support meets a powerful and expressive language - right at your finger tips.
Here you will learn how to make a Simple React Todo List with its source Code. Get easy react todo app at get source code. We will build this simple React.Js application and will store our information in the local storage. We will discuss every step in this blog.
Using the SharePoint Framework as a surface to express yourself through client side solutions is great but at some point in time, you will require that this beauty you built interacts with APIs holding data that lives within the Office 365 environment. In this session, you will learn how to utilize and optimize your calls to SharePoint via its REST APIs, to the Microsoft Graph and to external services that you might find useful to deliver a rich experience in your solution. You will also learn about how to simplify those calls using the Community-Driven library PnP JS Core that aims to save your time (and sanity) by simplifying the access to the SharePoint REST APIs and to the Microsoft Graph. Goodbye URLs, hello intellisense!
Is your web app drowning in a sea of JavaScript? Has your client-side codebase grown from "a snippet here and there" to "more JavaScript than HTML"? Do you find yourself writing one-off snippets instead of generalized components? You're not the only one. Learn about a handful of strategies you can use to keep your JavaScript codebase lean, modular, and flexible. We'll cover all the major pain points — MVC, templates, persisting state, namespacing, graceful error handling, client/server communication, and separation of concerns. And we'll cover how to do all this incrementally so that you don't have to redo everything from scratch.
Using prime[31] to connect your unity game to azure mobile servicesDavid Voyles
Using prime[31] to connect your unity game to azure mobile services. More info at my blog: http://davevoyles.azurewebsites.net/prime31-azure-plugin-win8-wp8-unity-games-part-3/
In this talk I demonstrated how easy Dojo is integrating into the Adobe AIR runtime. Using a performance analysis tool I demonstrated how to use charting, grids and other features of Adobe AIR and the Dojo Toolkit
Android Classes In Mumbai
best android classes in mumbai with job assistance.
our features are:
expert guidance by it industry professionals
lowest fees of 5000
practical exposure to handle projects
well equiped lab
after course resume writing guidance
Podstawy wykorzystania biblioteki React.js. Prezentacja przedstawiona na warsztatach dla studentów Politechniki Krakowskiej w ramach cyklu wartsztatów DreamLab Academy. W razie pytań zapraszamy do kontaktu academy@dreamlab.pl
The presentation was created for a DreamLab Academy workshop on React.js. For more details get in touch - academy@dreamlab.pl
Similar to To-Do App With Flutter: Step By Step Guide (20)
There are several technologies to ease your development experience, and this list is all about that. However, your understanding of these technologies and your custom project requirements will assist you in choosing the best website framework.
Once you have made a sound decision, get the necessary technical help by hiring dedicated web developers for your business.
Salesforce opens a sea of possibilities for insurance companies with its many clouds. Right from marketing and sales to finance and service, improving your business processes each day is seamless.
You would still wonder how Salesforce for insurance companies works and whether it is the right fit for your company. This PDF will explain everything.
Deploying web apps can be a challenge as it involves several technicalities and careful considerations. However, with the unique capabilities of Forge, business units can learn a more systematic approach to deploying Laravel projects. It is quite effective as a server management tool and can save a company from the hassles of deployment errors.
About 67% of customers prefer using a messaging app when connecting to a business. This led to the very foundation of using a globally-recognized instant messaging app as secure and robust as WhatsApp with Salesforce CRM.
Rest, it will depend upon the Salesforce implementation partners how well they can adapt to the merger and innovate on new and better ways of using it.
Python 3.9 is bringing a major change and is making development faster than before for developers. The new built-in functions will make the development process easier, and faster and decrease lines of code. Being a Python development company, these features will help our python developers and us develop applications.
With Salesforce for real estate investors, business units can break through the shackles of traditional real estate deals and embrace technological evolution to its core.
Let's understand this industry in this PDF.
The regular updates of Odoo help the software become more flexible, feature-rich, and user-friendly and the same is expected of Odoo version 16. With the introduction of many new features to various improvements in modules, businesses are in for a streamlined, improved, and user-friendly experience.
Are you looking to know about Odoo 16 Features, Odoo Upgrade, and Odoo release? Here you can read all about it Connect to us for Odoo queries.
Programming languages helped us reach the moon and helped us invent new things in computer science, making our lives easier. Over the years, programming languages evolved with the help of open-source projects, companies, and the contributions of developers. Today there are plenty of programming languages for web apps development and ecommerce apps development.
Here is everything you need to know about cross-platform application development, why businesses need it, its benefits, different frameworks, which to use, and more.
Read top 11 reasons why you should consider Flutter app development, how it has grown immensely in a short span, and how it is better compared to other technology for application development.
The purpose of incorporating augmented reality shopping efforts is to create customer relationships, increase sales and add value to the experience of shoppers. By way of several conventional and non-traditional experiences, retailers are having a chance to attract their target audience.
Though AR has many benefits, implementing it is challenging. Yes, the education app development company you choose will help you with the technological aspects. However, there are other limitations that you need to tackle.
Many businesses choose AngularJS for their front-end development. Here are the reasons why AngularJS web development services are in high demand for web and app development.
We create and deliver robust CRM development solution with valuable and useful maintenance services to enterprises to perform better. The array of service offered by our crew of developers includes website and application development, module development, CRM migration and integration. To know more about our services, refer our SugarCRM brochure!
http://bit.ly/1c0zEsa
We Offer feature-packed and reliable CakePHP web development solution with best-in-class maintenance services to enterprises across the globe . The array of services we offer includes application development, shopping cart development solution, themes / templates customization and development. To know more about our services, refer our CakePHP brochure!
http://bit.ly/1DLHfEU
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
Enterprise Resource Planning System includes various modules that reduce any business's workload. Additionally, it organizes the workflows, which drives towards enhancing productivity. Here are a detailed explanation of the ERP modules. Going through the points will help you understand how the software is changing the work dynamics.
To know more details here: https://blogs.nyggs.com/nyggs/enterprise-resource-planning-erp-system-modules/
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxrickgrimesss22
Discover the essential features to incorporate in your Winzo clone app to boost business growth, enhance user engagement, and drive revenue. Learn how to create a compelling gaming experience that stands out in the competitive market.
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Mind IT Systems
Healthcare providers often struggle with the complexities of chronic conditions and remote patient monitoring, as each patient requires personalized care and ongoing monitoring. Off-the-shelf solutions may not meet these diverse needs, leading to inefficiencies and gaps in care. It’s here, custom healthcare software offers a tailored solution, ensuring improved care and effectiveness.
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
Traditional software testing methods are being challenged in retail, where customer expectations and technological advancements continually shape the landscape. Enter generative AI—a transformative subset of artificial intelligence technologies poised to revolutionize software testing.
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
Into the Box Keynote Day 2: Unveiling amazing updates and announcements for modern CFML developers! Get ready for exciting releases and updates on Ortus tools and products. Stay tuned for cutting-edge innovations designed to boost your productivity.
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
CyanicLab, an offshore custom software development company based in Sweden,India, Finland, is your go-to partner for startup development and innovative web design solutions. Our expert team specializes in crafting cutting-edge software tailored to meet the unique needs of startups and established enterprises alike. From conceptualization to execution, we offer comprehensive services including web and mobile app development, UI/UX design, and ongoing software maintenance. Ready to elevate your business? Contact CyanicLab today and let us propel your vision to success with our top-notch IT solutions.
RISE with SAP and Journey to the Intelligent Enterprise
To-Do App With Flutter: Step By Step Guide
1. To-Do App With Flutter: Step By Step
Guide
Flutter is easy to learn and implement compared to other
programming languages. Due to its features like single
code-base, support for multiple platforms, etc., Flutter stands
out. Going further, let’s see how to build a step by step guide
to develop a ToDo App using Flutter and why you should hire
Flutter app developer.
Pre-requisites:
Have knowledge of object oriented programming languages
like Dart, Flutter, Java, etc.
Let’s get started:
Things Needed:
Here, we have used Flutter SDK and Android Studio for an
editor. Refer this guide for Flutter installation and Android
Studio setup.
Create an Application:
Create a New Project:
2. Step 1: In the IDE, click on the welcome window or File → New
→ Project → New Project from the main IDE window.
Step 2: Select Flutter in the menu, and click Next.
Step 3: Enter your Project name and Project location.
Step 4: If you are going to publish this app, set the company
domain.
Step 5: Click Finish.
Your newly created project will be the flutter default app.
Data Structure:
Now the first step is to create the data structure as we will
define which data structure is going to be used to store the
TODO list tasks.
Here, we will develop a class to hold the information about the
task to do so, create a file named task.dart in /lib and write the
following code:
class Task {
3. /
/ Class properties
Int _id;
String _name;
bool _completed;
/
/ Default constructor
Task(this._name);
/
/ Getter and setter for id getId() => this._id;
setId(id) => this._id = id;
/
/ Getter and setter for name
getName() => this._name;
setName(name) => this._name = name;
/
/ Getter and setter for completed
isCompleted() => this._completed;
setCompleted(completed) => this._completed = completed;
}
4. Display Tasks:
Now to display the tasks delete all the existing code from
main.dart file and replace it with the following:
The first step is to create a list of tasks. To do so write the
following code:
class TODOApp extends StatelessWidget {
/
/ Creating a list of tasks with some dummy values
final List< Task > tasks = [
Task('Do homework'),
Task('Laundry'),
Task('Finish this draft document’)
];
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'TODO app',
5. home: Scaffold(
appBar: AppBar(
title: Text('TODO app'),
),
/
/ Using ListView.builder to render a list of tasks
body: ListView.builder(
/
/ How many items to render
itemCount: tasks.length,
/
/ Functions that accepts an index and renders a task
itemBuilder: (context, index) {
return ListTile(
title: Text(tasks[index].getName()), );})));}}
With the above code we have one screen which will help you
to display tasks. Our next step is to develop a screen which
allows users to create tasks. Write the following code in
main.dart file:
6. void main() => runApp(TODOApp());
class TODOApp extends StatelessWidget {
final List< Task > tasks = [
Task('Do homework'),
Task('Laundry'),
Task('Finish this tutorial')
];
@override
Widget build(BuildContext context) {
/
/ Instead of rendering content, we define routes for different
screens
/
/ in our app
return MaterialApp(
title: 'TODO app',
initialRoute: '/',
routes: {
7. /
/ Screen to view tasks
'/': (context) => TODOList(tasks: tasks),
/
/ Screen to create tasks
'/create': (context) => TODOCreate(),
},
);
}
}
/
/ A new widget that will render the screen to view tasks
class TODOList extends StatelessWidget {
final List< Task > tasks;
/
/ Receiving tasks from parent widget
TODOList({@required this.tasks});
@override
Widget build(BuildContext context) {
8. return Scaffold(
appBar: AppBar(
title: Text('TODO app'),
),
body: ListView.builder(
itemCount: tasks.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(tasks[index].getName()),
);
}),
/
/ Add a button to open the screen to create a new task
floatingActionButton: FloatingActionButton(
onPressed: () => Navigator.pushNamed(context, '/create'),
child: Icon(Icons.add)
9. ),
);
}
}
/
/ A new widget to render new task creation screen
class TODOCreate extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Create a task')),
/
/ We will finish it later
body: Center(child: Text('Not yet')));
}
}
10. The TODOCreate class will hold the form to create tasks.
Whereas, in TODOApp class we defined routes and initialRoute
which will handle navigation logic.
Protip: Use Navigator class to navigate between routes.
To create new tasks we will create a button in the TODOList
class. Next up, on its onPressed event we will call
Navigator.pushNamed to navigate via TODOCreate. Now your
application will look like this:
11. Stateful Components:
To create and edit new tasks we will use stateful components.
Stateful components hold the tasks and notifies the widgets
when it updates. Rewrite the TODO class code as follows:
class TODOApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return TODO();
}}
/
/ Here we are defining a StatefulWidget
class TODO extends StatefulWidget {
/
/ Every stateful widget must override createState
@override
State< StatefulWidget > createState() {
return TODOState();
}}
12. /
/ This is the state for then TODO widget
class TODOState extends State< TODO > {
/
/ We define the properties for the widget in its state
final List< Task > tasks = [
Task('Do homework'),
Task('Laundry'),
Task('Finish this tutorial')
];
/
/ Now state is responsible for building the widget
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'TODO app',
initialRoute: '/',
routes: {
13. '/': (context) => TODOList(tasks: tasks),
'/create': (context) => TODOCreate(),
}, );}}
Next step is to create a tasks:
Creating Tasks:
Herein, TODOState will provide a callback which you will use
in TODOCreate to create a new task. Callback function passes
into another function so you can execute it later. Rewrite the
code in main.dart:
class TODO extends StatefulWidget {
@override
State< StatefulWidget > createState() {
return TODOState();
}}
class TODOState extends State< TODO > {
/
/ At this point we can remove the dummy data
14. final List< Task > tasks = [];
/
/ Function that modifies the state when a new task is created
void onTaskCreated(String name) {
/
/ All state modifications have to be wrapped in setState
/
/ This way Flutter knows that something has changed
setState(() {
tasks.add(Task(name));
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'TODO app',
initialRoute: '/',
routes: {
15. '/': (context) => TODOList(tasks: tasks),
/
/ Passing our function as a callback
'/create': (context) => TODOCreate(onCreate: onTaskCreated,),
},);}}
class TODOList extends StatelessWidget {
final List< Task > tasks;
TODOList({@required this.tasks});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('TODO app'),
),
body: ListView.builder(
itemCount: tasks.length,
17. final TextEditingController controller = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Create a task')),
body: Center(
child: Padding(
padding: EdgeInsets.all(16),
child: TextField(
autofocus: true,
controller: controller,
decoration: InputDecoration(
labelText: 'Enter name for your task'
) ))),
floatingActionButton: FloatingActionButton(
18. child: Icon(Icons.done),
onPressed: () {
widget.onCreate(controller.text);
Navigator.pop(context);
},), );}}
Compete Tasks:
Make some changes to the TODOState and TODOList classes.
Write the following code:
class TODOState extends State< TODO > {
final List< Task > tasks = [];
void onTaskCreated(String name) {
setState(() {
tasks.add(Task(name));
});
}
21. itemBuilder: (context, index) {
return CheckboxListTile(
title: Text(tasks[index].getName()),
value: tasks[index].isCompleted(),
onChanged: (_) => onToggle(tasks[index]),
);
}),
floatingActionButton: FloatingActionButton(
onPressed: () => Navigator.pushNamed(context, '/create'),
child: Icon(Icons.add)
),
);
}
}
Now your app should look like this:
22. Adding Firebase:
Create a new project on the Firebase console. Read the
detailed guide here to know how to develop a project. Now
configure your app using Firebase. Follow the following steps
to do so:
1) Open file < project folder >/android/build.gradle
Add the following line in dependencies:
classpath 'com.google.gms:google-services:4.3.3'
23. Make sure that you have google() in all the projects like
allprojects → repositories. Next step is open the file < project
folder >/android/app/build.gradle and add this line to the
bottom of the file:
apply plugin: 'com.google.gms.google-services'
Next up you need to add Firebase plugins in the Flutter, to do
so, < project folder >/pubspec.yaml and edit the folder in the
following way:
Dependencies:
Flutter:
sdk: flutter
# Add these lines:
firebase_core: ^1.4.0
firebase_auth: ^3.0.1
cloud_firestore: ^2.4.0
Install Flutter packages using command line or press Packages
in the Android Studio:
24. Splitting Screen in Separate File:
Currently we have all the screens and widgets in the same file
i.e. main.dart. So, we we will split it into two files; list.dart and
create.dart and add the following code respective files:
class TODOList extends StatelessWidget {
final List< Task > tasks;
final onToggle;
TODOList({@required this.tasks, @required this.onToggle});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('TODO app'),
),
body: ListView.builder(
itemCount: tasks.length,
30. );
}
}
Add a Login Screen
To develop a Login screen there are three things we need to
follow:
● Add login screen
● Setup authentication of Firebase console
● Integrate login screen and Firebase API
Start with creating a login.dart file and define the TODOLogin
widget and add it into the routes in main.dart.
Now, add the following code in login.dart file:
class TODOLogin extends StatefulWidget {
/
/ Callback function that will be called on pressing the login
button
final onLogin;
35. }}
class TODOState extends State< TODO > {
final List< Task > tasks = [];
void onTaskCreated(String name) {
setState(() {
tasks.add(Task(name)); });}
void onTaskToggled(Task task) {
setState(() {
task.setCompleted(!task.isCompleted());
}); }
void onLogin(String email, String password) {
/
/ We will finish it later
}
@override
Widget build(BuildContext context) {
36. return MaterialApp(
title: 'TODO app',
initialRoute: '/',
routes: {
'/': (context) => TODOLogin(onLogin: onLogin),
'/list': (context) => TODOList(tasks: tasks, onToggle:
onTaskToggled),
'/create': (context) => TODOCreate(onCreate: onTaskCreated,),
}, ); }}
Now when a user logins it will send email and password to
root widget via callback. Your login screen will look something
like this:
Authenticate with Firebase:
To authenticate we will create a new class of Authentication in
auth.dart it will communicate with Firebase. TODOLogin will
call it on the login button, pass the user to TODOState and
move to the next page.
37. Write the following code in auth.dart file:
class Authentication {
final _firebaseAuth = FirebaseAuth.instance;
Future< FirebaseUser > login(String email, String password)
async {
try {
AuthResult result = await
_firebaseAuth.signInWithEmailAndPassword(
email: email,
password: password
);
return result.user;
} catch (e) {
return null; } }}
void main() => runApp(TODOApp());
class TODOApp extends StatelessWidget {
38. @override
Widget build(BuildContext context) {
return TODO();
}}
class TODO extends StatefulWidget {
@override
State< StatefulWidget > createState() {
return TODOState();
}}
class TODOState extends State< TODO > {
final List< Task > tasks = [];
final Authentication auth = new Authentication();
FirebaseUser user;
void onTaskCreated(String name) {
setState(() {
50. }, ); }}
Setup with Authentication in Firebase Console:
To enable authentication of your application:
● Go to Firebase console → select your project → open
Authentication → click on Setup sign-in method.
● In the next screen, select email/ password and enable it.
Save Tasks to Firebase Firestore:
Turn on Firestore in the Firebase Console. Open it→ go to
database tab → create database → select start in testing mode.
We need to change TODOList to fetch data from Firestore and
update it if user completes the task:
class TODOList extends StatelessWidget {
final collection = Firestore.instance.collection('tasks');
@override
Widget build(BuildContext context) {
return Scaffold(
55. class TODO extends StatefulWidget {
@override
State< StatefulWidget > createState() {
return TODOState();
}}
class TODOState extends State< TODO > {
final Authentication auth = new Authentication();
FirebaseUser user;
void onLogin(FirebaseUser user) {
setState(() {
this.user = user;
}); }
@override
Widget build(BuildContext context) {
return MaterialApp(
56. title: 'TODO app',
initialRoute: '/',
routes: {
'/': (context) => TODOLogin(onLogin: onLogin),
'/list': (context) => TODOList(),
'/create': (context) => TODOCreate(),
}, ); }}
Voila! Our TODO app is ready. Follow these steps to build your
first TODO app using Flutter. Apart from this, if you have an
application idea using Flutter, reach out to us. Hire flutter app
developers from us and our team will help you with turning
your ideas into a reality.