jesusrp98 / edit_builder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Edit Builder

Package Build License Patreon

Simple package to help on the creation of edit pages.

This package aims to provide a super easy way to build an edit view of any kind. It uses flutter_bloc under the hood, in order to maintain the current state the editing item.

You must enter a valid initialState: it could be a just-initialzed object, or an object with data already inside. The type of this parameter is controller by the generic type of the widget.

The value and setValue inside the builder parameter offers an interface between the data & the view. Similiar to a StatefullWidget, in order to change the value of the value parameter, you just have to make the editing operation inside the setValue function. This function receives a new object of the same type as the previous one, and reloads the UI to reflect the changes.

Example

If you want to take a deeper look at the example, take a look at the example folder provided with the project.

EditBuilder<String>(
  initialValue: 'C++',
  builder: (context, value, setValue) => Center(
    child: Column(
      mainAxisAlignment: MainAxisAlignment.spaceAround,
      children: [
        Text(value),
        FlatButton(
          child: Text('INCREASE'),
          onPressed: () => setValue(value += '+'),
        )
      ],
    ),
  ),
),

Getting Started

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Built with

Authors

License

This project is licensed under the GNU GPL v3 License - see the LICENSE file for details.

About

License:GNU General Public License v3.0


Languages

Language:Dart 90.8%Language:Swift 6.6%Language:Kotlin 2.0%Language:Objective-C 0.6%