components_configurations library
Provides classes to customize SelectionMenu and/or ListViewMenu.
There are two parts of this library, Components and Components Configurations.
Components Configurations
ComponentsConfiguration is a base class that defines the appearance of SelectionMenu and ListViewMenu.
It is simply a collection of components and configurations.
This class can be subclassed. The subclass would assign values to the instance variables of ComponentsConfiguration. The subclasses can then be passed to SelectionMenu.componentsConfiguration or ListViewMenu.componentsConfiguration.
Two predefined subclasses are:
- DialogComponentsConfiguration a dialog or popup style appearance.
- DropdownComponentsConfiguration a dropdown style appearance.
A series of examples/guides can be found here.
Components
Components are classes that can be used to configure ComponentsConfiguration.
Each component defines a specific UI related part of the SelectionMenu or ListViewMenu.
Components follow a similar pattern. Take for example a component called X.
The library provides:
- Class: XComponent. SearchFieldComponent for example.
- Class: XComponentData. SearchFieldComponentData for example.
- Function Type: XBuilder. SearchFieldBuilder for example.
XComponentData contains data that might be required during the process of building. Like SearchFieldComponentData.context.
XComponent carries a builder method of type XBuilder which takes an instance of XComponentData as a parameter.
Like so:
XComponent(
builder: instanceOfXBuilder(XComponentData data)
{
//implementation.
}
);
These classes can also be extended like so:
class XComponentSub extends XComponent
{
String myTempString;
XComponentSub()
{
//...
super.builder = _builder;
}
Widget _builder()
{
// implementation...
}
}
If your class needs to access the Widgets life cycle, for example the dispose method, you can use ComponentLifeCycleMixin.
Examples
A series of detailed examples are available here.
Classes
- AnimationComponent
- Defines builder that returns a Widget acts as a container that is capable of animation.
- AnimationComponentData
- Data that might be used in AnimationComponent.builder.
-
ComponentsConfiguration<
T> - A base class that define the appearance of SelectionMenu and ListViewMenu.
- DialogAnimationComponent
- A AnimationComponent used by DialogComponentsConfiguration.
-
DialogComponentsConfiguration<
T> - Defines the appearance of SelectionMenu as a popup dialog menu.
- DialogListViewComponent
- A ListViewComponent used by DialogComponentsConfiguration.
- DialogMenuComponent
- A MenuComponent used by DialogComponentsConfiguration.
- DialogMenuPositionAndSizeComponent
- A MenuPositionAndSizeComponent used by DialogComponentsConfiguration.
- DialogSearchBarComponent
- A SearchBarComponent used by DialogComponentsConfiguration.
- DialogSearchFieldComponent
- A SearchFieldComponent used by DialogComponentsConfiguration.
- DialogSearchingIndicatorComponent
- A SearchingIndicatorComponent used by DialogComponentsConfiguration.
- DialogTriggerComponent
- A TriggerComponent used by DialogComponentsConfiguration.
- DropdownAnimationComponent
- A AnimationComponent used by DropdownComponentsConfiguration.
-
DropdownComponentsConfiguration<
T> - Defines the appearance of SelectionMenu as a typical dropdown menu.
- DropdownListViewComponent
- A ListViewComponent used by DropdownComponentsConfiguration.
- DropdownMenuComponent
- A MenuComponent used by DropdownComponentsConfiguration.
- DropdownMenuPositionAndSizeComponent
- A MenuPositionAndSizeComponent used by DropdownComponentsConfiguration.
- DropdownSearchBarComponent
- A SearchBarComponent used by DropdownComponentsConfiguration.
- DropdownSearchFieldComponent
- A SearchFieldComponent used by DropdownComponentsConfiguration.
- DropdownSearchingIndicatorComponent
- A SearchingIndicatorComponent used by DropdownComponentsConfiguration.
- DropdownTriggerComponent
- A TriggerComponent used by DropdownComponentsConfiguration.
- ListViewComponent
- Defines a Widget builder that returns a Widget that acts as a scrollable list populated by ListViewComponentData.itemBuilder.
- ListViewComponentData
- Carries the data that might be used in ListViewComponent.builder.
- MenuAnimationCurves
- Curves used by the animations of menu in SelectionMenu.
- MenuAnimationDurations
- Durations of the animations of the menu inside SelectionMenu.
- MenuComponent
- Defines a Menu Widget builder. A Menu is any Widget that wraps two Widgets MenuComponentData.searchBar and MenuComponentData.listView.
- MenuComponentData
- Carries the data that might be used in MenuComponent.builder.
- MenuFlexValues
- A collection of flex attributes of Flexible/Expanded Widgets used in menu layout.
- MenuPositionAndSize
- Container for Menu's constraints and, position and size.
- MenuPositionAndSizeComponent
- Defines a MenuPositionAndSize builder for the menu.
- MenuPositionAndSizeComponentData
- Carries the data that might be used in MenuPositionAndSizeComponent.builder.
- MenuSizeConfiguration
- Defines the size constraints of the Menu and behavior of Size in certain conditions.
- SearchBarComponent
- Defines a Search Bar Widget builder. A Search Bar is any Widget that wraps two Widgets SearchBarComponentData.searchField and SearchBarComponentData.searchingIndicator.
- SearchBarComponentData
- Carries the data that might be used in SearchBarComponent.builder.
- SearchFieldComponent
- Defines a Search Field Widget builder. A Search Field is any Widget that allows to edit text.
- SearchFieldComponentData
- Carries the data that might be used in SearchFieldComponent.builder.
- SearchingIndicatorComponent
- Defines a Searching Indicator Widget builder. A Searching Indicator is any Widget that will be shown when the search in progress has to be shown.
- SearchingIndicatorComponentData
- Carries the data that might be used in SearchingIndicatorComponent.builder.
- TriggerComponent
- Defines builder that returns a Widget that acts as a trigger.
- TriggerComponentData
- Carries the data that might be used in TriggerComponent.builder.
-
TriggerFromItemComponent<
T> - Defines a Widget that acts like a button. Additionally, the button reflects the content provided as TriggerFromItemComponentData.item.
-
TriggerFromItemComponentData<
T> - Carries the data that might be used in TriggerFromItemComponent.builder.
- TriggerPositionAndSize
- Container for Trigger's Size and position.
Enums
- MenuState
- States the menu goes through during opening and closing.
Mixins
- ComponentLifeCycleMixin
- A mixin that provides methods (hooks) to the lifecycle of the Widget to which the component is assigned.
Typedefs
- AnimationBuilder = Widget Function(AnimationComponentData data)
- Defines a method that returns a Widget that is capable of animation.
- ListViewBuilder = Widget Function(ListViewComponentData data)
- This typedef defines a method that returns a Widget that acts as a scrollable list. This list is populated by ListViewComponentData.itemBuilder.
- MenuBuilder = Widget Function(MenuComponentData data)
- This typedef defines a method that returns a Widget that wraps MenuComponentData.searchBar and MenuComponentData.listView in a Widget, defining their layout.
- MenuPositionAndSizeBuilder = MenuPositionAndSize Function(MenuPositionAndSizeComponentData data)
- This typedef defines a method that returns a MenuPositionAndSize that is used to place the menu on the screen.
- MenuStateChanged = void Function()
- A callback that informs about Menu state change.
- MenuStateWillChangeAfter = void Function(Duration time)
-
A callback that informs about Menu state change that will occur after
time
. - SearchBarBuilder = Widget Function(SearchBarComponentData data)
- This typedef defines a method that returns a Widget that wraps SearchBarComponentData.searchField and SearchBarComponentData.searchingIndicator in a Widget, defining their layout.
- SearchFieldBuilder = Widget Function(SearchFieldComponentData data)
- This typedef defines a method that returns a Widget where a user can enter text.
- SearchingIndicatorBuilder = Widget Function(SearchingIndicatorComponentData data)
- This typedef defines a method that returns a Widget that acts as the Indicator for when search is in progress.
- TriggerBuilder = Widget Function(TriggerComponentData data)
- This typedef defines a method that returns a Widget that acts as the trigger for the menu to open/close.
-
TriggerFromItemBuilder<
T> = Widget Function(TriggerFromItemComponentData< T> data) - This typedef defines a method that returns a Widget that acts as a trigger for the menu to open/close, additionally, the content of the button reflects a TriggerFromItemComponentData.item as defined by the function body.
- TriggerMenu = void Function()
- Callback to Open/Close the menu.