FLUTTER ECOSYSTEM

husainazkas/slidable_button

husainazkas/slidable_button open-source repository details.

スライドボタン のプロジェクト画像
Stars
3
Forks
9
最終プッシュ(UTC)
2023/06/08
プロジェクト状態
公開中
Husain Fadhilah GitHub avatar
言語DartC++CMakeHTMLCSwiftKotlinObjective-C

技術トピック

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 3 件
  • flutter{"sdk":"flutter"}
  • flutter_lints開発用^2.0.1
  • flutter_test開発用{"sdk":"flutter"}

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

README を開く / 閉じる

slidable_button

Pub support

A simple flutter plugin for Slidable Button.

https://raw.githubusercontent.com/husainazkas/slidable_button/master/screenshot/1.gif   https://raw.githubusercontent.com/husainazkas/slidable_button/master/screenshot/2.gif
https://raw.githubusercontent.com/husainazkas/slidable_button/master/screenshot/3.gif

Note : This plugin is cloned and remade from swipe_button.

Getting Started

Add dependency
dependencies:
  slidable_button: ^3.0.0+1
Simple to use

Import this library on your code.

import 'package:slidable_button/slidable_button.dart';

Now you can make your slidable button vertically or horizontally by using one of them widget. For horizontal usage example :

    HorizontalSlidableButton(
      width: MediaQuery.of(context).size.width / 3,
      buttonWidth: 60.0,
      color: Theme.of(context).accentColor.withOpacity(0.5),
      buttonColor: Theme.of(context).primaryColor,
      dismissible: false,
      label: Center(child: Text('Slide Me')),
      child: Padding(
        padding: const EdgeInsets.all(8.0),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Text('Left'),
            Text('Right'),
          ],
        ),
      ),
      onChanged: (position) {
        setState(() {
          if (position == SlidableButtonPosition.end) {
            result = 'Button is on the right';
          } else {
            result = 'Button is on the left';
          }
        });
      },
    ),

Vertical usage example :

    VerticalSlidableButton(
      height: MediaQuery.of(context).size.height / 3,
      buttonHeight: 60.0,
      color: Theme.of(context).accentColor.withOpacity(0.5),
      buttonColor: Theme.of(context).primaryColor,
      dismissible: false,
      label: Center(child: Text('Slide Me')),
      child: Padding(
        padding: const EdgeInsets.all(8.0),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Text('Top'),
            Text('Bottom'),
          ],
        ),
      ),
      onChanged: (position) {
        setState(() {
          if (position == SlidableButtonPosition.end) {
            result = 'Button is on the bottom';
          } else {
            result = 'Button is on the top';
          }
        });
      },
    ),
Migration Guide

If you already use this package before v3.x.x you may need to migrate your code to HorizontalSlidableButton or VerticalSlidableButton for specific direction usage because SlidableButton class has been removed start from v3.0.0.