All checks were successful
Build CI / AMD64 Build (push) Successful in 1m54s
141 lines
4.4 KiB
Dart
141 lines
4.4 KiB
Dart
import "dart:io";
|
|
|
|
import "package:flutter/material.dart";
|
|
import "package:prod/models/globalModel.dart";
|
|
import "package:prod/models/project.dart";
|
|
import "package:prod/widgets/editorSelector.dart";
|
|
import "package:provider/provider.dart";
|
|
|
|
class ManageProject extends StatelessWidget {
|
|
const ManageProject(this.id, {super.key});
|
|
final int id;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
GlobalModel gm = Provider.of(context);
|
|
final Project prj = gm.nthPrj(id);
|
|
TextEditingController nameController = TextEditingController();
|
|
TextEditingController pathController = TextEditingController();
|
|
TextEditingController langController = TextEditingController();
|
|
nameController.text = prj.name;
|
|
pathController.text = prj.path.path;
|
|
langController.text = prj.language;
|
|
return SimpleDialog(
|
|
title: Row(
|
|
mainAxisAlignment: .spaceBetween,
|
|
children: [
|
|
OutlinedButton(
|
|
child: Text("Cancel"),
|
|
onPressed: () => Navigator.pop(context),
|
|
),
|
|
Text("Edit Project"),
|
|
FilledButton(
|
|
child: Text("Save"),
|
|
onPressed: () {
|
|
prj.name = nameController.text;
|
|
prj.path = File(pathController.text);
|
|
prj.language = langController.text;
|
|
gm.updatePrj(id, prj);
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
SnackBar(
|
|
content: Text("Updated Project Details"),
|
|
duration: Duration(milliseconds: 2000),
|
|
),
|
|
);
|
|
Navigator.pop(context);
|
|
},
|
|
// gm.updateEdited(false);
|
|
),
|
|
],
|
|
),
|
|
children: [
|
|
TextField(
|
|
style: TextStyle(fontSize: 50),
|
|
controller: nameController,
|
|
textAlign: .center,
|
|
// onEditingComplete: () => gm.updateEdited(true),
|
|
decoration: InputDecoration(
|
|
border: .none,
|
|
enabledBorder: .none,
|
|
fillColor: Colors.transparent,
|
|
),
|
|
),
|
|
TextField(
|
|
style: TextStyle(fontSize: 30),
|
|
controller: pathController,
|
|
textAlign: .center,
|
|
// onEditingComplete: () => gm.updateEdited(true),
|
|
decoration: InputDecoration(
|
|
labelText: "Path",
|
|
border: .none,
|
|
// enabledBorder: .none,
|
|
fillColor: Colors.transparent,
|
|
),
|
|
),
|
|
TextField(
|
|
style: TextStyle(fontSize: 30),
|
|
controller: langController,
|
|
textAlign: .center,
|
|
// onEditingComplete: () => gm.updateEdited(true),
|
|
decoration: InputDecoration(
|
|
labelText: "Language",
|
|
border: .none,
|
|
enabledBorder: .none,
|
|
fillColor: Colors.transparent,
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Card(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
mainAxisAlignment: .spaceEvenly,
|
|
crossAxisAlignment: .start,
|
|
children: [
|
|
Text("Select Editors:"),
|
|
SizedBox(height: 10),
|
|
Row(
|
|
mainAxisAlignment: .spaceEvenly,
|
|
children: [
|
|
EditorSelector(3, id),
|
|
SizedBox(width: 10),
|
|
EditorSelector(0, id),
|
|
],
|
|
),
|
|
SizedBox(height: 10),
|
|
Row(
|
|
mainAxisAlignment: .spaceEvenly,
|
|
children: [
|
|
EditorSelector(2, id),
|
|
SizedBox(width: 10),
|
|
EditorSelector(1, id),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
// Row(
|
|
// children: [
|
|
// OutlinedButton(
|
|
// child: Text("Delete"),
|
|
// onPressed: () {
|
|
// Navigator.pop(context);
|
|
// gm.delPrj(id);
|
|
// ScaffoldMessenger.of(context).showSnackBar(
|
|
// SnackBar(
|
|
// content: Text("Deleted ${prj.name}"),
|
|
// duration: Duration(milliseconds: 2350),
|
|
// ),
|
|
// );
|
|
// },
|
|
// ),
|
|
// ],
|
|
// ),
|
|
],
|
|
);
|
|
}
|
|
}
|