mirror of
https://github.com/nisrulz/flutter-examples.git
synced 2025-09-27 01:55:21 +08:00
Add new flutter example of todo app with provider (#78)
This commit is contained in:
27
todo_list_using_provider/lib/main.dart
Normal file
27
todo_list_using_provider/lib/main.dart
Normal file
@ -0,0 +1,27 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'notifiers/todo_list.dart';
|
||||
import 'views/home.dart';
|
||||
|
||||
void main() {
|
||||
runApp(MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||
),
|
||||
home: ChangeNotifierProvider<TodoList>(
|
||||
create: (context) => TodoList(),
|
||||
child: MyHomePage(title: 'Flutter Demo Home Page'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user