This commit is contained in:
@@ -8,15 +8,58 @@ class ProjFAB extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
TextEditingController nameController = TextEditingController();
|
||||
TextEditingController locationController = TextEditingController();
|
||||
return FloatingActionButton(
|
||||
onPressed: () {
|
||||
Provider.of<GlobalModel>(context, listen: false).addPrj(
|
||||
Project.validated(
|
||||
"Kimi",
|
||||
"Rust",
|
||||
"/home/arrow/Gitted/cowin",
|
||||
[],
|
||||
true,
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => SimpleDialog(
|
||||
title: Text("Add Project"),
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextField(
|
||||
autofocus: true,
|
||||
controller: nameController,
|
||||
decoration: InputDecoration(labelText: "Project Name"),
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextField(
|
||||
controller: locationController,
|
||||
decoration: InputDecoration(labelText: "Path"),
|
||||
),
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: .end,
|
||||
children: [
|
||||
TextButton(
|
||||
child: Text("Cancel"),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
TextButton(
|
||||
child: Text("Add"),
|
||||
onPressed: () {
|
||||
Provider.of<GlobalModel>(context, listen: false).addPrj(
|
||||
Project.newValidated(
|
||||
nameController.text,
|
||||
"Rust",
|
||||
locationController.text,
|
||||
[],
|
||||
true,
|
||||
),
|
||||
);
|
||||
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user