first working prototype
Some checks failed
Build CI / Build (push) Has been cancelled

This commit is contained in:
2026-02-11 22:59:25 +05:30
parent 6a10685033
commit 73827ea62c
13 changed files with 281 additions and 32 deletions

View File

@@ -1,5 +1,7 @@
import "package:flutter/material.dart";
import "package:prod/models/editor.dart";
import "package:prod/models/globalModel.dart";
import "package:provider/provider.dart";
class EditorFAB extends StatelessWidget {
const EditorFAB({super.key});
@@ -17,6 +19,68 @@ class EditorFAB extends StatelessWidget {
// true,
// ),
// );
TextEditingController nameController = TextEditingController();
TextEditingController commandController = TextEditingController();
TextEditingController commandTemplateController =
TextEditingController();
showDialog(
context: context,
builder: (context) => SimpleDialog(
title: Text("Add Editor"),
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
autofocus: true,
controller: nameController,
decoration: InputDecoration(labelText: "Editor Name"),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
controller: commandController,
decoration: InputDecoration(labelText: "Command"),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
controller: commandTemplateController,
decoration: InputDecoration(labelText: "Command Template"),
),
),
Padding(
child: const Text("Example: zed -n \$path"),
padding: const EdgeInsets.all(9.0),
),
Row(
mainAxisAlignment: .end,
children: [
TextButton(
child: Text("Cancel"),
onPressed: () => Navigator.pop(context),
),
TextButton(
child: Text("Add"),
onPressed: () {
Provider.of<GlobalModel>(context, listen: false).addEdt(
Editor.create(
nameController.text,
commandController.text,
commandTemplateController.text,
),
);
Navigator.pop(context);
},
),
],
),
],
),
);
},
child: Icon(Icons.add),
);