76 lines
2.4 KiB
Dart
76 lines
2.4 KiB
Dart
import "package:flutter/material.dart";
|
|
import "package:prod/models/globalModel.dart";
|
|
import "package:prod/models/project.dart";
|
|
import "package:provider/provider.dart";
|
|
|
|
class ProjFAB extends StatelessWidget {
|
|
const ProjFAB({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
TextEditingController nameController = TextEditingController();
|
|
TextEditingController locationController = TextEditingController();
|
|
TextEditingController languageController = TextEditingController();
|
|
return FloatingActionButton(
|
|
onPressed: () {
|
|
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"),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: TextField(
|
|
controller: languageController,
|
|
decoration: InputDecoration(labelText: "Language"),
|
|
),
|
|
),
|
|
|
|
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,
|
|
languageController.text,
|
|
locationController.text,
|
|
),
|
|
);
|
|
|
|
Navigator.pop(context);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
child: Icon(Icons.add),
|
|
);
|
|
}
|
|
}
|