AppButton.fromConfig constructor

AppButton.fromConfig(
  1. AppButtonConfig config
)

Implementation

factory AppButton.fromConfig(AppButtonConfig config) {
  return switch (config.type) {
    (AppButtonType.filled) => AppButton.filled(
        onPressed: config.onPressed,
        onPressedDisabled: config.onPressedDisabled,
        child: config.child,
      ),
    (AppButtonType.elevated) => AppButton.elevated(
        onPressed: config.onPressed,
        onPressedDisabled: config.onPressedDisabled,
        child: config.child,
      ),
    (AppButtonType.tonal) => AppButton.tonal(
        onPressed: config.onPressed,
        onPressedDisabled: config.onPressedDisabled,
        child: config.child,
      ),
    (AppButtonType.outlined) => AppButton.outlined(
        onPressed: config.onPressed,
        onPressedDisabled: config.onPressedDisabled,
        child: config.child,
      ),
    (AppButtonType.text) => AppButton.text(
        onPressed: config.onPressed,
        onPressedDisabled: config.onPressedDisabled,
        child: config.child,
      ),
    (AppButtonType.icon) => _AppIconButton(
        onPressed: config.onPressed,
        onPressedDisabled: config.onPressedDisabled,
        child: config.child,
      ),
  };
}