todo save, popup, dismiss show dialog
This commit is contained in:
45
lib/utils/dialog_box.dart
Normal file
45
lib/utils/dialog_box.dart
Normal 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),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user