easytodo/lib/util/dialog_box.dart
2024-03-27 21:45:41 +05:30

49 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
import 'my_button.dart';
// ignore: must_be_immutable
class DialogBox extends StatelessWidget {
// ignore: prefer_typing_uninitialized_variables
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),
],
),
],
),
),
);
}
}