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