GlassBarItem.custom constructor

const GlassBarItem.custom({
  1. required Widget child,
  2. VoidCallback? onTap,
  3. Object? id,
  4. String? label,
  5. bool enabled,
  6. GlassBarItemBackground background,
  7. Color? tintColor,
  8. GlassBarItemAxisBehavior axisBehavior,
})

An arbitrary widget inside the pinned cluster.

Equivalent to UIBarButtonItem(customView:). The widget is measured at its intrinsic width during layout and the capsule sizes itself around it, so it participates in the pinned morph exactly like an icon does — it stays put while the page slides, and animates between routes.

Constrained to the cluster's height; give the child its own padding if it needs breathing room. Supply id to keep it matched across routes.

onTap is optional here, unlike on GlassBarItem.icon: a custom view is as often a status readout as it is a button, and one that handles its own gestures wants the cluster to stay out of the way. When onTap is omitted (or null), the slot is passive — it adds no outer button semantics, focus stop, or tap recognizer around child, and is excluded from the vertical strip's overflow menu. Leave label null when child provides its own accessible semantics (such as a button or tooltip); supply label to name a passive readout as a single semantic node (replacing child's own text semantics).

Implementation

const factory GlassBarItem.custom({
  required Widget child,
  VoidCallback? onTap,
  Object? id,
  String? label,
  bool enabled,
  GlassBarItemBackground background,
  Color? tintColor,
  GlassBarItemAxisBehavior axisBehavior,
}) = GlassBarCustomItem;