Code Monkey home page Code Monkey logo

flutter_adaptive_action_sheet's Introduction

Adaptive action sheet

pub package

A action bottom sheet that adapts to the platform (Android/iOS).

iOS Android
n1 n2

Getting Started

Add the package to your pubspec.yaml:

adaptive_action_sheet: ^2.0.3

In your dart file, import the library:

import 'package:adaptive_action_sheet/adaptive_action_sheet.dart';

Instead of using a showModalBottomSheet use showAdaptiveActionSheet Widget:

showAdaptiveActionSheet(
 context: context,
 title: const Text('Title'),
 androidBorderRadius: 30,
 actions: <BottomSheetAction>[
    BottomSheetAction(title: const Text('Item 1'), onPressed: (context) {}),
    BottomSheetAction(title: const Text('Item 2'), onPressed: (context) {}),
    BottomSheetAction(title: const Text('Item 3'), onPressed: (context) {}),
 ],
 cancelAction: CancelAction(title: const Text('Cancel')),// onPressed parameter is optional by default will dismiss the ActionSheet
);

Parameters:

showAdaptiveActionSheet:

  • actions: The Actions list that will appear on the ActionSheet. (required)
  • cancelAction: The optional cancel button that show under the actions (grouped separately on iOS).
  • title: The optional title widget that show above the actions.
  • androidBorderRadius: The android border radius (default: 30).
  • isDismissible: Specifies whether the bottom sheet will be dismissed when user taps outside of the bottom sheet. It is true by default and cannot be null.
  • useRootNavigator: Can be passed to set useRootNavigator of showCupertinoModalPopup (Default true) and useRootNavigator of showModalBottomSheet (Default false)
  • The optional backgroundColor and barrierColor can be passed in to customize the appearance and behavior of persistent material bottom sheets(Android only).

BottomSheetAction:

  • title: The primary content of the action sheet item. (required)
  • onPressed: The callback that is called when the action item is tapped. (required)
  • leading: A widget to display before the title. Typically an Icon widget. (optional)
  • trailing: A widget to display after the title. Typically an Icon or a CircleAvatar widget. (optional)

CancelAction:

  • title: The primary content of the cancel action sheet item. (required)
  • onPressed: The callback that is called when the action item is tapped. onPressed is optional by default will dismiss the Action Sheet.

flutter_adaptive_action_sheet's People

Contributors

daniel-ioannou avatar lucaspal avatar hir0pr0tag0nist avatar ianpedraza avatar arthurmaroulier avatar guyluz11 avatar wer-mathurin avatar kuglemic avatar danielsafenow avatar

Stargazers

Gülsen Keskin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.