large Flutter Favorite logosmall Flutter Favorite logo

toggle_switch 2.0.1 icon indicating copy to clipboard operation
toggle_switch: ^2.0.1 copied to clipboard

Toggle Switch - A simple toggle switch widget. It can be fully customized with desired icons, width, colors, text, corner radius etc. It also maintains selection state.

2.0.1 #

  • Added vertical toggle switch option (PR 51):
    • parameter:
      • isVertical (type bool - default false)
  • Added active borders option (Partial implementation from PR 53):
    • parameter:
      • activeBorders (optional, type List
    • list with only one Border value will apply that Border to all the active switches
    • different Border values can be provided for different switches
  • Added divider margin option:
    • parameter:
      • dividerMargin (optional, type double - default 8.0)
  • Made totalSwitches parameter optional.
  • Added new changes to customTextStyles:
    • list with only one TextStyle value will apply that TextStyle to all the active switches
  • Added new changes to customWidths:
    • customWidths can now reflect widths greater than device width
    • must use horizontal scroll view to prevent overflow

1.4.0 #

  • Minor bug fix (PR 44).
    • return null when active switch is de-activated by re-tapping
  • Added changes to fix radiusStyle bug when text direction is set to TextDirection.rtl
    • parameter:
      • textDirectionRTL (optional, type bool - default false)
  • Added custom widths support
    • parameter:
      • customWidths (optional, type List

1.3.0 #

  • Added null support for initialLabelIndex (PR 39).
  • Added double tap support to de-select/de-activate active switch (PR 41):
    • parameter:
      • doubleTapDisable (optional, type bool - default false)
  • Added animation duration support:
    • parameter:
      • animationDuration (optional, type int - default 800)
  • Added package test

1.2.0 #

  • Added custom icons support:
    • parameter:
      • customIcons (optional, type List
    • customIcons will overwrite 'icons:'

1.1.0 #

  • Added custom text styles support:
    • parameter:
      • customTextStyles (optional, type List
    • text style can now be configured for individual switches
  • Added text or icon support:
    • icons parameter now accepts null value (check examples)

1.0.0+1 #

  • Added total switches support:
    • parameter:
      • totalSwitches (required, type int)
  • Labels parameter is now optional.
  • Added border color and border width support:
    • parameters:
      • borderColor (optional, type List
      • borderWidth (optional, type double)
  • Added divider color support:
    • dividerColor (optional, type Color)
  • Added gradient colors support for active backgrounds:
    • activeBgColor and activeBgColors now take an array of Color instead of just Color (check examples)
    • parameters:
      • activeBgColor (optional, type List
      • activeBgColors (optional, type List<List
  • Added animation support:
    • parameters:
      • animate (optional, type bool):
        • with just animate set to true, default curve = Curves.easeIn
      • curve (optional, type Curve):
        • animate must be set to true when using custom curve
  • Added new active switch style based on corner radius:
    • parameter:
      • radiusStyle (optional, type bool)

0.1.9 #

  • Upgraded pre 1.12 flutter embedding in Android for example project (22d04ea).
  • Enabled AndroidX support for example project (3b62b21).
  • Migrated to strict null safety (bb24959).

0.1.8 #

  • Added left and right padding.
  • Added fixes to prevent overflow:
    • max widget width is calculated based on the number of labels/switches, minWidth and max screen width.
    • resize widgets to fit if user-provided size params exceed available width.

0.1.7 #

  • Added fix to programmatically change switch index (a04d62e).
  • Added changeOnTap option to enable/disable switch (a04d62e).

0.1.6 #

  • Made color parameters optional.
  • Use default theme color if color parameter is null/not provided.
  • Added additional gitignores for package.

0.1.5 #

  • Added minHeight, fontSize, iconSize support.
  • Added text overflow support.
  • Renamed arguments to make them more specific.
  • Added usage examples in Readme.

0.1.4 #

  • Added icons support.
  • Added different active background colors support.

0.1.1 ~ 0.1.3 #

  • Readme updates.

0.1.0 #

  • First version release.
pub points


verified publisher

Toggle Switch - A simple toggle switch widget. It can be fully customized with desired icons, width, colors, text, corner radius etc. It also maintains selection state.



API reference


Icon for licenses.MIT (LICENSE)




Packages that depend on toggle_switch