Skip to content

Instantly share code, notes, and snippets.

@androidfanatic
Last active March 12, 2020 04:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save androidfanatic/df5a9fa5b395d38084ff71584404febf to your computer and use it in GitHub Desktop.
Save androidfanatic/df5a9fa5b395d38084ff71584404febf to your computer and use it in GitHub Desktop.
/// imports widgets from the material design
import 'package:flutter/material.dart';
void main() => runApp(TodoApp());
/// Stateless widgets must implement the build() method and return a widget.
/// The first parameter passed to build function is the context in which this widget is built
class TodoApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'TODO',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: TodoList(),
);
}
}
/// Stateful widgets must implement the createState method
/// State of a stateless widget against has a build() method with context
class TodoList extends StatefulWidget {
@override
State<StatefulWidget> createState() => TodoListState();
}
class TodoListState extends State<TodoList> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Todo'),
),
body: Text('Todo List'),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment