Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/// 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