All checks were successful
Build CI / AMD64 Build (push) Successful in 2m23s
198 lines
6.9 KiB
Dart
198 lines
6.9 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(
|
|
backgroundColor: Color(0xfff6f6f6),
|
|
title: Row(
|
|
mainAxisAlignment: .spaceBetween,
|
|
children: [
|
|
FilledButton(
|
|
child: Text("Cancel"),
|
|
onPressed: () => Navigator.pop(context),
|
|
),
|
|
Text("Edit Project"),
|
|
ElevatedButton(
|
|
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(
|
|
"Project Details Updated ✅",
|
|
), // The empty space as rendered by Zed is a green check mark. Dont remove it.
|
|
duration: Duration(milliseconds: 2000),
|
|
),
|
|
);
|
|
Navigator.pop(context);
|
|
},
|
|
// gm.updateEdited(false);
|
|
),
|
|
],
|
|
),
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Card(
|
|
shape: RoundedRectangleBorder(
|
|
side: BorderSide(width: 1, color: Colors.grey[350]!),
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
color: Color(0xffffffff),
|
|
child: Column(
|
|
children: [
|
|
TextField(
|
|
style: TextStyle(fontSize: 35),
|
|
controller: nameController,
|
|
textAlign: .left,
|
|
decoration: InputDecoration(
|
|
label: Text(
|
|
"Name",
|
|
style: TextStyle(color: Colors.grey[700]),
|
|
),
|
|
// border: .none,
|
|
enabledBorder: .none,
|
|
fillColor: Colors.transparent,
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(color: Colors.transparent),
|
|
gapPadding: 0,
|
|
),
|
|
border: OutlineInputBorder(
|
|
borderSide: BorderSide(color: Colors.transparent),
|
|
gapPadding: 0,
|
|
),
|
|
),
|
|
),
|
|
Divider(thickness: 1),
|
|
TextField(
|
|
style: TextStyle(fontSize: 20),
|
|
controller: pathController,
|
|
textAlign: .left,
|
|
decoration: InputDecoration(
|
|
label: Text(
|
|
"Path",
|
|
style: TextStyle(color: Colors.grey[700]),
|
|
),
|
|
isCollapsed: false,
|
|
// border: .none,
|
|
enabledBorder: .none,
|
|
fillColor: Colors.transparent,
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(color: Colors.transparent),
|
|
gapPadding: 0,
|
|
),
|
|
border: OutlineInputBorder(
|
|
borderSide: BorderSide(color: Colors.transparent),
|
|
gapPadding: 0,
|
|
),
|
|
),
|
|
),
|
|
Divider(thickness: 1),
|
|
TextField(
|
|
style: TextStyle(fontSize: 20),
|
|
controller: langController,
|
|
textAlign: .left,
|
|
decoration: InputDecoration(
|
|
label: Text(
|
|
"Language",
|
|
style: TextStyle(color: Colors.grey[700]),
|
|
),
|
|
// border: .none,
|
|
enabledBorder: .none,
|
|
fillColor: Colors.transparent,
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(color: Colors.transparent),
|
|
gapPadding: 0,
|
|
),
|
|
border: OutlineInputBorder(
|
|
borderSide: BorderSide(color: Colors.transparent),
|
|
gapPadding: 0,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Card(
|
|
shape: RoundedRectangleBorder(
|
|
side: BorderSide(width: 1, color: Colors.grey[350]!),
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
color: Color(0xffffffff),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Column(
|
|
mainAxisAlignment: .spaceEvenly,
|
|
crossAxisAlignment: .start,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
child: Text("Editors:", style: TextStyle(fontSize: 20)),
|
|
),
|
|
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),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 13.0),
|
|
child: ElevatedButton(
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: Colors.red[100],
|
|
foregroundColor: Colors.red[900],
|
|
),
|
|
onPressed: () {
|
|
gm.delPrj(id);
|
|
Navigator.pop(context);
|
|
},
|
|
child: Row(mainAxisAlignment: .center, children: [Text("Delete")]),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|