2024-03-27 06:55:26 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'my_button.dart';
|
|
|
|
|
|
|
|
// ignore: must_be_immutable
|
|
|
|
class DialogBox extends StatelessWidget {
|
2024-03-27 16:15:41 +00:00
|
|
|
// ignore: prefer_typing_uninitialized_variables
|
2024-03-27 06:55:26 +00:00
|
|
|
final controller;
|
|
|
|
VoidCallback onSave;
|
|
|
|
VoidCallback onCancel;
|
|
|
|
|
|
|
|
DialogBox({
|
|
|
|
super.key,
|
|
|
|
required this.controller,
|
|
|
|
required this.onSave,
|
|
|
|
required this.onCancel,
|
|
|
|
});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return AlertDialog(
|
|
|
|
backgroundColor: Colors.deepPurple[50],
|
|
|
|
content: SizedBox(
|
|
|
|
height: 150,
|
|
|
|
width: 1024,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
children: [
|
|
|
|
TextField(
|
|
|
|
controller: controller,
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
border: OutlineInputBorder(),
|
|
|
|
hintText: "Add a new task",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
children: [
|
|
|
|
MyButton(text: "Add", onPressed: onSave),
|
|
|
|
MyButton(text: "Cancel", onPressed: onCancel),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|