createComponent function

void createComponent(
  1. String componentName
)

Creates the specified Flutter component by calling the appropriate function

The function maps the provided component name to a corresponding method, which generates boilerplate code for that component. If the component is not supported, an error message is displayed.

Supported components:

  • app-bar
  • alert-dialog
  • animated-container
  • badge
  • bottom-navigation-bar
  • bottom-sheet
  • card
  • checkbox
  • chip
  • circle-avatar
  • circular-progress-indicator
  • linear-progress-indicator
  • outline-button
  • custom-scroll-view
  • text-field
  • toast
  • dropdown-button
  • elevated-button
  • fade-transition
  • scale-transition
  • hero
  • grid-tile
  • grid-view
  • list-tile
  • list-view
  • popup-menu-button
  • radio-button
  • search-field
  • shimmer
  • slider
  • tab-bar
  • text-button

Implementation

void createComponent(String componentName) {
  switch (componentName.toLowerCase()) {
    case 'app-bar':
      createCustomAppBar();
      break;
    case 'alert-dialog':
      createAlertDialog();
      break;
    case 'animated-container':
      createCustomAnimatedContainer();
      break;
    case 'badge':
      createCustomBadge();
      break;
    case 'bottom-navigation-bar':
      createBottomNavigationBar();
      break;
    case 'bottom-sheet':
      createBottomSheet();
      break;
    case 'card':
      createCustomCard();
      break;
    case 'checkbox':
      createCustomCheckbox();
      break;
    case 'chip':
      createCustomChip();
      break;
    case 'circle-avatar':
      createCustomAvatar();
      break;
    case 'circular-progress-indicator':
      createCustomCircularProgressIndicator();
      break;
    case 'linear-progress-indicator':
      createCustomLinearProgressIndicator();
      break;
    case 'outline-button':
      createCustomOutlineButton();
      break;
    case 'custom-scroll-view':
      createCustomScrollViewWidget();
      break;
    case 'text-field':
      createCustomTextField();
      break;
    case 'toast':
      createCustomToast();
      break;
    case 'dropdown-button':
      createCustomDropdownButton();
      break;
    case 'elevated-button':
      createElevatedButton();
      break;
    case 'fade-transition':
      createCustomFadeTransition();
      break;
    case 'scale-transition':
      createCustomScaleTransition();
      break;
    case 'hero':
      createCustomHero();
      break;
    case 'grid-tile':
      createCustomGirdTile();
      break;
    case 'grid-view':
      createGridView();
      break;
    case 'list-tile':
      createCustomListTile();
      break;
    case 'list-view':
      createListView();
      break;
    case 'popup-menu-button':
      createCustomPopupMenuButton();
      break;
    case 'radio-button':
      createCustomRadioButton();
      break;
    case 'search-field':
      createCustomSearchField();
      break;
    case 'shimmer':
      createShimmerWidget();
      break;
    case 'slider':
      createCustomSlider();
      break;
    case 'tab-bar':
      createCustomTabBar();
      break;
    case 'text-button':
      createTextButton();
      break;
    default:
      print('Component $componentName is not supported yet.');
  }
}