Files
todo/lib/utils/dialog_box.dart

46 lines
1.1 KiB
Dart

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),
],
)
],
),
),
);
}
}