55 lines
1.9 KiB
Dart
55 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:todoapp/modals/addlistmodal.dart';
|
|
import 'package:todoapp/providers/todoprovider.dart';
|
|
import 'package:restart_app/restart_app.dart';
|
|
|
|
class TodoDrawer extends StatefulWidget {
|
|
const TodoDrawer({super.key});
|
|
|
|
@override
|
|
State<TodoDrawer> createState() => _TodoDrawerState();
|
|
}
|
|
|
|
class _TodoDrawerState extends State<TodoDrawer> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Drawer(
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(left: 20, right: 20),
|
|
child: Column(
|
|
children: [
|
|
const SizedBox(height: 60),
|
|
const Text("ToDo", style: TextStyle(fontSize: 20)),
|
|
const SizedBox(height: 20),
|
|
const Divider(height: 1),
|
|
const SizedBox(height: 20),
|
|
const Text("Lists", style: TextStyle(fontSize: 25)),
|
|
const SizedBox(height: 10),
|
|
SingleChildScrollView(
|
|
child: Consumer<TodoProvider>(
|
|
builder: (context, todoProvider, child) =>
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
for (String key in todoProvider.todoLists.keys)
|
|
todoProvider.todoLists[key]!.widget,
|
|
const SizedBox(height: 30),
|
|
FilledButton.icon(
|
|
onPressed: () {
|
|
AddListModal.add(context);
|
|
},
|
|
icon: const Icon(Icons.add),
|
|
label: const Text("Add List"),
|
|
)
|
|
],
|
|
),
|
|
)
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|