paperFAB

PaperFAB paperFAB({

  1. PaperFABProps? props,
  2. void onPress()?,
})

Create a Paper FAB with full type safety.

final fab = paperFAB(
  props: (icon: 'plus', label: null, small: false, visible: true,
          loading: null, disabled: null, color: null,
          customColor: '#6200EE', style: null),
  onPress: handleAdd,
);

Implementation

PaperFAB paperFAB({PaperFABProps? props, void Function()? onPress}) {
  final p = <String, dynamic>{};
  if (props != null) {
    if (props.icon != null) p['icon'] = props.icon;
    if (props.label != null) p['label'] = props.label;
    if (props.small != null) p['small'] = props.small;
    if (props.visible != null) p['visible'] = props.visible;
    if (props.loading != null) p['loading'] = props.loading;
    if (props.disabled != null) p['disabled'] = props.disabled;
    if (props.color != null) p['color'] = props.color;
    if (props.customColor != null) p['customColor'] = props.customColor;
    if (props.style != null) p['style'] = props.style;
  }
  if (onPress != null) p['onPress'] = onPress;

return PaperFAB._create( npmComponent('react-native-paper', 'FAB', props: p.isEmpty ? null : p), ); }