Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a Home Screen and the ability to add tasks #9

Merged
merged 4 commits into from
Apr 9, 2021

Conversation

Rift3000
Copy link
Collaborator

@Rift3000 Rift3000 commented Apr 6, 2021

No description provided.

Copy link
Contributor

@hanskokx hanskokx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't try compiling and running this - I'm making the assumption that you wouldn't push it if it didn't compile.

final String title;
Icon taskIcon = Icon(Icons.alarm);

TaskList({this.title, this.taskIcon});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If title is empty, this will fail. Mark title as required.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point

class TaskListHome extends ChangeNotifier {
List<TaskList> taskList = [
TaskList(title: "Rift's Corner", taskIcon: Icon(Icons.alarm)),
TaskList(title: "Han's Corner", taskIcon: Icon(Icons.run_circle)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Han's => Hans'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh I see

}

void addTask(String myTaskTitle) {
final task = TaskList(title: myTaskTitle);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will you add the taskIcon later?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thinnk that is something that could be explored in the future. Allowing the user to select a task icon would be cool

Navigator.pop(context);
},
style: TextButton.styleFrom(backgroundColor: Colors.lightBlue),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Perhaps the color should be specified in a global theme? Then you can use Theme.of(context).xxxx

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmhhnnn you smart

style: TextStyle(
color: Colors.white,
fontSize:
MediaQuery.of(context).size.width / 20,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a dangerous calculation. Maybe set a minimum, and use a Wrap()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set it to a minimum? what do you mean?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, the screen size always determines the font size. If someone happens to have a very small screen, the text could be size 2. Just do a simple if statement. If the resulting font size is smaller than ~10, use a font size of 10. Otherwise, make sure you are using a whole number.

child: Text('Add A Task',
style: TextStyle(
color: Colors.white,
fontSize: MediaQuery.of(context).size.width / 20,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

cursorColor: Colors.white,
autocorrect: true,
onChanged: (newTitle) {
print(newTitle);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to remove debugging statements

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

totally forgot

elevation: 5.0,
padding: EdgeInsets.all(20.0)),
onPressed: () {
Provider.of<TaskListHome>(context, listen: false).addTask(title);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this fails for some reason, we'll still pop. Might want to introduce some additional error handling, especially if this ends up pushing to a network resource (which may be unavailable)

@Rift3000
Copy link
Collaborator Author

Rift3000 commented Apr 7, 2021

I addressed all the issues you highlighted and added two images to the Readme to show a little progress. Issues touched: Error handling, using ThemeData, debugging statements removed, etc. Currently don't see the need to add a wrap. We could possibly add it or review in the future.

Copy link
Contributor

@hanskokx hanskokx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny changes, but otherwise looks good.

],
),
);
backgroundColor: Colors.purple,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe pull from the theme?

title = newTitle;
},
textAlign: TextAlign.center,
style: TextStyle(color: Colors.black, fontSize: 20.0),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theme?

style: TextStyle(color: Colors.black, fontSize: 20.0),
decoration: InputDecoration(
filled: true,
fillColor: Colors.white,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theme?....you get the idea....

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol Really not seeing the point of changing every color to use theme. Enlighten me

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Light mode vs Dark mode

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Adding a dark mode later would be cool

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it keeps things consistent. If all the text should be the same color, using a shared variable saves time and effort when you want to change it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I used Theme

Copy link
Contributor

@hanskokx hanskokx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So close! You can do it, Jason! 📣

"Create",
style: TextStyle(color: Theme.of(context).canvasColor),
),
backgroundColor: Colors.lightBlueAccent,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theme 😅

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HOW did I miss these!!! LOL

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

n00b

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol..... takes one to know one.....

clipBehavior: Clip.none,
children: <Widget>[
TextFormField(
cursorColor: Colors.black,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

? IconButton(
icon: Icon(
Icons.error,
color: Colors.red,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... I'll accept it

width: 270,
height: 50,
decoration: BoxDecoration(
color: Colors.white,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.lightBlue,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

}
},
child: Text('Add Task',
style: TextStyle(color: Colors.white, fontSize: 20.0)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

@Rift3000
Copy link
Collaborator Author

Rift3000 commented Apr 9, 2021

This time for sure! None escaped my sight

@Rift3000
Copy link
Collaborator Author

Rift3000 commented Apr 9, 2021

Why not merge the pull request

@hanskokx
Copy link
Contributor

hanskokx commented Apr 9, 2021

Why not merge the pull request

Because I don't have permissions on this repo 🤷🏻‍♂️

@hanskokx hanskokx merged commit c74fcf6 into Flutter-Buddies:main Apr 9, 2021
This was linked to issues Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Text notes Create a Home Screen
2 participants