Begin adding a search function
This commit is contained in:
parent
7000383758
commit
55a3e6859e
5 changed files with 89 additions and 2 deletions
|
@ -1 +1 @@
|
||||||
const VERSION = "1.1.012225+0420";
|
const VERSION = "1.1.012325+1215";
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_treeview/flutter_treeview.dart';
|
import 'package:flutter_treeview/flutter_treeview.dart';
|
||||||
import 'package:libac_dart/nbt/NbtIo.dart';
|
import 'package:libac_dart/nbt/NbtIo.dart';
|
||||||
|
@ -14,6 +15,7 @@ import 'package:nbteditor/Constants.dart';
|
||||||
import 'package:nbteditor/Consts2.dart';
|
import 'package:nbteditor/Consts2.dart';
|
||||||
import 'package:nbteditor/SessionData.dart';
|
import 'package:nbteditor/SessionData.dart';
|
||||||
import 'package:nbteditor/main.dart';
|
import 'package:nbteditor/main.dart';
|
||||||
|
import 'package:nbteditor/pages/EditValue.dart';
|
||||||
import 'package:nbteditor/tags/ArrayEntry.dart';
|
import 'package:nbteditor/tags/ArrayEntry.dart';
|
||||||
import 'package:nbteditor/tags/CompoundTag.dart';
|
import 'package:nbteditor/tags/CompoundTag.dart';
|
||||||
import 'package:nbteditor/tags/Tag.dart';
|
import 'package:nbteditor/tags/Tag.dart';
|
||||||
|
@ -67,6 +69,21 @@ class EditorState extends State<Editor> {
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: Constants.TITLEBAR_COLOR,
|
backgroundColor: Constants.TITLEBAR_COLOR,
|
||||||
title: Text("Named Binary Tag Editor${appendCompressed()}"),
|
title: Text("Named Binary Tag Editor${appendCompressed()}"),
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
// Show input prompt
|
||||||
|
var searchResponse = await showCupertinoDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (dialogBuilder) {
|
||||||
|
return InputPrompt(
|
||||||
|
titleText: "What tag name to search for?",
|
||||||
|
PromptText:
|
||||||
|
"Enter the tag name you want to search for");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
icon: const Icon(CupertinoIcons.search_circle))
|
||||||
|
],
|
||||||
),
|
),
|
||||||
drawer: Drawer(
|
drawer: Drawer(
|
||||||
backgroundColor: Constants.DRAWER_COLOR,
|
backgroundColor: Constants.DRAWER_COLOR,
|
||||||
|
|
|
@ -2,6 +2,61 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:libac_dart/nbt/Tag.dart';
|
import 'package:libac_dart/nbt/Tag.dart';
|
||||||
import 'package:libac_dart/nbt/impl/StringTag.dart';
|
import 'package:libac_dart/nbt/impl/StringTag.dart';
|
||||||
|
|
||||||
|
class InputPrompt extends StatefulWidget {
|
||||||
|
String titleText;
|
||||||
|
String PromptText;
|
||||||
|
String value;
|
||||||
|
InputPrompt(
|
||||||
|
{required this.titleText,
|
||||||
|
required this.PromptText,
|
||||||
|
super.key,
|
||||||
|
this.value = ""});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget> createState() {
|
||||||
|
return InputPromptState(
|
||||||
|
title: Text(titleText), prompt: Text(PromptText), value: value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class InputPromptState extends State<InputPrompt> {
|
||||||
|
final Widget title;
|
||||||
|
final Widget prompt;
|
||||||
|
TextEditingController _editor = TextEditingController();
|
||||||
|
|
||||||
|
InputPromptState({required this.title, required this.prompt, String? value}) {
|
||||||
|
if (value != null) _editor.text = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: title,
|
||||||
|
actions: [
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () async {
|
||||||
|
Navigator.pop(context, _editor.text);
|
||||||
|
},
|
||||||
|
child: Text("Confirm")),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () async {
|
||||||
|
Navigator.pop(context, "");
|
||||||
|
},
|
||||||
|
child: Text("Cancel"))
|
||||||
|
],
|
||||||
|
content: SizedBox(
|
||||||
|
width: 200,
|
||||||
|
height: 100,
|
||||||
|
child: Column(children: [
|
||||||
|
prompt,
|
||||||
|
TextField(
|
||||||
|
controller: _editor,
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class EditValuePrompt extends StatefulWidget {
|
class EditValuePrompt extends StatefulWidget {
|
||||||
const EditValuePrompt({super.key});
|
const EditValuePrompt({super.key});
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_code_editor/flutter_code_editor.dart';
|
import 'package:flutter_code_editor/flutter_code_editor.dart';
|
||||||
import 'package:flutter_highlight/themes/vs.dart';
|
import 'package:flutter_highlight/themes/vs.dart';
|
||||||
|
@ -5,6 +6,7 @@ import 'package:libac_dart/nbt/SnbtIo.dart';
|
||||||
import 'package:libac_dart/nbt/impl/CompoundTag.dart';
|
import 'package:libac_dart/nbt/impl/CompoundTag.dart';
|
||||||
import 'package:nbteditor/Constants.dart';
|
import 'package:nbteditor/Constants.dart';
|
||||||
import 'package:nbteditor/SessionData.dart';
|
import 'package:nbteditor/SessionData.dart';
|
||||||
|
import 'package:nbteditor/pages/EditValue.dart';
|
||||||
|
|
||||||
class SnbtEdit extends StatefulWidget {
|
class SnbtEdit extends StatefulWidget {
|
||||||
const SnbtEdit({super.key});
|
const SnbtEdit({super.key});
|
||||||
|
@ -31,6 +33,19 @@ class SnbtState extends State<SnbtEdit> {
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text("SNBT Editor"),
|
title: const Text("SNBT Editor"),
|
||||||
backgroundColor: Constants.TITLEBAR_COLOR,
|
backgroundColor: Constants.TITLEBAR_COLOR,
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
var searchResponse = await showCupertinoDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (searchBuilder) {
|
||||||
|
return InputPrompt(
|
||||||
|
titleText: "Search",
|
||||||
|
PromptText: "What do you want to search for?");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
icon: Icon(CupertinoIcons.search))
|
||||||
|
],
|
||||||
),
|
),
|
||||||
floatingActionButton: ElevatedButton(
|
floatingActionButton: ElevatedButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
name: nbteditor
|
name: nbteditor
|
||||||
description: A Minecraft NBT Editor written in Flutter
|
description: A Minecraft NBT Editor written in Flutter
|
||||||
publish_to: "none"
|
publish_to: "none"
|
||||||
version: 1.1.012225+0420
|
version: 1.1.012325+1215
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.6.1
|
sdk: ^3.6.1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue