flutter_crud_esquemas_dynamicos_mobile 3.0.0 copy "flutter_crud_esquemas_dynamicos_mobile: ^3.0.0" to clipboard
flutter_crud_esquemas_dynamicos_mobile: ^3.0.0 copied to clipboard

A Flutter package for creating dynamic CRUD forms using configurable schemas. Provides flexible and adaptable framework for different data types and structures, including a wizard for creating dynamic forms.

flutter_crud_esquemas_dynamicos_mobile #

A Flutter package for creating dynamic CRUD forms using configurable schemas. Provides a flexible and adaptable framework for different data types and structures, including a wizard for creating dynamic forms.

Features #

  • Dynamic CRUD operations for configurable collections
  • Real-time form data management
  • Wizard for creating dynamic forms
  • BLoC pattern state management
  • OAuth2 authentication integration
  • Runtime code evaluation with dart_eval
  • Support for iOS and Android platforms

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_crud_esquemas_dynamicos_mobile: ^3.0.0

Then run:

flutter pub get

Project Structure #

The project is organized as follows:

  • lib/: Contains the main Flutter application code.
    • main.dart: Application entry point.
    • bloc/: Handles business logic and state management.
      • config_columna/: Configures visible columns in tables.
      • dynamic_crud/: Dynamically manages CRUD operations for collections.
      • dynamic_crud_process_bloc/: Processes collection-related information.
      • info_ui_app/: Determines device type and adjusts UI.
      • navegacion/: Manages navigation between views.
      • socket/: Handles real-time communication via sockets.
      • stream_data/: Maintains and updates form data in real-time.
      • wizard/: Manages dynamic form creation through a wizard.
    • provider/: Contains data providers and business logic.
      • eval_provider.dart: Loads and executes eval code for form actions.
      • shortcuts_provider.dart: Centralizes key actions for views.
      • shp_dynamic_crud.dart: Stores column configuration and unread notifications.
    • router/: Contains application route configuration.
      • go_router_model.dart: Model for route configuration with GoRouter.
      • go_router.dart: Route configuration using GoRouter.
    • utils/: Contains utilities and helper functions.
    • view/: Contains application views.
      • authentication/: User authentication views.
      • code_pad/: Views for eval code editing and execution.
      • esquemas/: Views for schema management.
      • formularios_dinamicos/: Views for dynamic form creation and management.

Getting Started #

Main Configuration #

  • lstVistasSistema: List of type RouteItem containing a String field as key and another as description.
  • rootRoute: Application start route. After login or pressing the home button in the menu, it will navigate to this view.
  • clientId and clientSecret: Used for login and application authentication.
  • origenColeccion: Origin of the collections to be used in the application.
  • coleccionFuncionesBackend: Name of the collection where all functions (sync, async and atomic) used by the system are stored.
  • homePageBuilder: Widget that will always be visible in the system, mainly used to store the menu and other widgets that should not be redrawn every time you navigate between views.

Manual Route Configuration #

To display a view designed from the project, first define that route to provide to MyAppDynamic. It receives a map that expects a String key as the route and a value that is a function with two parameters. The first is the context and the second is the GoRouter state, where you can get information passed in navigation between views.

Configure a Dynamic Form for System View #

Access the dynamic forms section and create a new view. It is not necessary to select a related collection or load anything to the form, just save it. Complete with a name, description and select that the form type is system, choosing the item we just loaded in the NavegacionFunc.lstVistasSistema list.

Eval Code in Dynamic Fields #

Dynamic forms have the ability to execute eval code at runtime (fields that listen to other fields and perform an action as soon as they change). They are visually configured in the configuration panel.

When making a change to a field, the configured eval method will be triggered.

Eval Code Return Syntax #

  • Must always return a map; otherwise, the result will be ignored.
  • To overwrite a property configured in the collection schema, load a map with the camposEsquemas key and in its values a map with what you want to modify.

For widget properties, you need to specify the key and the corresponding data type value to modify it. You can see a complete list with all widget properties in formulario_dinamicos/model/environment_form.dart.

Default Values for Fields #

There are 2 ways to set default values for dynamic form fields: definition in schema and definition in form.

Definition in Schema #

To define a default value, go to collections -> collection schema -> properties and complete the default value field. Note: for date or dateTime type fields, it is not necessary to specify a default value, they are loaded automatically.

Definition in Dynamic Form #

When defining a default value in the dynamic form, it will only apply to the form where it was defined, unlike the default value in the schema which applies to all forms that use that schema.

Steps:

  1. Generate an eval code for execution: Go to the eval codes section and generate an eval code according to the visual needs.

  2. Access the form to which you want to assign the eval code: Once in the form, configure the listening field properties and function to execute.

  • Campo de escucha (Listening field): Select which fields you want to listen to so that when their value changes, the configured eval code is triggered.
  • Funcion a ejecutar (Function to execute): Eval code to execute.

Platforms #

This package supports:

  • Android
  • iOS

License #

Copyright 2025 RobleSistemas

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.