Move action buttons to the right hand side of the tile
This commit is contained in:
parent
391826df62
commit
812b216c86
13 changed files with 50 additions and 38 deletions
|
@ -23,8 +23,9 @@ extension ByteArrayTagExt on ByteArrayTag {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text("TAG_ByteArray (${getKey()})"),
|
title: Text("TAG_ByteArray (${getKey()})"),
|
||||||
leading: const Image(image: AssetImage("Icons/PNG/ByteArray.png")),
|
leading: const Image(image: AssetImage("Icons/PNG/ByteArray.png")),
|
||||||
subtitle: TagExt.getElementDescriptor("${value.length} entries", true,
|
subtitle: TagExt.getElementDescriptor("${value.length} entries"),
|
||||||
false, canBeNamed(this), this, context),
|
trailing: TagExt.getElementButtons(
|
||||||
|
true, canBeNamed(this), false, this, context),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,11 @@ extension ByteTagExt on ByteTag {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text("TAG_Byte (${getKey()})"),
|
title: Text("TAG_Byte (${getKey()})"),
|
||||||
subtitle: TagExt.getElementDescriptor(
|
subtitle: TagExt.getElementDescriptor(
|
||||||
"$value", false, true, canBeNamed(this), this, context),
|
"$value",
|
||||||
|
),
|
||||||
leading: const Image(image: AssetImage("Icons/PNG/Byte.png")),
|
leading: const Image(image: AssetImage("Icons/PNG/Byte.png")),
|
||||||
|
trailing: TagExt.getElementButtons(
|
||||||
|
false, canBeNamed(this), true, this, context),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,10 @@ extension CompoundTagExt on CompoundTag {
|
||||||
title: Text("TAG_Compound (${getKey()})"),
|
title: Text("TAG_Compound (${getKey()})"),
|
||||||
subtitle: TagExt.getElementDescriptor(
|
subtitle: TagExt.getElementDescriptor(
|
||||||
"${value.length} tag${value.length > 1 ? "s" : ""}",
|
"${value.length} tag${value.length > 1 ? "s" : ""}",
|
||||||
true,
|
),
|
||||||
false,
|
|
||||||
canBeNamed(this),
|
|
||||||
this,
|
|
||||||
context),
|
|
||||||
leading: const Image(image: AssetImage("Icons/PNG/Compound.png")),
|
leading: const Image(image: AssetImage("Icons/PNG/Compound.png")),
|
||||||
|
trailing: TagExt.getElementButtons(
|
||||||
|
true, canBeNamed(this), false, this, context),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,10 @@ extension DoubleTagExt on DoubleTag {
|
||||||
Widget render(BuildContext context) {
|
Widget render(BuildContext context) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text("TAG_Double (${getKey()})"),
|
title: Text("TAG_Double (${getKey()})"),
|
||||||
subtitle: TagExt.getElementDescriptor(
|
subtitle: TagExt.getElementDescriptor("$value"),
|
||||||
"$value", false, true, canBeNamed(this), this, context),
|
|
||||||
leading: const Image(image: AssetImage("Icons/PNG/Double.png")),
|
leading: const Image(image: AssetImage("Icons/PNG/Double.png")),
|
||||||
|
trailing: TagExt.getElementButtons(
|
||||||
|
false, canBeNamed(this), true, this, context),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,10 @@ extension FloatTagExt on FloatTag {
|
||||||
Widget render(BuildContext context) {
|
Widget render(BuildContext context) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text("TAG_Float (${getKey()})"),
|
title: Text("TAG_Float (${getKey()})"),
|
||||||
subtitle: TagExt.getElementDescriptor(
|
subtitle: TagExt.getElementDescriptor("$value"),
|
||||||
"$value", false, true, canBeNamed(this), this, context),
|
|
||||||
leading: const Image(image: AssetImage("Icons/PNG/Float.png")),
|
leading: const Image(image: AssetImage("Icons/PNG/Float.png")),
|
||||||
|
trailing: TagExt.getElementButtons(
|
||||||
|
false, canBeNamed(this), true, this, context),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,10 @@ extension IntArrayTagExt on IntArrayTag {
|
||||||
Widget render(BuildContext context) {
|
Widget render(BuildContext context) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text("TAG_IntArray (${getKey()})"),
|
title: Text("TAG_IntArray (${getKey()})"),
|
||||||
subtitle: TagExt.getElementDescriptor("${value.length} entries", true,
|
subtitle: TagExt.getElementDescriptor("${value.length} entries"),
|
||||||
false, canBeNamed(this), this, context),
|
|
||||||
leading: const Image(image: AssetImage("Icons/PNG/IntegerArray.png")),
|
leading: const Image(image: AssetImage("Icons/PNG/IntegerArray.png")),
|
||||||
|
trailing: TagExt.getElementButtons(
|
||||||
|
true, canBeNamed(this), false, this, context),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,10 @@ extension IntTagExt on IntTag {
|
||||||
Widget render(BuildContext context) {
|
Widget render(BuildContext context) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text("TAG_Int (${getKey()})"),
|
title: Text("TAG_Int (${getKey()})"),
|
||||||
subtitle: TagExt.getElementDescriptor(
|
subtitle: TagExt.getElementDescriptor("$value"),
|
||||||
"$value", false, true, canBeNamed(this), this, context),
|
|
||||||
leading: const Image(image: AssetImage("Icons/PNG/Integer.png")),
|
leading: const Image(image: AssetImage("Icons/PNG/Integer.png")),
|
||||||
|
trailing: TagExt.getElementButtons(
|
||||||
|
false, canBeNamed(this), true, this, context),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,10 @@ extension ListTagExt on ListTag {
|
||||||
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text("TAG_List (${getKey()}) ($type)"),
|
title: Text("TAG_List (${getKey()}) ($type)"),
|
||||||
subtitle: TagExt.getElementDescriptor("${value.length} entries", true,
|
subtitle: TagExt.getElementDescriptor("${value.length} entries"),
|
||||||
false, canBeNamed(this), this, context),
|
|
||||||
leading: const Image(image: AssetImage("Icons/PNG/List.png")),
|
leading: const Image(image: AssetImage("Icons/PNG/List.png")),
|
||||||
|
trailing: TagExt.getElementButtons(
|
||||||
|
true, canBeNamed(this), false, this, context),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,10 @@ extension LongArrayTagExt on LongArrayTag {
|
||||||
Widget render(BuildContext context) {
|
Widget render(BuildContext context) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text("TAG_LongArray (${getKey()})"),
|
title: Text("TAG_LongArray (${getKey()})"),
|
||||||
subtitle: TagExt.getElementDescriptor("${value.length} entries", true,
|
subtitle: TagExt.getElementDescriptor("${value.length} entries"),
|
||||||
false, canBeNamed(this), this, context),
|
|
||||||
leading: const Image(image: AssetImage("Icons/PNG/LongArray.png")),
|
leading: const Image(image: AssetImage("Icons/PNG/LongArray.png")),
|
||||||
|
trailing: TagExt.getElementButtons(
|
||||||
|
true, canBeNamed(this), false, this, context),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,10 @@ extension LongTagExt on LongTag {
|
||||||
Widget render(BuildContext context) {
|
Widget render(BuildContext context) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text("TAG_Long (${getKey()})"),
|
title: Text("TAG_Long (${getKey()})"),
|
||||||
subtitle: TagExt.getElementDescriptor(
|
subtitle: TagExt.getElementDescriptor("$value"),
|
||||||
"$value", false, true, canBeNamed(this), this, context),
|
|
||||||
leading: const Image(image: AssetImage("Icons/PNG/Long.png")),
|
leading: const Image(image: AssetImage("Icons/PNG/Long.png")),
|
||||||
|
trailing: TagExt.getElementButtons(
|
||||||
|
false, canBeNamed(this), true, this, context),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,10 @@ extension ShortTagExt on ShortTag {
|
||||||
Widget render(BuildContext context) {
|
Widget render(BuildContext context) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text("TAG_Short (${getKey()})"),
|
title: Text("TAG_Short (${getKey()})"),
|
||||||
subtitle: TagExt.getElementDescriptor(
|
subtitle: TagExt.getElementDescriptor("$value"),
|
||||||
"$value", false, true, canBeNamed(this), this, context),
|
|
||||||
leading: const Image(image: AssetImage("Icons/PNG/Short.png")),
|
leading: const Image(image: AssetImage("Icons/PNG/Short.png")),
|
||||||
|
trailing: TagExt.getElementButtons(
|
||||||
|
false, canBeNamed(this), true, this, context),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,10 @@ extension StringTagExt on StringTag {
|
||||||
Widget render(BuildContext context) {
|
Widget render(BuildContext context) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text("TAG_String (${getKey()})"),
|
title: Text("TAG_String (${getKey()})"),
|
||||||
subtitle: TagExt.getElementDescriptor(
|
subtitle: TagExt.getElementDescriptor(value),
|
||||||
value, false, true, canBeNamed(this), this, context),
|
|
||||||
leading: const Image(image: AssetImage("Icons/PNG/String.png")),
|
leading: const Image(image: AssetImage("Icons/PNG/String.png")),
|
||||||
|
trailing: TagExt.getElementButtons(
|
||||||
|
false, canBeNamed(this), true, this, context),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,16 +144,13 @@ class TagExt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Widget getElementDescriptor(String descript, bool canAddElements,
|
static Widget getElementButtons(bool canAddElements, bool isNamed,
|
||||||
bool editableValue, bool isNamed, Tag tag, BuildContext ctx) {
|
bool editableValue, Tag tag, BuildContext ctx) {
|
||||||
return Row(
|
return Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Text(descript),
|
|
||||||
const SizedBox(
|
|
||||||
width: 100,
|
|
||||||
),
|
|
||||||
if (canAddElements)
|
if (canAddElements)
|
||||||
ElevatedButton(
|
IconButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
bool allowAllTagTypes = true;
|
bool allowAllTagTypes = true;
|
||||||
bool isArray = false;
|
bool isArray = false;
|
||||||
|
@ -193,9 +190,9 @@ class TagExt {
|
||||||
isArray: isArray,
|
isArray: isArray,
|
||||||
allowedTagTypes: allowedTypes));
|
allowedTagTypes: allowedTypes));
|
||||||
},
|
},
|
||||||
child: const Icon(Icons.add)),
|
icon: Icon(Icons.add)),
|
||||||
if (isNamed)
|
if (isNamed)
|
||||||
ElevatedButton(
|
IconButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
var response = await showDialog(
|
var response = await showDialog(
|
||||||
context: ctx,
|
context: ctx,
|
||||||
|
@ -211,12 +208,16 @@ class TagExt {
|
||||||
state.update();
|
state.update();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: const Text("R E N A M E")),
|
icon: Icon(Icons.drive_file_rename_outline)),
|
||||||
if (editableValue)
|
if (editableValue)
|
||||||
ElevatedButton(onPressed: () {}, child: const Text("E D I T"))
|
IconButton(onPressed: () {}, icon: Icon(Icons.edit_document))
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Widget getElementDescriptor(String descript) {
|
||||||
|
return Text(descript);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool canBeNamed(Tag tag) {
|
bool canBeNamed(Tag tag) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue