fk_toggle v0.1.4

This is simple flutter toggle button widget.

Supports show text labels and icons, Possible set multiple value to toggle ui, not only 2 values.

Also you can customize size and colors as you like.

Screenshot of SampleApp

fk_toggle_image

Features

  • Toggle Items
    • Provide toggle change event.
  • Show texts
  • Show icons
  • Customization of Size, And colors when toggle on/off.

How to install

Add this to your package's pubspec.yaml file:

dependencies:
  fk_toggle: ^0.1.1

You can install packages from the command line with Flutter:

$ flutter pub get

Import in your project:

import 'package:fk_toggle/fk_toggle.dart';

Usage

Scaffold(
  appBar: AppBar(title: const Text('Sample Toggle Switches')),
  body: Center(
    child: Column(
      mainAxisSize: MainAxisSize.min,
      mainAxisAlignment: MainAxisAlignment.center,
      children: Padding(
          padding: const EdgeInsets.all(10.0),
          child: FkToggle(
            width: 50,
            height: 30,
            labels: const ['1', '2']
          ),
        )
      )
    ),
  ),
);

Parameter descriptions

Property namedescriptiondefault valuerequired
widthlength of a toogle :warning: not full length of widget:u7121::heavy_check_mark:
heightheight of widget:u7121::heavy_check_mark:
labelstoggle button texts. Allow empty text:u7121::heavy_check_mark:
cornerRadiussize of corner radius10
backgroundColorunselected toggle colorColors.black26
selectedColorselected toggle colorColors.blue
disabledElementColorunselected label colorColors.black54
enabledElementColorselected label colorColors.white
fontSizefont size of labels16.0
iconsAllow null value in lists,You can set an icon for any Toggle:u7121:
onSelectedprovide toggle change event, Provide index and instance:u7121:

Future schedule

  • Implement animation feature
  • Improve class paramters to about like auto calulate width and height.
  • you can post some issues.

Contacts

Feel free to send message.
Welcome to work consultation or everything.
Twitter:@fukutan_org
github:fukutan-org

Libraries

fk_toggle