Skip to content
On this page

Segment

A segmented control for choosing a view or option.

Segment in FluttyUISegment in FluttyUI dark theme

Import

import 'package:flutter/widgets.dart';
import 'package:fluttyui/fluttyui.dart' as ui;

API Reference

The declarations below match the current FluttyUI source. Types are shown without the optional ui. import prefix.

Segment

const Segment({
  super.key,
  required this.items,
  this.selectedIndex,
  this.initialIndex = 0,
  this.onChanged,
  this.enabled = true,
  this.expanded = false,
  this.size,
  this.backgroundColor,
  this.selectedColor,
  this.foregroundColor,
  this.selectedForegroundColor,
  this.focusColor,
  this.borderRadius,
  this.animationDuration,
});
ParameterTypeRequiredDefault
keyKey?Nonull
itemsList<SegmentItem>Yes—
selectedIndexint?Nonull
initialIndexintNo0
onChangedValueChanged<int>?Nonull
enabledboolNotrue
expandedboolNofalse
sizeComponentSize?Nonull
backgroundColorColor?Nonull
selectedColorColor?Nonull
foregroundColorColor?Nonull
selectedForegroundColorColor?Nonull
focusColorColor?Nonull
borderRadiusdouble?Nonull
animationDurationDuration?Nonull

Application Setup

Place components under FluttyApp to provide theme, navigation, localization, and overlay defaults. Use theme tokens for shared appearance settings.

Source

lib/src/widgets/navigation/segment/segment.dart

This reference is generated from the Segment declaration in the FluttyUI core checkout. The component catalog lists the other available building blocks.

DartFlutter

Get started with FluttyUI