Pakete, Repositories und App-Kategorien suchen

Cover von contextualactionbar
Paketdetailsv3.1.0

contextualactionbar

Eine Workaround-Lösung für die Contextual Action Bar (CAB) in Flutter. CAB ist eine oberste App-Leiste, die die App-Leiste ersetzt und kontextbezogene Aktionen für ausgewählte Elemente bereitstellt.

AndroidiOSWebmacOSWindowsLinux
30-Tage-Downloads
119
Likes
66
Pub-Punkte
150

Paket installieren

flutter pub add contextualactionbar

Paketübersicht

Aus öffentlichen Paketdaten erstellte Orientierung.

Das contextualactionbar-Paket bietet eine Workaround-Lösung zur Implementierung einer kontextbezogenen Aktionsleiste (CAB) in Flutter und ermöglicht eine dynamische Oberleiste, die die Standard-App-Leiste ersetzt, um kontextspezifische Aktionen anzuzeigen, wenn Elemente ausgewählt werden. Es ist für den Einsatz auf mehreren Plattformen wie Android, iOS, Web, macOS, Windows und Linux konzipiert und verbessert die Benutzerinteraktion durch gezielte Steuerungen während Auswahlmodi. Das Paket lässt sich nahtlos in bestehende Flutter-Anwendungen integrieren und unterstützt benutzerdefinierte Stile und Verhalten. Besonders nützlich ist es in Listen- oder Raster-Schnittstellen, bei denen Benutzer Batch-Operationen durchführen müssen.

Anwendungsfälle

  • Stapelartige Auswahl von Elementen in Listen
  • kontextsensitive Aktionen in Rastern
  • Verbesserte Benutzerinteraktion in mobilen Apps
  • anpassbare Aktionsoverlays
  • Plattformübergreifende Implementierung
  • Verbesserungen der Auswahlmodus-Oberfläche

Hauptmerkmale

  • Dynamische Ersetzung der App-Leiste
  • Unterstützung für mehrere Plattformen
  • Anpassbare Aktionstasten
  • Integration mit Auswahlmodi
  • Leichtgewichtig und einfach umzusetzen
  • Reaktives Design für alle Geräte

Geeignet für

  • Entwickler, die interaktive Listenoberflächen erstellen
  • Apps, die Batch-Operationen erfordern
  • Plattformübergreifende mobile Anwendungen
  • Benutzeroberflächen mit auswahlbasierten Workflows
  • Teams, die plattformunabhängige CAB-Lösungen suchen
  • Flutter-Projekte, die kontextuelle Aktionen unterstützen müssen

Hinweise

  • Benötigt manuelle Handhabung des Auswahlzustands
  • Begrenzte eingebaute Animationen
  • Möglicherweise sind zusätzliche Stile für Konsistenz erforderlich
  • Abhängig von der richtigen Integration mit Scrollbarem
  • Nicht geeignet für einfache statische Benutzeroberflächen
  • Am besten mit Zustandsverwaltungs-Mustern verwendet

Original-README

Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.

Flutter contextual action bar(CAB)

CAB & Flutter

CAB is a top app bar that replace the application app bar to provide contextual actions to selected items. Check the material implementation and requirement here

Flutter does not natively support CAB yet. see issue Until CAB is natively supported, this package should provide you with an elegant way to implement the contextual action bar in flutter.

How it works

  • ContextualScaffold
  • ContextualAppBar
  • ContextualAction
  • ContextualActionWidget

ContextualScaffold<?>

The ContextualScaffold<?> is similar to the normal material Scaffold except that it also takes a required contextualAppBar.

ContextualScaffold<?>(
      contextualAppBar: ContextualAppBar(),
      appBar: AppBar(),
      body: Body(),
    )

You can provide multiple ContextualScaffold as needed

ContextualAppBar<?>

The ContextualAppBar<?> is similar to the normal material Appbar but takes a counterBuilder instead of title and also a contextualActions instead of actions.

 ContextualAppBar(
      counterBuilder: (int itemsCount){
        return Text("$itemsCount Selected");
      },
      contextualActions: <ContextualAction>[],
    )

ContextualAction<?>

The ContextualAction<?> allows you to take actions on the selected items, with the help of itemsHandler callback.

ContextualAction(
            itemsHandler: (List<?> items) {
              items.forEach((item) {
                Scaffold.of(context).showSnackBar(SnackBar(
                  content: Text("$item saved"),
                ));
              });
            },
            child: Icon(Icons.save),
          ),

ContextualActionWidget<?>

You can use the ContextualActionWidget anywhere in the ContextualActionScaffold body to notify ContextualActionScaffold that an item have been selected in order to show the ContextualAppBar.

   ContextualActionWidget(
          data: ?,
          child: ChildWidget(),
        )

Note: It is important that the child widget does not handle onLongPress.

A closer look at ContextualActionWidget<?>

The ContextualActionWidget<?> takes other optional parameters like

  • selectedColor
  • selectedWidget
  • unselectedWidget

The selectedColor is the color of the background for the selected item, it defaults to the splash color, if not provided. The selectedColor works well with ListTile.

selectedWidget and unselectedWidget are stacked on top of the provided child widget. By default, they are positioned at the center of the provided child widget. Since They are stacked, you can use Row, Align, Positioned Widget or any other combination of widgets to position them where desired.

The selectedWidget is shown when the ActionMode is enabled and the item is selected, while the unselectedWidget is shown when ActionMode is enabled and the item is not selected. See example(status_saver) image below with both the selectedWidget and unselectedWidget aligned to the top-right corner.

ActionMode

This contextual action bar workaround does not support zero item in the ActionMode.

  • Use the ActionMode.addItem<?> to add an item to the selected items. If this is the first selection, the ActionMode is will be enabled.

  • Use the ActionMode.addItems<?> to add a list of items.

  • Use the ActionMode.disable<?> to disable and deselect all selected items.

  • Use the ActionMode.enabledStream<?> to emit true or false depending on if the Action mode is enabled or disabled respectively.

Note: In most cases, you won't need to use ActionMode.disable<?> because the package already do that for you where needed.

Study complete examples at example page. If you like the project, don't forget to star ⭐️

Other Packages authored by me

License

This package is licensed under the MIT license. See LICENSE for details.

Kategorien

Abhängigkeiten

Abhängigkeiten 1 Einträge

Quell-Repository

Projekte, die dieses Paket verwenden

Noch keine Daten verfügbar.