func (node *Node) RemoveChild(child *Node) {
	if node.deleteChild(child) != nil {
		child.Layout = nodeDefaults.Layout  
		child.Parent = nil
		nodeMarkDirtyInternal(node)
	}
}
RemoveChild removes child node
package flex
import (
	"fmt"
	"os"
)
type CachedMeasurement struct {
	availableWidth    float32
	availableHeight   float32
	widthMeasureMode  MeasureMode
	heightMeasureMode MeasureMode
	computedWidth  float32
	computedHeight float32
}
const maxCachedResultCount = 16
type Layout struct {
	Position   [4]float32
	Dimensions [2]float32
	Margin     [6]float32
	Border     [6]float32
	Padding    [6]float32
	Direction  Direction
	computedFlexBasisGeneration int
	computedFlexBasis           float32
	HadOverflow                 bool
	generationCount     int
	lastParentDirection Direction
	nextCachedMeasurementsIndex int
	cachedMeasurements          [maxCachedResultCount]CachedMeasurement
	measuredDimensions [2]float32
	cachedLayout CachedMeasurement
}
type Style struct {
	Direction      Direction
	FlexDirection  FlexDirection
	JustifyContent Justify
	AlignContent   Align
	AlignItems     Align
	AlignSelf      Align
	PositionType   PositionType
	FlexWrap       Wrap
	Overflow       Overflow
	Display        Display
	Flex           float32
	FlexGrow       float32
	FlexShrink     float32
	FlexBasis      Value
	Margin         [EdgeCount]Value
	Position       [EdgeCount]Value
	Padding        [EdgeCount]Value
	Border         [EdgeCount]Value
	Dimensions     [2]Value
	MinDimensions  [2]Value
	MaxDimensions  [2]Value
	AspectRatio float32
}
type Config struct {
	experimentalFeatures      [experimentalFeatureCount + 1]bool
	UseWebDefaults            bool
	UseLegacyStretchBehaviour bool
	PointScaleFactor          float32
	Logger                    Logger
	Context                   interface{}
}
type Node struct {
	Style     Style
	Layout    Layout
	lineIndex int
	Parent   *Node
	Children []*Node
	NextChild *Node
	Measure  MeasureFunc
	Baseline BaselineFunc
	Print    PrintFunc
	Config   *Config
	Context  interface{}
	IsDirty      bool
	hasNewLayout bool
	NodeType     NodeType
	resolvedDimensions [2]*Value
}
var (
	undefinedValue = Value{
		Value: Undefined,
		Unit:  UnitUndefined,
	}
	autoValue = Value{
		Value: Undefined,
		Unit:  UnitAuto,
	}
	defaultEdgeValuesUnit = [EdgeCount]Value{
		undefinedValue,
		undefinedValue,
		undefinedValue,
		undefinedValue,
		undefinedValue,
		undefinedValue,
		undefinedValue,
		undefinedValue,
		undefinedValue,
	}
	defaultDimensionValues = [2]float32{
		Undefined,
		Undefined,
	}
	defaultDimensionValuesUnit = [2]Value{
		undefinedValue,
		undefinedValue,
	}
	defaultDimensionValuesAutoUnit = [2]Value{
		autoValue,
		autoValue,
	}
)
const (
	defaultFlexGrow      float32 = 0
	defaultFlexShrink    float32 = 0
	webDefaultFlexShrink float32 = 1
)
var (
	nodeDefaults = Node{
		Parent:             nil,
		Children:           nil,
		hasNewLayout:       true,
		IsDirty:            false,
		NodeType:           NodeTypeDefault,
		resolvedDimensions: [2]*Value{&ValueUndefined, &ValueUndefined},
		Style: Style{
			Flex:           Undefined,
			FlexGrow:       Undefined,
			FlexShrink:     Undefined,
			FlexBasis:      autoValue,
			JustifyContent: JustifyFlexStart,
			AlignItems:     AlignStretch,
			AlignContent:   AlignFlexStart,
			Direction:      DirectionInherit,
			FlexDirection:  FlexDirectionColumn,
			Overflow:       OverflowVisible,
			Display:        DisplayFlex,
			Dimensions:     defaultDimensionValuesAutoUnit,
			MinDimensions:  defaultDimensionValuesUnit,
			MaxDimensions:  defaultDimensionValuesUnit,
			Position:       defaultEdgeValuesUnit,
			Margin:         defaultEdgeValuesUnit,
			Padding:        defaultEdgeValuesUnit,
			Border:         defaultEdgeValuesUnit,
			AspectRatio:    Undefined,
		},
		Layout: Layout{
			Dimensions:                  defaultDimensionValues,
			lastParentDirection:         Direction(-1),
			nextCachedMeasurementsIndex: 0,
			computedFlexBasis:           Undefined,
			HadOverflow:                 false,
			measuredDimensions:          defaultDimensionValues,
			cachedLayout: CachedMeasurement{
				widthMeasureMode:  MeasureMode(-1),
				heightMeasureMode: MeasureMode(-1),
				computedWidth:     -1,
				computedHeight:    -1,
			},
		},
	}
	configDefaults = Config{
		experimentalFeatures: [experimentalFeatureCount + 1]bool{
			false,
			false,
		},
		UseWebDefaults:   false,
		PointScaleFactor: 1,
		Logger:           DefaultLog,
		Context:          nil,
	}
	ValueZero = Value{Value: 0, Unit: UnitPoint}
)
func valueEq(v1, v2 Value) bool {
	if v1.Unit != v2.Unit {
		return false
	}
	return feq(v1.Value, v2.Value)
}
func DefaultLog(config *Config, node *Node, level LogLevel, format string,
	args ...interface{}) int {
	switch level {
	case LogLevelError, LogLevelFatal:
		n, _ := fmt.Fprintf(os.Stderr, format, args...)
		return n
	case LogLevelWarn, LogLevelInfo, LogLevelDebug, LogLevelVerbose:
		fallthrough
	default:
		n, _ := fmt.Printf(format, args...)
		return n
	}
}
func computedEdgeValue(edges []Value, edge Edge, defaultValue *Value) *Value {
	if edges[edge].Unit != UnitUndefined {
		return &edges[edge]
	}
	isVertEdge := edge == EdgeTop || edge == EdgeBottom
	if isVertEdge && edges[EdgeVertical].Unit != UnitUndefined {
		return &edges[EdgeVertical]
	}
	isHorizEdge := (edge == EdgeLeft || edge == EdgeRight || edge == EdgeStart || edge == EdgeEnd)
	if isHorizEdge && edges[EdgeHorizontal].Unit != UnitUndefined {
		return &edges[EdgeHorizontal]
	}
	if edges[EdgeAll].Unit != UnitUndefined {
		return &edges[EdgeAll]
	}
	if edge == EdgeStart || edge == EdgeEnd {
		return &ValueUndefined
	}
	return defaultValue
}
func resolveValue(value *Value, parentSize float32) float32 {
	switch value.Unit {
	case UnitUndefined, UnitAuto:
		return Undefined
	case UnitPoint:
		return value.Value
	case UnitPercent:
		return value.Value * parentSize / 100
	}
	return Undefined
}
func resolveValueMargin(value *Value, parentSize float32) float32 {
	if value.Unit == UnitAuto {
		return 0
	}
	return resolveValue(value, parentSize)
}
func NewNodeWithConfig(config *Config) *Node {
	node := nodeDefaults
	if config.UseWebDefaults {
		node.Style.FlexDirection = FlexDirectionRow
		node.Style.AlignContent = AlignStretch
	}
	node.Config = config
	return &node
}
func NewNode() *Node {
	return NewNodeWithConfig(&configDefaults)
}
func (node *Node) Reset() {
	assertWithNode(node, len(node.Children) == 0, "Cannot reset a node which still has children attached")
	assertWithNode(node, node.Parent == nil, "Cannot reset a node still attached to a parent")
	node.Children = nil
	config := node.Config
	*node = nodeDefaults
	if config.UseWebDefaults {
		node.Style.FlexDirection = FlexDirectionRow
		node.Style.AlignContent = AlignStretch
	}
	node.Config = config
}
func ConfigGetDefault() *Config {
	return &configDefaults
}
func NewConfig() *Config {
	config := &Config{}
	assertCond(config != nil, "Could not allocate memory for config")
	*config = configDefaults
	return config
}
func ConfigCopy(dest *Config, src *Config) {
	*dest = *src
}
func nodeMarkDirtyInternal(node *Node) {
	if !node.IsDirty {
		node.IsDirty = true
		node.Layout.computedFlexBasis = Undefined
		if node.Parent != nil {
			nodeMarkDirtyInternal(node.Parent)
		}
	}
}
func (node *Node) SetMeasureFunc(measureFunc MeasureFunc) {
	if measureFunc == nil {
		node.Measure = nil
		node.NodeType = NodeTypeDefault
	} else {
		assertWithNode(
			node,
			len(node.Children) == 0,
			"Cannot set measure function: Nodes with measure functions cannot have children.")
		node.Measure = measureFunc
		node.NodeType = NodeTypeText
	}
}
func (node *Node) InsertChild(child *Node, idx int) {
	assertWithNode(node, child.Parent == nil, "Child already has a parent, it must be removed first.")
	assertWithNode(node, node.Measure == nil, "Cannot add child: Nodes with measure functions cannot have children.")
	a := node.Children
	a = append(a[:idx], append([]*Node{child}, a[idx:]...)...)
	node.Children = a
	child.Parent = node
	nodeMarkDirtyInternal(node)
}
func (node *Node) deleteChild(child *Node) *Node {
	a := node.Children
	n := len(a)
	for i := 0; i < n; i++ {
		if a[i] == child {
			removed := a[i]
			copy(a[i:], a[i+1:])
			a[len(a)-1] = nil  
			a = a[:len(a)-1]
			node.Children = a
			return removed
		}
	}
	return nil
}