moved editing page to popup
All checks were successful
Build CI / AMD64 Build (push) Successful in 1m54s

This commit is contained in:
2026-03-11 01:10:25 +05:30
parent cee48b3e4b
commit ce25d26f70
10 changed files with 164 additions and 181 deletions

View File

@@ -14,7 +14,7 @@ class EditorEditor extends StatelessWidget {
return Scaffold(
appBar: AppBar(title: Text("/ PROject Dashboard / Editors")),
floatingActionButton: EditorFAB(),
body: gm.lenEdt - 1 > 0
body: gm.lenEdt > 0
? LayoutBuilder(
builder: (context, constraints) {
int cols = (constraints.maxWidth / 250).floor();
@@ -25,7 +25,7 @@ class EditorEditor extends StatelessWidget {
mainAxisSpacing: 10,
childAspectRatio: 1.5,
),
itemCount: gm.lenEdt - 1,
itemCount: gm.lenEdt,
itemBuilder: (context, index) => EditorCard(index),
);
},

View File

@@ -7,11 +7,11 @@ import "package:prod/widgets/editorSelector.dart";
import "package:provider/provider.dart";
class ManageProject extends StatelessWidget {
const ManageProject({super.key});
const ManageProject(this.id, {super.key});
final int id;
@override
Widget build(BuildContext context) {
final id = ModalRoute.of(context)?.settings.arguments as int;
GlobalModel gm = Provider.of(context);
final Project prj = gm.nthPrj(id);
TextEditingController nameController = TextEditingController();
@@ -20,136 +20,121 @@ class ManageProject extends StatelessWidget {
nameController.text = prj.name;
pathController.text = prj.path.path;
langController.text = prj.language;
return Scaffold(
appBar: AppBar(title: Text("/ PROject Dashboard / Editing ${prj.name} ")),
body: Container(
// constraints: BoxConstraints(maxWidth: 500),
child: CustomScrollView(
slivers: [
SliverAppBar(
// title: gm.isEdited ? Text("Unsaved Changes") : null,
pinned: false,
snap: false,
floating: false,
automaticallyImplyLeading: false,
automaticallyImplyActions: false,
backgroundColor: Colors.transparent,
shape: LinearBorder(),
),
SliverToBoxAdapter(
child: TextField(
style: TextStyle(fontSize: 50),
controller: nameController,
textAlign: .center,
// onEditingComplete: () => gm.updateEdited(true),
decoration: InputDecoration(
border: .none,
enabledBorder: .none,
fillColor: Colors.transparent,
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),
),
),
),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
style: TextStyle(fontSize: 30),
controller: pathController,
textAlign: .center,
// onEditingComplete: () => gm.updateEdited(true),
decoration: InputDecoration(
labelText: "Path",
border: .none,
// enabledBorder: .none,
fillColor: Colors.transparent,
),
),
),
),
SliverToBoxAdapter(
child: TextField(
style: TextStyle(fontSize: 30),
controller: langController,
textAlign: .center,
// onEditingComplete: () => gm.updateEdited(true),
decoration: InputDecoration(
labelText: "Language",
border: .none,
enabledBorder: .none,
fillColor: Colors.transparent,
),
),
),
SliverList.list(
children: [
Row(
mainAxisAlignment: .spaceEvenly,
children: [
EditorSelector(0, id),
EditorSelector(1, id),
EditorSelector(2, id),
EditorSelector(3, id),
],
),
],
),
SliverList.list(
children: [
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),
),
);
},
),
OutlinedButton(
child: Text("Cancel"),
onPressed: () => Navigator.pop(context),
),
OutlinedButton(
child: Text("Save"),
onPressed: () {
gm.updatePrj(
id,
Project(
nameController.text,
langController.text,
File(pathController.text),
prj.isGit,
),
);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text("Updated Project Details"),
duration: Duration(milliseconds: 2500),
),
);
},
// gm.updateEdited(false);
),
],
),
],
),
// SliverList.builder(
// itemCount: 3,
// itemBuilder: (context, index) {
// return Placeholder();
// },
// ),
],
),
);
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),
// ),
// );
// },
// ),
// ],
// ),
],
);
}
}