flutter_checklist 1.5.1 copy "flutter_checklist: ^1.5.1" to clipboard
flutter_checklist: ^1.5.1 copied to clipboard

A widget to display a checklist with checkable and reorderable items

flutter_checklist #

Pub Version

A widget to display a checklist.

Screen recording of the example app

Installing #

See the installing instructions.

Features #

  • Display a checklist
  • Toggle items and edit their text
  • Reorder items
  • Add new items (either after the submitted one or at the end)
  • Remove items
  • Make the checklist read only

Usage #

ChecklistLine #

The ChecklistLine type is a record that represents a line (an item, an entry) of the checklist. It contains the text of that line and whether it is toggled.

A list of ChecklistLine represents a checklist with all its lines. The order of the list directly determines the order of the items in the checklist.

Checklist #

The Checklist widget displays your list of ChecklistLine as a checklist.

It requires as arguments the list of ChecklistLine to display, and a callback function to execute when any modification is performed on that list with the new list of ChecklistLine.

A checklist can be made read only by setting the enabled parameter to false, which disables any modification to the checklist lines as well as their reordering.

// The list of five ChecklistLine to display with their text and whether they are toggled
final lines = List.generate(
  5,
  (index) => (text: 'Line ${index + 1}', toggled: false),
);

// The function to execute when the checklist is modified, with the new list of ChecklistLine
void onChanged(List<ChecklistLine> lines) {
  log(lines.toString());
}

// The checklist widget
Checklist(
  lines: lines,
  onChanged: onChanged,
);
copied to clipboard

Localization #

Embedded

This package supports localization. To enable it in your app, add the localizations delegates to your MaterialApp:

MaterialApp(
  localizationsDelegates: [
    ChecklistLocalizations.delegate,
    // Any other localizations delegates, from your app or other packages
  ],
);
copied to clipboard

The following localizations are currently supported (ordered alphabetically):

  • English
  • French

To add support for a new localization or improve an existing one, please open an issue.

Custom

To provide your own localizations (to replace the embedded ones are provide missing ones), implement the ChecklistLocalizations class (for examples, look at the generated ones) and pass it to the localizations parameter:

Checklist(
  lines: lines,
  onChanged: onChanged,
  localizations: CustomChecklistLocalizations(),
)
copied to clipboard

Example #

See the example app.

1
likes
150
points
223
downloads

Publisher

verified publishermaelchiotti.dev

Weekly Downloads

2024.09.02 - 2025.03.17

A widget to display a checklist with checkable and reorderable items

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

animated_reorderable_list, flutter, flutter_localizations, intl

More

Packages that depend on flutter_checklist