FIcons class final

The icon tokens used by Forui's widgets. Defaults to icons in FLucideIcons.

Customizing icons

To change the icons used by Forui widgets, pass a FIcons to FThemeData.

Icons in FIcons should inherit their properties from the ambient IconTheme. Packages that represent icons as IconData inherit automatically; use FIcon.new to wrap them.

For example, to use the in-built Material icons:

FThemeData(
  colors: FColors.neutralLight,
  touch: false,
  icons: FIcons(
    arrowLeft: FIcon(Icons.arrow_left),
    calendar: FIcon(Icons.calendar_month),
    check: FIcon(Icons.check),
    // ...
  ),
);

Packages with duotone or multi-color glyphs typically expose a custom icon widget instead. Implement FIcon to use them, taking care to follow FIcon's contract:

class AwesomeIcon implements FIcon {
  final IconDataBrands data;

  const AwesomeIcon(this.data);

  @override
  Widget call(BuildContext context, {String? semanticsLabel}) =>
      FaIcon(data, semanticLabel: semanticsLabel);

  @override
  bool operator ==(Object other) => identical(this, other) || other is AwesomeIcon && data == other.data;

  @override
  int get hashCode => data.hashCode;
}

Known-compatible packages:

  • font_awesome_flutter
  • hugeicons

Icons that do not inherit from the ambient IconTheme (e.g. SVG-based packages) must read the data themselves. Wrap the widget in a Builder so IconTheme.of is evaluated inside the caller's wrap:

class SvgIcon implements FIcon {
  final String asset;

  const SvgIcon(this.asset);

  @override
  Widget call(BuildContext _, {String? semanticsLabel}) => Builder(
    builder: (context) {
      final data = IconTheme.of(context);
      return SvgPicture.asset(
        asset,
        width: data.size,
        height: data.size,
        colorFilter: data.color == null ? null : ColorFilter.mode(data.color!, BlendMode.srcIn),
        semanticsLabel: semanticsLabel,
      );
    },
  );

  @override
  bool operator ==(Object other) => identical(this, other) || other is SvgIcon && asset == other.asset;

  @override
  int get hashCode => asset.hashCode;
}

Run dart run forui theme create to generate a custom theme.

Mixed-in types

Constructors

FIcons({required FIcon arrowLeft, required FIcon calendar, required FIcon check, required FIcon chevronDown, required FIcon chevronLeft, required FIcon chevronRight, required FIcon chevronUp, required FIcon chevronsUpDown, required FIcon circleAlert, required FIcon clock4, required FIcon ellipsis, required FIcon error, required FIcon eye, required FIcon eyeClosed, required FIcon gripHorizontal, required FIcon gripVertical, required FIcon loader, required FIcon loaderCircle, required FIcon loaderPinwheel, required FIcon search, required FIcon userRound, required FIcon x})
Creates a FIcons with the given icons.
const
FIcons.lucide()
Creates a FIcons backed by FLucideIcons defaults.
const

Properties

arrowLeft FIcon
A left-pointing arrow.
final
calendar FIcon
A calendar.
final
check FIcon
A check mark.
final
chevronDown FIcon
A downward-pointing chevron.
final
chevronLeft FIcon
A left-pointing chevron.
final
chevronRight FIcon
A right-pointing chevron.
final
chevronsUpDown FIcon
A pair of vertically-stacked chevrons.
final
chevronUp FIcon
An upward-pointing chevron.
final
circleAlert FIcon
An alert / warning indicator inside a circle.
final
clock4 FIcon
A clock with a 4 o'clock indicator.
final
ellipsis FIcon
A horizontal ellipsis (three dots).
final
error FIcon
An alert used to denote errors such as form field validation failures.
final
eye FIcon
An open eye.
final
eyeClosed FIcon
A closed eye.
final
gripHorizontal FIcon
A horizontal grip handle.
final
gripVertical FIcon
A vertical grip handle.
final
hashCode int
The hash code for this object.
no setteroverride
loader FIcon
A loading indicator (segments).
final
loaderCircle FIcon
A loading indicator (circular).
final
loaderPinwheel FIcon
A loading indicator (pinwheel).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
A search / magnifying glass.
final
userRound FIcon
A user silhouette in a circle.
final
x FIcon
An "x" / close mark.
final

Methods

debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
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
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override