todo save, popup, dismiss show dialog

This commit is contained in:
2023-09-28 23:27:41 +02:00
parent 9b712120a0
commit 37719bd696
5 changed files with 228 additions and 118 deletions

45
lib/utils/dialog_box.dart Normal file
View File

@@ -0,0 +1,45 @@
import 'package:flutter/material.dart';
import 'package:todo/utils/my_button.dart';
class DialogBox extends StatelessWidget {
DialogBox(
{Key? key,
required this.controller,
required this.onSave,
required this.onCancel})
: super(key: key);
final controller;
VoidCallback onSave;
VoidCallback onCancel;
@override
Widget build(BuildContext context) {
return AlertDialog(
backgroundColor: Theme.of(context).primaryColor,
title: Text("New Task"),
content: Container(
height: 120,
child: Column(
children: [
TextField(
controller: controller,
decoration: InputDecoration(
border: OutlineInputBorder(), hintText: "Add new task"),
),
SizedBox(
height: 40,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
MyButton(text: "Cancel", onPressed: onCancel),
MyButton(text: "Save", onPressed: onSave),
],
)
],
),
),
);
}
}