ElectricalNodeWidget class Presentation Field-UX Diagram
Widget reactivo que renderiza un ElectricalNode con feedback visual basado en validaciones REBT 2002 / IEC-60898 / IEC-60909.
Estados de Validación:
- 🟢 ValidationStatus.ok: Cumple normativa (borde verde)
- 🟡 ValidationStatus.warning: Alerta no-crÃtica (borde naranja)
- 🔴 ValidationStatus.error: Incumplimiento normativo (borde rojo + pulso)
- ⚪ ValidationStatus.pending: Sin calcular (borde gris)
Interacciones:
- Tap: Selecciona nodo para edición/configuración
- Long Press: Abre menú contextual (eliminar, duplicar, etc.)
- Hover durante drag: Feedback magnético (HapticFeedback.lightImpact) que indica que el nodo puede recibir un hijo
Animaciones Field-UX:
- Pulso en error: Animación de escala 1.0 → 1.15 cada 1.2s para visibilidad inmediata de errores crÃticos sin necesidad de mirar de cerca
- Scale en hover: Crecimiento 1.0 → 1.15 durante drag-over para affordance visual de drop target
- Glow effect: Sombra azul (#135BEC) en hover para "imán magnético"
Arquitectura:
- Domain: ElectricalNode (entity pura sin UI logic)
- Presentation: Este widget (reactive rendering)
- Validación: ElectricalCalculator en domain layer
Uso:
ElectricalNodeWidget(
node: myProtectionNode,
isSelected: selectedId == myProtectionNode.id,
onTap: () => cubit.selectNode(myProtectionNode.id),
onLongPress: () => _showContextMenu(),
onNodeDropped: (childType) => cubit.addChild(childType),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ElectricalNodeWidget
Constructors
- ElectricalNodeWidget({Key? key, required ElectricalNode node, required bool isSelected, required VoidCallback onTap, VoidCallback? onLongPress, dynamic onNodeDropped(NodeType)?})
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isSelected → bool
-
Si
true, renderiza con borde de selección (DiagramTheme.accentColor).final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- node → ElectricalNode
-
Nodo eléctrico a renderizar (SourceNode, PanelNode, ProtectionNode, LoadNode).
final
- onLongPress → VoidCallback?
-
Callback opcional al hacer long press (usualmente menú contextual).
final
- onNodeDropped → dynamic Function(NodeType)?
-
Callback cuando se suelta un NodeType sobre este nodo durante drag & drop.
final
- onTap → VoidCallback
-
Callback al hacer tap (usualmente para selección).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< ElectricalNodeWidget> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited