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