Apply dart autofix
This commit is contained in:
parent
093bb2fb02
commit
5e647f6f32
5 changed files with 32 additions and 35 deletions
|
@ -1,12 +1,9 @@
|
||||||
import 'dart:convert';
|
|
||||||
import 'dart:typed_data';
|
|
||||||
|
|
||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.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';
|
||||||
import 'package:libac_dart/nbt/SnbtIo.dart';
|
import 'package:libac_dart/nbt/SnbtIo.dart';
|
||||||
import 'package:libac_dart/nbt/Stream.dart';
|
|
||||||
import 'package:libac_dart/nbt/Tag.dart';
|
import 'package:libac_dart/nbt/Tag.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';
|
||||||
|
@ -73,7 +70,7 @@ class EditorState extends State<Editor> {
|
||||||
children: [
|
children: [
|
||||||
Text("Named Binary Tag Editor"),
|
Text("Named Binary Tag Editor"),
|
||||||
Text("Created by Tara Piccari"),
|
Text("Created by Tara Piccari"),
|
||||||
Text("Version: ${VERSION}")
|
Text("Version: $VERSION")
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
ListTile(
|
ListTile(
|
||||||
|
@ -127,9 +124,9 @@ class EditorState extends State<Editor> {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("S A V E N B T"),
|
title: const Text("S A V E N B T"),
|
||||||
subtitle: Text("Save to NBT"),
|
subtitle: const Text("Save to NBT"),
|
||||||
leading: Image(
|
leading: const Image(
|
||||||
image: AssetImage("Icons/PNG/AppLogo.png"),
|
image: AssetImage("Icons/PNG/AppLogo.png"),
|
||||||
),
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
|
@ -146,18 +143,18 @@ class EditorState extends State<Editor> {
|
||||||
context: context,
|
context: context,
|
||||||
builder: (builder) {
|
builder: (builder) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text("Compress the data?"),
|
title: const Text("Compress the data?"),
|
||||||
actions: [
|
actions: [
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context, true);
|
Navigator.pop(context, true);
|
||||||
},
|
},
|
||||||
child: Text("YES")),
|
child: const Text("YES")),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
child: Text("No"))
|
child: const Text("No"))
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -165,16 +162,17 @@ class EditorState extends State<Editor> {
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
// Save uncompressed
|
// Save uncompressed
|
||||||
NbtIo.write(
|
NbtIo.write(
|
||||||
filePath!, controller.children[0].data as CompoundTag);
|
filePath, controller.children[0].data as CompoundTag);
|
||||||
} else
|
} else {
|
||||||
NbtIo.writeCompressed(
|
NbtIo.writeCompressed(
|
||||||
filePath!, controller.children[0].data as CompoundTag);
|
filePath, controller.children[0].data as CompoundTag);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("S A V E S N B T"),
|
title: const Text("S A V E S N B T"),
|
||||||
subtitle: Text("Save to SNBT"),
|
subtitle: const Text("Save to SNBT"),
|
||||||
leading: Image(
|
leading: const Image(
|
||||||
image: AssetImage("Icons/PNG/String.png"),
|
image: AssetImage("Icons/PNG/String.png"),
|
||||||
),
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
|
@ -188,7 +186,7 @@ class EditorState extends State<Editor> {
|
||||||
print(filePath);
|
print(filePath);
|
||||||
|
|
||||||
SnbtIo.writeToFile(
|
SnbtIo.writeToFile(
|
||||||
filePath!, controller.children[0].data as CompoundTag);
|
filePath, controller.children[0].data as CompoundTag);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
|
@ -199,7 +197,7 @@ class EditorState extends State<Editor> {
|
||||||
return TagExt.render(node.data as Tag, context, didChangeState);
|
return TagExt.render(node.data as Tag, context, didChangeState);
|
||||||
} else {
|
} else {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text("${node.label}"),
|
title: Text(node.label),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:nbteditor/Editor.dart';
|
import 'package:nbteditor/Editor.dart';
|
||||||
import 'package:nbteditor/pages/AddPage.dart';
|
import 'package:nbteditor/pages/AddPage.dart';
|
||||||
import 'package:nbteditor/pages/EditValue.dart';
|
|
||||||
import 'package:nbteditor/pages/SNBTEditor.dart';
|
import 'package:nbteditor/pages/SNBTEditor.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:libac_dart/nbt/Tag.dart';
|
import 'package:libac_dart/nbt/Tag.dart';
|
||||||
import 'package:libac_dart/nbt/impl/ByteArrayTag.dart';
|
import 'package:libac_dart/nbt/impl/ByteArrayTag.dart';
|
||||||
import 'package:libac_dart/nbt/impl/IntArrayTag.dart';
|
import 'package:libac_dart/nbt/impl/IntArrayTag.dart';
|
||||||
|
@ -63,9 +62,9 @@ class AddState extends State<AddPage> {
|
||||||
if (!(isArray || isList)) {
|
if (!(isArray || isList)) {
|
||||||
var reply = await showDialog(
|
var reply = await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
routeSettings: RouteSettings(arguments: ""),
|
routeSettings: const RouteSettings(arguments: ""),
|
||||||
builder: (builder) {
|
builder: (builder) {
|
||||||
return RenamePrompt();
|
return const RenamePrompt();
|
||||||
});
|
});
|
||||||
newTagName = reply as String;
|
newTagName = reply as String;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +83,7 @@ class AddState extends State<AddPage> {
|
||||||
context: context,
|
context: context,
|
||||||
routeSettings: RouteSettings(arguments: nTag),
|
routeSettings: RouteSettings(arguments: nTag),
|
||||||
builder: (builder) {
|
builder: (builder) {
|
||||||
return EditValuePrompt();
|
return const EditValuePrompt();
|
||||||
});
|
});
|
||||||
val = reply;
|
val = reply;
|
||||||
}
|
}
|
||||||
|
@ -135,7 +134,7 @@ class AddState extends State<AddPage> {
|
||||||
if (isList || isArray && !canAddAnyType && singleShot) {
|
if (isList || isArray && !canAddAnyType && singleShot) {
|
||||||
singleShot = false;
|
singleShot = false;
|
||||||
|
|
||||||
Future.delayed(Duration(seconds: 2), () {
|
Future.delayed(const Duration(seconds: 2), () {
|
||||||
processTagType(allowedTagTypes[0]);
|
processTagType(allowedTagTypes[0]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -146,7 +145,7 @@ class AddState extends State<AddPage> {
|
||||||
backgroundColor: Constants.TITLEBAR_COLOR,
|
backgroundColor: Constants.TITLEBAR_COLOR,
|
||||||
),
|
),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemBuilder: (builder, index) {
|
itemBuilder: (builder, index) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
|
|
|
@ -3,6 +3,8 @@ import 'package:libac_dart/nbt/Tag.dart';
|
||||||
import 'package:libac_dart/nbt/impl/StringTag.dart';
|
import 'package:libac_dart/nbt/impl/StringTag.dart';
|
||||||
|
|
||||||
class EditValuePrompt extends StatefulWidget {
|
class EditValuePrompt extends StatefulWidget {
|
||||||
|
const EditValuePrompt({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() {
|
State<StatefulWidget> createState() {
|
||||||
return EditValueState();
|
return EditValueState();
|
||||||
|
@ -22,7 +24,7 @@ class EditValueState extends State<EditValuePrompt> {
|
||||||
if (args == null) return;
|
if (args == null) return;
|
||||||
|
|
||||||
if (args is Tag) {
|
if (args is Tag) {
|
||||||
Tag tag = args as Tag;
|
Tag tag = args;
|
||||||
setState(() {
|
setState(() {
|
||||||
TagValueType = tag.getTagType();
|
TagValueType = tag.getTagType();
|
||||||
MainTag = tag;
|
MainTag = tag;
|
||||||
|
@ -35,7 +37,7 @@ class EditValueState extends State<EditValuePrompt> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
icon: Icon(Icons.edit_document),
|
icon: const Icon(Icons.edit_document),
|
||||||
title: Text("Edit Value - ${MainTag.getKey()}"),
|
title: Text("Edit Value - ${MainTag.getKey()}"),
|
||||||
actions: [
|
actions: [
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
|
@ -64,16 +66,16 @@ class EditValueState extends State<EditValuePrompt> {
|
||||||
}
|
}
|
||||||
Navigator.pop(context, val);
|
Navigator.pop(context, val);
|
||||||
},
|
},
|
||||||
child: Text("Submit")),
|
child: const Text("Submit")),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
child: Text("Cancel"))
|
child: const Text("Cancel"))
|
||||||
],
|
],
|
||||||
content: TextField(
|
content: TextField(
|
||||||
controller: TEC,
|
controller: TEC,
|
||||||
decoration: InputDecoration(border: OutlineInputBorder()),
|
decoration: const InputDecoration(border: OutlineInputBorder()),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
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/Tag.dart';
|
import 'package:libac_dart/nbt/Tag.dart';
|
||||||
|
@ -193,7 +192,7 @@ class TagExt {
|
||||||
allowedTagTypes: allowedTypes,
|
allowedTagTypes: allowedTypes,
|
||||||
didChangeState: didChangeState));
|
didChangeState: didChangeState));
|
||||||
},
|
},
|
||||||
icon: Icon(Icons.add)),
|
icon: const Icon(Icons.add)),
|
||||||
if (isNamed)
|
if (isNamed)
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
@ -211,14 +210,14 @@ class TagExt {
|
||||||
state.update();
|
state.update();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
icon: Icon(Icons.drive_file_rename_outline)),
|
icon: const Icon(Icons.drive_file_rename_outline)),
|
||||||
if (editableValue)
|
if (editableValue)
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
var response = await showAdaptiveDialog(
|
var response = await showAdaptiveDialog(
|
||||||
context: ctx,
|
context: ctx,
|
||||||
builder: (B) {
|
builder: (B) {
|
||||||
return EditValuePrompt();
|
return const EditValuePrompt();
|
||||||
},
|
},
|
||||||
routeSettings: RouteSettings(arguments: tag));
|
routeSettings: RouteSettings(arguments: tag));
|
||||||
|
|
||||||
|
@ -230,7 +229,7 @@ class TagExt {
|
||||||
didChangeState.call();
|
didChangeState.call();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
icon: Icon(Icons.edit_document))
|
icon: const Icon(Icons.edit_document))
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue