buildByCupertino method

  1. @override
Widget buildByCupertino(
  1. BuildContext context
)

build on cupertino mode (Flutter implementation)

Implementation

@override
Widget buildByCupertino(BuildContext context) {
  // Wrap CNPopupButton with constraints to ensure proper width in Expanded/Flexible layouts
  return ConstrainedBox(
    constraints: BoxConstraints(
      minWidth: valueOf('width', width) ?? 120, // Ensure minimum width for proper text display
      maxWidth: valueOf('width', width) ?? double.infinity, // Allow expansion if in Expanded widget
      minHeight: valueOf('height', height),
      maxHeight: valueOf('height', height),
    ),
    child: CNPopupButton(
      options: valueOf('options', options),
      selectedIndex: valueOf('selectedIndex', selectedIndex),
      onSelected: valueOf('onSelected', onSelected),
      tint: valueOf('tint', tint),
      height: valueOf('height', height),
      width: valueOf('width', width), // Keep width param for CNPopupButton's internal handling
      buttonStyle: valueOf('buttonStyle', buttonStyle),
      prefix: valueOf('prefix', prefix),
      dividerIndices: valueOf('dividerIndices', dividerIndices),
    ),
  );
}