WidgetStateBorderSide.resolveWith constructor

const WidgetStateBorderSide.resolveWith(
  1. WidgetPropertyResolver<BorderSide?> callback
)

Creates a WidgetStateBorderSide from a WidgetPropertyResolver<BorderSide?> callback function.

If used as a regular BorderSide, the border resolved in the default state (the empty set of states) will be used.

Usage:

ChipTheme(
  data: Theme.of(context).chipTheme.copyWith(
    side: WidgetStateBorderSide.resolveWith((Set<WidgetState> states) {
      if (states.contains(WidgetState.selected)) {
        return const BorderSide(color: Colors.red);
      }
      return null;  // Defer to default value on the theme or widget.
    }),
  ),
  child: const Chip(
    label: Text('Transceiver'),
  ),
),

Alternatively:

Chip(
  label: const Text('Transceiver'),
  side: WidgetStateBorderSide.resolveWith((Set<WidgetState> states) {
    if (states.contains(WidgetState.selected)) {
      return const BorderSide(color: Colors.red);
    }
    return null;  // Defer to default value on the theme or widget.
  }),
),

Implementation

const factory WidgetStateBorderSide.resolveWith(WidgetPropertyResolver<BorderSide?> callback) = _WidgetStateBorderSide;