This commit is contained in:
mr
2025-06-13 13:33:24 +02:00
parent c4ea1541c4
commit ab593a45b9
26 changed files with 219 additions and 221 deletions

View File

@@ -4,7 +4,6 @@ import 'package:oc_front/models/resources/resources.dart';
import 'package:oc_front/models/response.dart';
import 'package:oc_front/pages/shared.dart';
import 'package:oc_front/widgets/inputs/shallow_dropdown_input.dart';
import 'package:oc_front/widgets/inputs/sub_dropdown_input%20.dart';
// ignore: must_be_immutable
class ItemWidget extends StatefulWidget {
@@ -15,25 +14,26 @@ class ItemWidget extends StatefulWidget {
class ItemWidgetState extends State<ItemWidget> {
@override Widget build(BuildContext context) {
List<Widget> widgets = [
Container( margin: EdgeInsets.only(bottom: 20),
Container( margin: const EdgeInsets.only(bottom: 20),
decoration: BoxDecoration(border: Border(bottom: BorderSide(color: midColor))),
width: getMainWidth(context) / 2,
child: Center(child: Padding( padding: EdgeInsets.only(bottom: 20),
child: const Center(child: Padding( padding: EdgeInsets.only(bottom: 20),
child: Text("RESOURCE INFORMATIONS", style: TextStyle(fontSize: 18, color: Colors.grey, fontWeight: FontWeight.w500)))))
];
var infos = widget.item.infos();
var count = 0;
for (var info in infos.keys) {
count++;
widgets.add(Padding( padding: EdgeInsets.symmetric(vertical: 5), child : Row(children: [
Padding( padding: EdgeInsets.only(left: 50, right: 10), child : Text("${info.toUpperCase().replaceAll("_", " ")} :", style: TextStyle(fontSize: 15, color: Colors.grey))),
widgets.add(Padding( padding: const EdgeInsets.symmetric(vertical: 5), child : Row(children: [
Padding( padding: const EdgeInsets.only(left: 50, right: 10), child : Text("${info.toUpperCase().replaceAll("_", " ")} :",
style: const TextStyle(fontSize: 15, color: Colors.grey))),
Text("${infos[info] is bool ? (infos[info] == true ? "yes" : "no") : infos[info] ?? "unknown"}",
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 15, color: Colors.black, fontWeight: FontWeight.w500))
style: const TextStyle(fontSize: 15, color: Colors.black, fontWeight: FontWeight.w500))
])));
}
if (count == 0 ) {
widgets.add(Center(child: Padding( padding: EdgeInsets.symmetric(vertical: 5), child : Row(children: [
widgets.add(const Center(child: Padding( padding: EdgeInsets.symmetric(vertical: 5), child : Row(children: [
Padding( padding: EdgeInsets.only(left: 50, right: 10), child : Text("NO INFORMATION", style: TextStyle(fontSize: 15, color: Colors.grey))),
]))));
}
@@ -43,7 +43,7 @@ class ItemWidgetState extends State<ItemWidget> {
dpItems.add(Shallow(id: "$i", name: instance.name ?? ""));
}
if (dpItems.isNotEmpty) {
widgetsInstance.add(Center( child: Padding(padding: EdgeInsets.only(bottom: 15), child:
widgetsInstance.add(Center( child: Padding(padding: const EdgeInsets.only(bottom: 15), child:
ShallowDropdownInputWidget( all: () async => dpItems, width: (getWidth(context) / 2) - 25,
label: "instances", type: CollaborativeAreaType.resource, height: 65,
current: "${widget.item.selectedInstance}", change: (value) {
@@ -54,21 +54,27 @@ class ItemWidgetState extends State<ItemWidget> {
}
if (widget.item.instances.length > widget.item.selectedInstance) {
var instance = widget.item.instances[widget.item.selectedInstance];
widgetsInstance.add(Container(height: 20, width: getWidth(context) / 2,));
widgetsInstance.add(SizedBox(height: 20, width: getWidth(context) / 2,));
var count = 0;
for (var info in instance.infos().keys) {
if (instance.infos()[info] == null || instance.infos()[info] is List || instance.infos()[info] is Map) { continue; }
count++;
widgetsInstance.add(Center(child: Padding( padding: EdgeInsets.symmetric(vertical: 5), child : Row(children: [
Padding( padding: EdgeInsets.only(left: 50, right: 10), child : Text("${info.toUpperCase().replaceAll("_", " ")} :", style: TextStyle(fontSize: 15, color: Colors.grey))),
widgetsInstance.add(Center(child: Padding( padding: const EdgeInsets.symmetric(vertical: 5), child : Row(children: [
Padding( padding: const EdgeInsets.only(left: 50, right: 10),
child : Text("${info.toUpperCase().replaceAll("_", " ")} :",
style: const TextStyle(fontSize: 15, color: Colors.grey))),
Text("${instance.infos()[info] is bool ? (instance.infos()[info] == true ? "yes" : "no") : instance.infos()[info] ?? "unknown"}",
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 15, color: Colors.black, fontWeight: FontWeight.w500))
style: const TextStyle(fontSize: 15, color: Colors.black, fontWeight: FontWeight.w500))
]))));
}
if (count == 0 ) {
widgetsInstance.add(Padding( padding: EdgeInsets.symmetric(vertical: 5), child : Row(children: [
Padding( padding: EdgeInsets.only(left: 50, right: 10), child : Text("NO INSTANCE INFORMATION", style: TextStyle(fontSize: 15, color: Colors.grey))),
widgetsInstance.add(const Padding(
padding: EdgeInsets.symmetric(vertical: 5),
child : Row(children: [
Padding( padding: EdgeInsets.only(left: 50, right: 10),
child : Text("NO INSTANCE INFORMATION",
style: TextStyle(fontSize: 15, color: Colors.grey))),
])));
}
}
@@ -87,7 +93,7 @@ class ItemWidgetState extends State<ItemWidget> {
border: Border(bottom: BorderSide(color: midColor))),
padding: const EdgeInsets.symmetric(vertical: 30, horizontal: 50),
child: Text(widget.item.description!.length > 350 ? "${widget.item.description!.substring(0, 347)}..." : widget.item.description!,
style: TextStyle(fontSize: 15, color: Colors.grey, fontWeight: FontWeight.w500))),
style: const TextStyle(fontSize: 15, color: Colors.grey, fontWeight: FontWeight.w500))),
Row( children: [
Container(padding: const EdgeInsets.symmetric(vertical: 20),
height: getHeight(context) - 300,

View File

@@ -1,5 +1,3 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_flow_chart/flutter_flow_chart.dart';
import 'package:oc_front/main.dart';
@@ -43,7 +41,7 @@ class ShallowItemRowWidgetState extends State<ShallowItemRowWidget> {
child: Row( children: [
Padding( padding: const EdgeInsets.only(right: 5),
child: widget.edit == null ? Container() : InkWell( mouseCursor: SystemMouseCursors.click,
onTap: () => widget.edit!(widget.item.getID() + "~" + widget.item.getName()), child: const Icon(Icons.edit, color: Colors.grey,))),
onTap: () => widget.edit!( "${widget.item.getID()}~${widget.item.getName()}"), child: const Icon(Icons.edit, color: Colors.grey,))),
Padding( padding: const EdgeInsets.only(right: 5),
child: widget.delete == null ? Container() : InkWell( mouseCursor: SystemMouseCursors.click,
onTap: () => widget.delete!(widget.item.getID()), child: const Icon(Icons.delete, color: Colors.grey,))),
@@ -52,21 +50,19 @@ class ShallowItemRowWidgetState extends State<ShallowItemRowWidget> {
Column( children: [
widget.low || widget.icon == null ? Container( padding: const EdgeInsets.only(left: 10),) : Container( padding: const EdgeInsets.all(10),
constraints: BoxConstraints(maxWidth: widget.contextWidth, minWidth: widget.contextWidth),
child: Icon( widget.icon!, size: widget.contextWidth / 1.9, color: const Color(0xFFF67C0B9),)),
Container(
child: Padding(padding: widget.contextWidth != getMainWidth(context) ?
const EdgeInsets.symmetric(horizontal: 10) : const EdgeInsets.symmetric(horizontal: 20),
child: Column(crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, children: [
Row( children: [
Expanded( child: Center( child: Text(widget.item.getName().toUpperCase(),
style: const TextStyle(fontSize: 15,
overflow: TextOverflow.ellipsis,
fontWeight: FontWeight.w600, color: Colors.grey)),
))
]),
],)
)
child: Icon( widget.icon!, size: widget.contextWidth / 1.9, color: const Color(0xfff67c0b9),)),
Padding(padding: widget.contextWidth != getMainWidth(context) ?
const EdgeInsets.symmetric(horizontal: 10) : const EdgeInsets.symmetric(horizontal: 20),
child: Column(crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, children: [
Row( children: [
Expanded( child: Center( child: Text(widget.item.getName().toUpperCase(),
style: const TextStyle(fontSize: 15,
overflow: TextOverflow.ellipsis,
fontWeight: FontWeight.w600, color: Colors.grey)),
))
]),
],)
),
])
]))));
@@ -76,6 +72,7 @@ class ShallowItemRowWidgetState extends State<ShallowItemRowWidget> {
}
}
// ignore: must_be_immutable
class ShallowItemFlowDataRowWidget extends StatefulWidget {
bool readOnly = false;
double contextWidth = 0;
@@ -114,7 +111,7 @@ class ShallowItemFlowDataRowWidgetState extends State<ShallowItemFlowDataRowWidg
child: Row( children: [
Padding( padding: const EdgeInsets.only(right: 5),
child: widget.edit == null ? Container() : InkWell( mouseCursor: SystemMouseCursors.click,
onTap: () => widget.edit!(widget.item.getID() + "~" + widget.item.getName()), child: const Icon(Icons.edit, color: Colors.grey,))),
onTap: () => widget.edit!("${widget.item.getID()}~${widget.item.getName()}"), child: const Icon(Icons.edit, color: Colors.grey,))),
Padding( padding: const EdgeInsets.only(right: 5),
child: widget.delete == null ? Container() : InkWell( mouseCursor: SystemMouseCursors.click,
onTap: () => widget.delete!(widget.item.getID()), child: const Icon(Icons.delete, color: Colors.grey,))),
@@ -126,21 +123,19 @@ class ShallowItemFlowDataRowWidgetState extends State<ShallowItemFlowDataRowWidg
Column( children: [
widget.low || widget.icon == null ? Container( padding: const EdgeInsets.only(left: 10),) : Container( padding: const EdgeInsets.all(10),
constraints: BoxConstraints(maxWidth: widget.contextWidth, minWidth: widget.contextWidth),
child: Icon( widget.icon!, size: widget.contextWidth / 1.9, color: const Color(0xFFF67C0B9),)),
Container(
child: Padding(padding: widget.contextWidth != getMainWidth(context) ?
const EdgeInsets.symmetric(horizontal: 10) : const EdgeInsets.symmetric(horizontal: 20),
child: Column(crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, children: [
Row( children: [
Expanded( child: Center( child: Text(widget.item.getName().toUpperCase(),
style: const TextStyle(fontSize: 15,
overflow: TextOverflow.ellipsis,
fontWeight: FontWeight.w600, color: Colors.grey)),
))
]),
],)
)
child: Icon( widget.icon!, size: widget.contextWidth / 1.9, color: const Color(0xfff67c0b9),)),
Padding(padding: widget.contextWidth != getMainWidth(context) ?
const EdgeInsets.symmetric(horizontal: 10) : const EdgeInsets.symmetric(horizontal: 20),
child: Column(crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, children: [
Row( children: [
Expanded( child: Center( child: Text(widget.item.getName().toUpperCase(),
style: const TextStyle(fontSize: 15,
overflow: TextOverflow.ellipsis,
fontWeight: FontWeight.w600, color: Colors.grey)),
))
]),
],)
),
])
]))));