Complete reference documentation for all GoFlow widgets.
Displays children vertically in a column.
File: pkg/core/widgets/column.go
Properties:
Children []goflow.Widget- Child widgets to displayMainAxisAlign MainAxisAlignment- Vertical alignment (default: MainAxisStart)CrossAxisAlign CrossAxisAlignment- Horizontal alignment (default: CrossAxisCenter)MainAxisSize MainAxisSize- How much vertical space to occupy (default: MainAxisSizeMax)
MainAxisAlignment Values:
MainAxisStart- Children at the topMainAxisEnd- Children at the bottomMainAxisCenter- Children centered verticallyMainAxisSpaceBetween- Space distributed between childrenMainAxisSpaceAround- Space around each childMainAxisSpaceEvenly- Even spacing including edges
CrossAxisAlignment Values:
CrossAxisStart- Children aligned to the leftCrossAxisEnd- Children aligned to the rightCrossAxisCenter- Children centered horizontallyCrossAxisStretch- Children stretched to full width
Example:
&widgets.Column{
Children: []goflow.Widget{
widgets.NewText("Item 1"),
widgets.NewText("Item 2"),
widgets.NewText("Item 3"),
},
MainAxisAlign: widgets.MainAxisCenter,
CrossAxisAlign: widgets.CrossAxisStart,
}Displays children horizontally in a row.
File: pkg/core/widgets/row.go
Properties:
Children []goflow.Widget- Child widgets to displayMainAxisAlignment MainAxisAlignment- Horizontal alignment (default: MainAxisStart)CrossAxisAlignment CrossAxisAlignment- Vertical alignment (default: CrossAxisCenter)MainAxisSize MainAxisSize- How much horizontal space to occupy (default: MainAxisSizeMax)
Alignment values same as Column
Example:
&widgets.Row{
Children: []goflow.Widget{
widgets.NewIcon(widgets.IconHome),
widgets.NewText("Home"),
},
MainAxisAlignment: widgets.MainAxisStart,
CrossAxisAlignment: widgets.CrossAxisCenter,
}Overlays children on top of each other (z-axis stacking).
File: pkg/core/widgets/stack.go
Properties:
Children []goflow.Widget- Children to stack (later children appear on top)Alignment StackAlignment- How non-positioned children align (default: StackAlignmentTopLeft)Fit StackFit- How non-positioned children are sized (default: StackFitLoose)
StackAlignment Values:
StackAlignmentTopLeft,StackAlignmentTopCenter,StackAlignmentTopRightStackAlignmentCenterLeft,StackAlignmentCenter,StackAlignmentCenterRightStackAlignmentBottomLeft,StackAlignmentBottomCenter,StackAlignmentBottomRight
StackFit Values:
StackFitLoose- Children sized to their natural sizeStackFitExpand- Children expanded to fill the stackStackFitPassthrough- Pass parent constraints to children
Example:
widgets.NewStack([]goflow.Widget{
// Background
&widgets.ColoredBox{
Color: goflow.ColorBlue,
},
// Foreground
widgets.NewCenter(
widgets.NewText("Overlaid Text"),
),
})Positions a child within a Stack at absolute coordinates.
File: pkg/core/widgets/stack.go
Properties:
Child goflow.Widget- The child to positionLeft *float64- Distance from left edge (nil = not constrained)Top *float64- Distance from top edgeRight *float64- Distance from right edgeBottom *float64- Distance from bottom edgeWidth *float64- Explicit widthHeight *float64- Explicit height
Example:
widgets.NewStack([]goflow.Widget{
widgets.NewPositioned(
widgets.NewText("Top Right"),
).Top(10).Right(10),
})Aligns a child within itself using precise coordinates.
File: pkg/core/widgets/align.go
Properties:
Child goflow.Widget- The child to alignAlignment AlignmentValue- Alignment coordinates (X: -1.0 to 1.0, Y: -1.0 to 1.0)WidthFactor *float64- If set, width = child.width * widthFactorHeightFactor *float64- If set, height = child.height * heightFactor
Predefined Alignments:
AlignmentTopLeft,AlignmentTopCenter,AlignmentTopRightAlignmentCenterLeft,AlignmentCenter,AlignmentCenterRightAlignmentBottomLeft,AlignmentBottomCenter,AlignmentBottomRight
Example:
widgets.NewAlign(
widgets.AlignmentBottomRight,
widgets.NewText("Bottom Right Corner"),
)Centers its child both horizontally and vertically.
File: pkg/core/widgets/center.go
Properties:
Child goflow.Widget- The child to center
Example:
widgets.NewCenter(
widgets.NewText("Centered Text"),
)Allow children in Row/Column to expand and fill available space.
File: pkg/core/widgets/flexible.go
Flexible Properties:
Child goflow.Widget- The child widgetFlex int- Flex factor (how much space relative to siblings, default: 1)Fit FlexFit- How to fit (FlexFitLoose or FlexFitTight)
Expanded: Shorthand for Flexible with FlexFitTight (child must fill space).
Example:
&widgets.Row{
Children: []goflow.Widget{
widgets.NewText("Fixed"),
&widgets.Expanded{
Child: widgets.NewText("Fills remaining space"),
},
widgets.NewText("Fixed"),
},
}Creates flexible empty space in Row/Column.
File: pkg/core/widgets/flexible.go
Properties:
Flex int- Flex factor (default: 1)
Example:
&widgets.Row{
Children: []goflow.Widget{
widgets.NewText("Left"),
widgets.NewSpacer(), // Pushes items apart
widgets.NewText("Right"),
},
}Convenience widget combining padding, color, and sizing.
File: pkg/core/widgets/container.go
Properties:
Child goflow.Widget- The child widgetWidth *float64- Explicit widthHeight *float64- Explicit heightColor *goflow.Color- Background colorPadding *goflow.EdgeInsets- Inner paddingMargin *goflow.EdgeInsets- Outer margin (not yet implemented in render)
Example:
&widgets.Container{
Width: float64Ptr(200),
Height: float64Ptr(100),
Color: goflow.ColorBlue,
Padding: goflow.NewEdgeInsetsAll(16),
Child: widgets.NewText("Padded Box"),
}Adds padding around a child.
File: pkg/core/widgets/container.go
Properties:
Padding *goflow.EdgeInsets- Padding amountChild goflow.Widget- The child widget
EdgeInsets Constructors:
NewEdgeInsetsAll(value float64)- Same padding on all sidesNewEdgeInsetsSymmetric(horizontal, vertical float64)NewEdgeInsets(left, top, right, bottom float64)
Example:
widgets.NewPadding(
goflow.NewEdgeInsetsAll(20),
widgets.NewText("Padded Text"),
)Constrains child to a specific size.
File: pkg/core/widgets/container.go
Properties:
Width *float64- Explicit widthHeight *float64- Explicit heightChild goflow.Widget- The child widget
Example:
&widgets.SizedBox{
Width: float64Ptr(100),
Height: float64Ptr(50),
Child: widgets.NewText("Fixed Size"),
}Paints a colored background behind its child.
File: pkg/core/widgets/container.go
Properties:
Color *goflow.Color- Background colorChild goflow.Widget- The child widget
Example:
&widgets.ColoredBox{
Color: goflow.NewColor(255, 200, 200, 255),
Child: widgets.NewText("Pink Background"),
}Displays a string of text with styling.
File: pkg/core/widgets/text.go
Properties:
Data string- The text to displayStyle *goflow.TextStyle- Text styling
TextStyle Properties:
FontSize float64- Font size (default: 14)Color *goflow.Color- Text color (default: black)FontWeight FontWeight- Font weight (Normal, Bold)
Example:
widgets.NewTextWithStyle(
"Hello World",
&goflow.TextStyle{
FontSize: 24,
Color: goflow.ColorBlue,
FontWeight: goflow.FontWeightBold,
},
)Displays an icon from Material Icons.
File: pkg/core/widgets/icon.go
Properties:
Icon IconData- The icon to displaySize float64- Icon size (default: 24)Color *goflow.Color- Icon colorSemanticLabel string- Accessibility label
Predefined Icons:
IconHome,IconMenu,IconSearch,IconSettingsIconFavorite,IconAdd,IconRemove,IconCloseIconCheck,IconArrowBack,IconArrowForwardIconEdit,IconDelete,IconShareIconPerson,IconEmail,IconPhoneIconInfo,IconWarning,IconError
Example:
icon := widgets.NewIcon(widgets.IconHome)
icon.Size = 32
icon.Color = goflow.ColorBlueA clickable button with an icon.
File: pkg/core/widgets/icon.go
Properties:
Icon IconData- The icon to displayOnPressed func()- Callback when pressedIconSize float64- Icon size (default: 24)Color *goflow.Color- Icon colorTooltip string- Tooltip textPadding *goflow.EdgeInsets- Padding (default: 8px all sides)
Example:
widgets.NewIconButton(
widgets.IconAdd,
func() {
fmt.Println("Add clicked!")
},
)Displays an image.
File: pkg/core/widgets/image.go
Properties:
Source ImageSource- Image source (AssetImage, NetworkImage, FileImage)Fit ImageFit- How to inscribe the image (default: ImageFitContain)Width *float64- Explicit widthHeight *float64- Explicit heightSemanticLabel string- Accessibility label
ImageFit Values:
ImageFitFill- Fill box, may distort aspect ratioImageFitContain- Fit within box, preserve aspect ratioImageFitCover- Cover box, preserve aspect ratioImageFitFitWidth,ImageFitFitHeight- Fit one dimensionImageFitNone- No scalingImageFitScaleDown- Align within box, scale down if needed
Example:
widgets.NewImage(&widgets.AssetImage{
Path: "assets/logo.png",
})A scrollable list of widgets.
File: pkg/core/widgets/listview.go
Properties:
Children []goflow.Widget- List itemsScrollDirection Axis- Scroll direction (default: AxisVertical)Padding *goflow.EdgeInsets- Padding around itemsShrinkWrap bool- Size to content (default: false)Physics ScrollPhysics- Scroll behavior
Example:
widgets.NewListView([]goflow.Widget{
widgets.NewText("Item 1"),
widgets.NewText("Item 2"),
widgets.NewText("Item 3"),
})Creates a ListView with a builder function.
File: pkg/core/widgets/listview.go
Properties:
ItemCount int- Number of itemsItemBuilder func(BuildContext, int) Widget- Function to build each itemScrollDirection Axis- Scroll directionPadding *goflow.EdgeInsets- Padding
Example:
widgets.NewListViewBuilder(
10,
func(ctx goflow.BuildContext, index int) goflow.Widget {
return widgets.NewText(fmt.Sprintf("Item %d", index))
},
)Makes a single child scrollable.
File: pkg/core/widgets/listview.go
Properties:
Child goflow.Widget- The child to make scrollableScrollDirection Axis- Scroll direction (default: AxisVertical)Padding *goflow.EdgeInsets- PaddingPhysics ScrollPhysics- Scroll behavior
Example:
widgets.NewSingleChildScrollView(
&widgets.Column{
Children: []goflow.Widget{
// Many children...
},
},
)A scrollable 2D grid of widgets.
File: pkg/core/widgets/listview.go
Properties:
Children []goflow.Widget- Grid itemsCrossAxisCount int- Number of columnsChildAspectRatio float64- Aspect ratio of each child (default: 1.0)MainAxisSpacing float64- Vertical spacing (default: 0)CrossAxisSpacing float64- Horizontal spacing (default: 0)Padding *goflow.EdgeInsets- Padding
Example:
widgets.NewGridView(
[]goflow.Widget{
widgets.NewText("1"),
widgets.NewText("2"),
widgets.NewText("3"),
widgets.NewText("4"),
},
2, // 2 columns
)Detects gestures on its child.
File: pkg/core/widgets/gesture.go
Properties:
Child goflow.Widget- The child widgetOnTap func()- Called on tapOnDoubleTap func()- Called on double tapOnLongPress func()- Called on long pressOnPanStart, OnPanUpdate, OnPanEnd- Drag/pan callbacksOnScaleStart, OnScaleUpdate, OnScaleEnd- Scale/pinch callbacksBehavior HitTestBehavior- Hit test behavior
Example:
widgets.NewGestureDetector(
widgets.NewText("Tap Me"),
).OnTap = func() {
fmt.Println("Tapped!")
}Material Design ink splash effect with gestures.
File: pkg/core/widgets/gesture.go
Properties:
Child goflow.Widget- The child widgetOnTap func()- Tap callbackOnDoubleTap func()- Double tap callbackOnLongPress func()- Long press callbackSplashColor *goflow.Color- Splash effect colorHighlightColor *goflow.Color- Highlight color when pressedBorderRadius float64- Border radius for splash (default: 0)
Example:
widgets.NewInkWell(
widgets.NewText("Click Me"),
func() {
fmt.Println("InkWell tapped!")
},
)Enable drag-and-drop interactions.
File: pkg/core/widgets/gesture.go
Draggable Properties:
Child goflow.Widget- Widget shown when not draggingFeedback goflow.Widget- Widget shown while draggingChildWhenDragging goflow.Widget- Widget shown in place when draggingData interface{}- Data to pass to DragTargetOnDragStarted, OnDragEnd, OnDragCompleted, OnDraggableCanceled- CallbacksAxis *Axis- Lock dragging to one axisMaxSimultaneousDrags *int- Maximum simultaneous drags
DragTarget Properties:
Builder func(BuildContext, []interface{}, []interface{}) Widget- Builds targetOnWillAccept func(interface{}) bool- Determine if data is acceptableOnAccept func(interface{})- Called when drag is acceptedOnLeave func(interface{})- Called when drag leaves
Example:
// Draggable
widgets.NewDraggable(
widgets.NewText("Drag me"),
"my-data",
)
// DragTarget
widgets.NewDragTarget(
func(ctx goflow.BuildContext, candidates, rejected []interface{}) goflow.Widget {
if len(candidates) > 0 {
return widgets.NewText("Drop here!")
}
return widgets.NewText("Drag here")
},
)| Feature | Status | Notes |
|---|---|---|
| Column | ✅ Complete | All alignment modes working |
| Row | ✅ Complete | All alignment modes working |
| Stack | ✅ Complete | All alignment modes working |
| Positioned | Exists but needs Stack integration | |
| Flexible/Expanded | Defined but not used by Row/Column yet | |
| MainAxis Alignment | ✅ Complete | 6 modes fully implemented |
| CrossAxis Alignment | ✅ Complete | 4 modes fully implemented |
| Intrinsic Dimensions | ❌ Not Implemented | Future feature |
| Baseline Alignment | ❌ Not Implemented | Future feature |
&widgets.Row{
Children: []goflow.Widget{
&widgets.Expanded{
Flex: 2,
Child: widgets.NewText("Takes 2/3"),
},
&widgets.Expanded{
Flex: 1,
Child: widgets.NewText("Takes 1/3"),
},
},
}&widgets.Container{
Color: goflow.ColorWhite,
Padding: goflow.NewEdgeInsetsAll(16),
Child: &widgets.Column{
Children: []goflow.Widget{
widgets.NewTextWithStyle("Title", titleStyle),
spacer(8),
widgets.NewText("Content goes here"),
},
MainAxisAlign: widgets.MainAxisStart,
CrossAxisAlign: widgets.CrossAxisStart,
},
}&widgets.InkWell{
Child: &widgets.Container{
Padding: goflow.NewEdgeInsetsSymmetric(24, 12),
Color: goflow.ColorBlue,
Child: widgets.NewText("Click Me"),
},
OnTap: func() {
fmt.Println("Button pressed!")
},
}widgets.NewStack([]goflow.Widget{
// Background
widgets.NewImage(backgroundImage),
// Overlay
&widgets.ColoredBox{
Color: goflow.NewColor(0, 0, 0, 128), // Semi-transparent black
Child: widgets.NewCenter(
widgets.NewText("Overlaid Text"),
),
},
})Future widget implementations:
- Material Design components (AppBar, Card, Drawer, etc.)
- Cupertino (iOS-style) widgets
- Form widgets (TextField, Checkbox, Radio, Switch, Slider)
- Animation widgets (AnimatedContainer, FadeTransition, etc.)
- Custom painting widgets (CustomPaint)
- Sliver widgets for advanced scrolling
Total Widgets Documented: 27 widgets across 13 files
This reference covers all currently implemented widgets in the GoFlow framework.