SmartSelect allows you to easily convert your usual form select or dropdown into dynamic page

Overview

Pub Version GitHub

Buy Me A Coffee

SmartSelect allows you to easily convert your usual form select or dropdown into dynamic page, popup dialog, or sliding bottom sheet with various choices input such as radio, checkbox, switch, chips, or even custom input. Supports single and multiple choice. Inspired by Smart Select component from Framework7.

What's New in Version 4.x.x

  • Customizable every part on modal widget (header, footer, searchbar, confirm button, searchbar toggle) using style configuration or widget builder
  • Validate before confirm
  • Auto search on type
  • Accent marks handler on search
  • Highlight search result
  • Chips tile widget
  • Grid choice layout
  • Horizotal or vertical choice list scroll direction
  • Simplify class name and enum
  • Configurations supports copyWith and merge
  • Use StatefulWidget as state management
  • Easy shortcut to define configuration
  • Soft depends to other package

To Do

  • Right-To-Left parameter support, currently this can be achieved using widget builder
  • Internally handle async choice items loader
  • Custom search handler
  • Choice items pagination (pull to refresh and pull to load more)
  • Add more test

Migration from 4.0.0 to 4.2.0

  • modalValidation function nows should return String to indicates the changes value is not valid and null or empty String to indicates the changes value is valid

  • To display tile with chips use param S2Tile.body and S2TileChips, instead of S2ChipsTile

Migration from 3.0.x to 4.0.0

  • The parameter options is removed, instead use choiceItems

  • Simplify class name and enum

    • SmartSelectTile to S2Tile
    • SmartSelectOption to S2Choice
    • SmartSelectChoiceConfig to S2ChoiceConfig
    • SmartSelectChoiceStyle to S2ChoiceStyle
    • SmartSelectChoiceType to S2ChoiceType
    • SmartSelectModalConfig to S2ModalConfig
    • SmartSelectModalStyle to S2ModalStyle
    • SmartSelectModalHeaderStyle to S2ModalHeaderStyle
    • SmartSelectModalType to S2ModalType
  • The parameter builder now is a collection of builder (S2SingleBuilder or S2MultiBuilder), instead use tileBuilder to create trigger tile widget.

  • The parameters dense, enabled, isLoading, isTwoLine, leading, loadingText, padding, selected, trailing is removed from SmartSelect class, instead use builder.tile or tileBuilder and return S2Tile widget, it's has all these parameters.

  • The parameter onChange nows return S2SingleState state or S2MultiState state instead of T value or List value

  • The parameter choiceConfig.useWrap is removed, instead use choiceConfig.layout = S2ChoiceLayout.wrap

  • The parameter choiceConfig.builder moved to builder.choice or choiceBuilder

  • The parameter choiceConfig.titleBuilder moved to builder.choiceTitle or choiceTitleBuilder

  • The parameter choiceConfig.subtitleBuilder moved to builder.choiceSubtitle or choiceSubtitleBuilder

  • The parameter choiceConfig.secondaryBuilder moved to builder.choiceSecondary or choiceSecondaryBuilder

  • The parameter choiceConfig.dividerBuilder moved to builder.choiceDivider or choiceDividerBuilder

  • The parameter choiceConfig.emptyBuilder moved to builder.choiceEmpty or choiceEmptybuilder

  • The parameter choiceConfig.glowingOverscrollIndicatorColor is removed, instead use choiceConfig.overscrollColor

  • The parameter choiceConfig.spacing and choiceConfig.runSpacing moved to choiceConfig.style.spacing and choiceConfig.style.runSpacing

  • The parameter choiceConfig.useCheckmark moved to choiceConfig.style.showCheckmark

  • The parameter choiceConfig.padding moved to choiceConfig.style.wrapperPadding

  • The default of grouped choice is not using sticky header now, instead use groupBuilder like this:

    dependencies:
      sticky_headers: "^0.1.8"
    import 'package:sticky_headers/sticky_headers.dart';
    
    SmartSelect<T>.single/multiple(
      ...,
      ...,
      choiceGroupBuilder: (context, header, choices) {
        return StickyHeader(
          header: header,
          content: choices,
        );
      },
    );

Preview

Single Choice Multiple Choice
Modal Type Single Choice Modal Multiple Choice Modal
Chips Widget Single Choice Chips Multiple Choice Chips
Switch Widget None Multiple Choice Switch
Custom Tile Customize Tile
Modal Filter Modal Filter
Modal Confirm Modal Confirm
Modal Validation Modal Validation
Modal Selector Modal Selector
Modal Shape Modal Shape
Choice Items Choice Items
Choice Grouped Choice Grouped
Choice Builder Choice Builder
Download APK Demo App

Features

  • Select single or multiple choice
  • Open choices modal in full page, bottom sheet, or popup dialog
  • Various choices input (radio, checkbox, switch, chips, or custom widget)
  • Various choices layout (list, wrap, or grid)
  • Grouping choices with easy support to sticky header
  • Searchable choices with highlighted result
  • Disabled or hidden choices
  • Customizable trigger/tile widget
  • Customizable modal style
  • Customizable modal header style
  • Customizable modal footer
  • Customizable choices style
  • Build choice items from any List
  • Easy load async choice items
  • and many more

Usage

For a complete usage, please see the example.

To read more about classes and other references used by smart_select, see the API Reference.

Single Choice

// available configuration for single choice
SmartSelect<T>.single({

  // The primary content of the widget.
  // Used in trigger widget and header option
  String title,

  // The text displayed when the value is null
  String placeholder = 'Select one',

  // The current value of the single choice widget.
  @required T value,

  // Called when single choice value changed
  @required ValueChanged<S2SingleState<T>> onChange,

  // choice item list
  List<S2Choice<T>> choiceItems,

  // other available configuration
  // explained below
  ...,
  ...,

})
// simple usage

String value = 'flutter';
List<S2Choice<String>> options = [
  S2Choice<String>(value: 'ion', title: 'Ionic'),
  S2Choice<String>(value: 'flu', title: 'Flutter'),
  S2Choice<String>(value: 'rea', title: 'React Native'),
];

@override
Widget build(BuildContext context) {
  return SmartSelect<String>.single(
    title: 'Frameworks',
    value: value,
    choiceItems: options,
    onChange: (state) => setState(() => value = state.value)
  );
}

Multiple Choice

// available configuration for multiple choice
SmartSelect<T>.multiple({

  // The primary content of the widget.
  // Used in trigger widget and header option
  String title,

  // The text displayed when the value is null
  String placeholder = 'Select one',

  // The current value of the single choice widget.
  @required List<T> value,

  // Called when single choice value changed
  @required ValueChanged<S2MultiState<T>> onChange,

  // choice item list
  List<S2Choice<T>> choiceItems,

  // other available configuration
  // explained below
  ...,
  ...,

})
// a simple usage

List<int> value = [2];
List<S2Choice<int>> frameworks = [
  S2Choice<int>(value: 1, title: 'Ionic'),
  S2Choice<int>(value: 2, title: 'Flutter'),
  S2Choice<int>(value: 3, title: 'React Native'),
];

@override
Widget build(BuildContext context) {
  return SmartSelect<int>.multiple(
    title: 'Frameworks',
    value: value,
    choiceItems: options,
    onChange: (state) => setState(() => value = state.value),
  );
}

Choices

// configuration
SmartSelect<T>.[single|multiple]({

  // other configuration
  ...,
  ...,

  // choice item list
  List<S2Choice<T>> choiceItems,

  // other configuration
  ...,
  ...,

});

choiceItems can be input directly as in the example below, more info about S2Choice can be found on the API Reference

SmartSelect<T>.[single|multiple](
  ...,
  ...,
  choiceItems: <S2Choice<T>>[
    S2Choice<T>(value: 1, title: 'Ionic'),
    S2Choice<T>(value: 2, title: 'Flutter'),
    S2Choice<T>(value: 3, title: 'React Native'),
  ],
);

choiceItems also can be created from any list using helper provided by this package, like the example below

List<Map<String, String>> days = [
  { 'value': 'mon', 'title': 'Monday' },
  { 'value': 'tue', 'title': 'Tuesday' },
  { 'value': 'wed', 'title': 'Wednesday' },
  { 'value': 'thu', 'title': 'Thursday' },
  { 'value': 'fri', 'title': 'Friday' },
  { 'value': 'sat', 'title': 'Saturday' },
  { 'value': 'sun', 'title': 'Sunday' },
];

SmartSelect<String>.[single|multiple](
  ...,
  ...,
  choiceItems: S2Choice.listFrom<String, Map<String, String>>(
    source: days,
    value: (index, item) => item['value'],
    title: (index, item) => item['title'],
  ),
);

Load Choice Item Asynchronously

Please follow these example

Modal Configuration

More info about S2ModalConfig can be found on the API Reference

// available configuration
SmartSelect<T>.[single|multiple]({

  // other configuration
  ...,
  ...,

  // Modal validation of single choice widget
  ValidationCallback<T> modalValidation,

  // Modal configuration
  S2ModalConfig modalConfig,

  // Configure modal style
  // shortcut to [modalConfig.style]
  S2ModalStyle modalStyle,

  // Configure modal header style
  // shortcut to [modalConfig.headerStyle]
  S2ModalHeaderStyle modalHeaderStyle,

  // Modal type to display choices
  // shortcut to [modalConfig.type]
  S2ModalType modalType,

  // Use different title with the trigger widget title
  // shortcut to [modalConfig.title]
  String modalTitle,

  // Whether the option list need to confirm
  // to return the changed value
  // shortcut to [modalConfig.useConfirm]
  bool modalConfirm,

  // Whether the options list modal use header or not
  // shortcut to [modalConfig.useHeader]
  bool modalHeader,

  // Whether the option list is filterable or not
  // shortcut to [modalConfig.useFilter]
  bool modalFilter,

  // Whether the filter is autocomplete or need confirmation
  // shortcut to [modalConfig.filterAuto]
  bool modalFilterAuto,

  // Custom searchbar hint
  // shortcut to [modalConfig.filterHint]
  String modalFilterHint,

  // other configuration
  ...,
  ...,

});

Modal Type

By default SmartSelect will open choices modal in full page. You can change it by changing with this value:

// Available option
enum S2ModalType {

  // open in full page
  fullPage,

  // open in popup dialog
  popupDialog,

  // open in sliding bottom sheet
  bottomSheet,

}

Modal Style

// Available option to configure modal style
S2ModalStyle({

  // Modal border shape
  // used in popup dialog and bottom sheet
  ShapeBorder shape,

  // Modal elevation
  // used in popup dialog and bottom sheet
  double elevation,

  // Modal background color
  Color backgroundColor,

  // Modal clip behavior
  Clip clipBehavior,

})

Modal Header Style

// Available option to configure modal header style
S2ModalHeaderStyle({

  // Header border shape
  ShapeBorder shape,

  // Header elevation
  double elevation,

  // Header background color
  Color backgroundColor,

  // Header brightness
  Brightness brightness,

  // Whether the header title is centered
  bool centerTitle,

  // Whether the header use automaticallyImplyLeading or not
  bool useLeading,

  // Header text style
  // used by title and search field
  TextStyle textStyle,

  // Header icon theme
  IconThemeData iconTheme,

  // Header actions icon theme
  IconThemeData actionsIconTheme,

})

Choices Configuration

More info about S2ChoiceConfig can be found on the API Reference

// Available option to configure choices
SmartSelect<T>.[single|multiple]({

  // other configuration
  ...,
  ...,

  // choice configuration
  S2ChoiceConfig choiceConfig,

  // configure choice style
  // shortcut to [choiceConfig.style]
  S2ChoiceStyle choiceStyle,

  // configure choices group header style
  // shortcut to [choiceConfig.headerStyle]
  S2ChoiceHeaderStyle choiceHeaderStyle,

  // choice widget type
  // shortcut to [choiceConfig.type]
  S2ChoiceType choiceType,

  // choice layout to display items
  // shortcut to [choiceConfig.layout]
  S2ChoiceLayout choiceLayout,

  // choice list scroll direction
  // currently only support when
  // [layout] is [S2ChoiceLayout.wrap]
  // shortcut to [choiceConfig.direction]
  Axis choiceDirection,

  // Whether the choices list is grouped
  // shortcut to [choiceConfig.isGrouped]
  bool choiceGrouped,

  // Whether the choices item use divider or not
  // shortcut to [choiceConfig.useDivider]
  bool choiceDivider,

  // For grid choice layout
  // shortcut to [choiceConfig.gridDelegate]
  SliverGridDelegate choiceGrid,

  // other configuration
  ...,
  ...,

});

Choice Type

By default SmartSelect will use radios for single choice and checkboxes for multiple choice, but it can change by changing with this value:

// Type of choice input
enum S2ChoiceType {

  // use radio widget
  // for single choice
  radios,

  // use checkbox widget
  // for multiple choice
  checkboxes,

  // use switch widget
  // for multiple choice
  switches,

  // use chip widget
  // for single and multiple choice
  chips,

}

Choice Layout

By default SmartSelect will use list, but it can change by changing with this value:

// Layout of choice item
enum S2ChoiceLayout {

  // use list view widget
  list,

  // use wrap view widget
  wrap,

  // use grid view widget
  grid,

}

Choice Styles

// Available option to configure choice style
S2ChoiceStyle({

  // How much space to place between children in a run in the main axis.
  // When use [SmartSelectChoiceType.chips] or [useWrap] is [true]
  double spacing,

  // How much space to place between the runs themselves in the cross axis.
  // When use [SmartSelectChoiceType.chips] or [useWrap] is [true]
  double runSpacing,

  // choices wrapper padding
  EdgeInsetsGeometry wrapperPadding,

  // Choices item padding
  EdgeInsetsGeometry padding,

  // choices item title style
  TextStyle titleStyle,

  // choices item subtitle style
  TextStyle subtitleStyle,

  // whether the chips use checkmark or not
  bool showCheckmark,

  // Where to place the control in widgets that use
  // [ListTile] to position a control next to a label.
  S2ChoiceControl control,

  // Highlight color
  Color highlightColor,

  // Primary color of selected choice item
  Color activeColor,

  // Primary color of unselected choice item
  Color color,

  // Secondary color of selected choice item
  Color activeAccentColor,

  // Secondary color of unselected choice item
  Color accentColor,

  // Brightness for selected Chip
  Brightness activeBrightness,

  // Brightness for unselected Chip
  Brightness brightness,

  // Opacity for selected Chip border, only effect when
  // [activeBrightness] is [Brightness.light]
  double activeBorderOpacity,

  // Opacity for unselected chip border, only effect when
  // [brightness] is [Brightness.light]
  double borderOpacity,

  // Shape clip behavior
  Clip clipBehavior,

})

Choice Header Style

// Available option to configure choices group header widget style
S2ChoiceHeaderStyle({

  // Group header background color
  Color backgroundColor,

  // Highlight color
  Color highlightColor,

  // Group header text style
  TextStyle textStyle,

  // Group header padding
  EdgeInsetsGeometry padding,

  // Group header height
  double height,

})

Builder Widget

Builder for Single Choice

// available builder configuration
// for single choice
SmartSelect<T>.single({

  // other configuration
  ...,
  ...,

  // Builder collection of single choice widget
  S2SingleBuilder<T> builder,

  // Builder for custom tile widget
  // shortcut to [builder.tile]
  S2WidgetBuilder<S2SingleState<T>> tileBuilder,

  // Builder for custom modal widget
  // shortcut to [builder.modal]
  S2WidgetBuilder<S2SingleState<T>> modalBuilder,

  // Builder for custom modal header widget
  // shortcut to [builder.modalHeader]
  S2WidgetBuilder<S2SingleState<T>> modalHeaderBuilder,

  // Builder for custom modal actions widget
  // shortcut to [builder.modalActions]
  S2ListWidgetBuilder<S2SingleState<T>> modalActionsBuilder,

  // Builder for custom modal confirm action widget
  // shortcut to [builder.modalConfirm]
  S2WidgetBuilder<S2SingleState<T>> modalConfirmBuilder,

  // Builder for divider widget between header, body, and footer modal
  // shortcut to [builder.modalDivider]
  S2WidgetBuilder<S2SingleState<T>> modalDividerBuilder,

  // Builder for custom footer widget
  // shortcut to [builder.modalFooter]
  S2WidgetBuilder<S2SingleState<T>> modalFooterBuilder,

  // other configuration
  ...,
  ...,

});

Builder for Multiple Choice

// available builder configuration
// for multiple choice
SmartSelect<T>.multiple({

  // other configuration
  ...,
  ...,

  // Builder collection of single choice widget
  S2MultiBuilder<T> builder,

  // Builder for custom tile widget
  // shortcut to [builder.tile]
  S2WidgetBuilder<S2MultiState<T>> tileBuilder,

  // Builder for custom modal widget
  // shortcut to [builder.modal]
  S2WidgetBuilder<S2MultiState<T>> modalBuilder,

  // Builder for custom modal header widget
  // shortcut to [builder.modalHeader]
  S2WidgetBuilder<S2MultiState<T>> modalHeaderBuilder,

  // Builder for custom modal actions widget
  // shortcut to [builder.modalActions]
  S2ListWidgetBuilder<S2MultiState<T>> modalActionsBuilder,

  // Builder for custom modal confirm action widget
  // shortcut to [builder.modalConfirm]
  S2WidgetBuilder<S2MultiState<T>> modalConfirmBuilder,

  // Builder for divider widget between header, body, and footer modal
  // shortcut to [builder.modalDivider]
  S2WidgetBuilder<S2MultiState<T>> modalDividerBuilder,

  // Builder for custom footer widget
  // shortcut to [builder.modalFooter]
  S2WidgetBuilder<S2MultiState<T>> modalFooterBuilder,

  // other configuration
  ...,
  ...,

});

Other Builder

// another builder configuration
SmartSelect<T>.[single|multiple]({

  // other configuration
  ...,
  ...,

  // Builder for modal filter widget
  // shortcut to [builder.modalFilter]
  S2WidgetBuilder<S2Filter> modalFilterBuilder,

  // Builder for modal filter toggle widget
  // shortcut to [builder.modalFilterToggle]
  S2WidgetBuilder<S2Filter> modalFilterToggleBuilder,

  // Builder for each custom choices item widget
  // shortcut to [builder.choice]
  S2ChoiceBuilder<T> choiceBuilder,

  // Builder for each custom choices item title widget
  // shortcut to [builder.choiceTitle]
  S2ChoiceBuilder<T> choiceTitleBuilder,

  // Builder for each custom choices item subtitle widget
  // shortcut to [builder.choiceSubtitle]
  S2ChoiceBuilder<T> choiceSubtitleBuilder,

  // Builder for each custom choices item secondary widget
  // shortcut to [builder.choiceSecondary]
  S2ChoiceBuilder<T> choiceSecondaryBuilder,

  /// Builder for custom divider widget between choices item
  // shortcut to [builder.choiceDivider]
  IndexedWidgetBuilder choiceDividerBuilder,

  // Builder for custom empty display
  // shortcut to [builder.choiceEmpty]
  S2WidgetBuilder<String> choiceEmptyBuilder,

  // A widget builder for custom choices group
  // shortcut to [builder.choiceGroup]
  S2ChoiceGroupBuilder choiceGroupBuilder,

  // A widget builder for custom header choices group
  // shortcut to [builder.choiceHeader]
  S2ChoiceHeaderBuilder choiceHeaderBuilder,

  // other configuration
  ...,
  ...,

});

Tile Widget

Default Tile

// Default tile/trigger widget
S2Tile<T>({

  // The value of the selected option.
  String value,

  // The primary content of the list tile.
  Widget title,

  // A widget to display before the title.
  // Typically an [Icon] or a [CircleAvatar] widget.
  Widget leading,

  // A widget to display after the title.
  // Typically an [Icon] widget.
  Widget trailing,

  // Whether this list tile is intended to display loading stats.
  bool isLoading,

  // String text used as loading text
  String loadingText,

  // Whether this list tile is intended to display two lines of text.
  bool isTwoLine,

  // Whether this list tile is interactive.
  bool enabled,

  // If this tile is also [enabled] then icons and text are rendered with the same color.
  bool selected,

  // Whether this list tile is part of a vertically dense list.
  bool dense,

  // Whether the [value] is displayed or not
  bool hideValue,

  // The tile's internal padding.
  EdgeInsetsGeometry padding,

  // Called when the user taps this list tile.
  GestureTapCallback onTap,

  // widget to display below the tile
  // usually used to display chips with S2TileChips
  Widget body,

})
// usage example
SmartSelect<T>.single(
  ...,
  ...,
  tileBuilder: (context, state) {
    return S2Tile(
      title: state.titleWidget,
      value: state.valueDisplay,
      onTap: state.showModal,
      isLoading: true,
    );
  },
);

// usage example from state
SmartSelect<T>.multiple(
  ...,
  ...,
  tileBuilder: (context, state) {
    return S2Tile.fromState(
      state,
      isLoading: true,
    );
  },
);

Tile With Chips

// Chips tile/trigger widget
S2TileChips({

  // List of value of the selected choices.
  int chipLength,

  // Widget builder for chip label item
  IndexedWidgetBuilder chipLabelBuilder,

  // Widget builder for chip avatar item
  IndexedWidgetBuilder chipAvatarBuilder,

  // Widget builder for chip item
  IndexedWidgetBuilder chipBuilder,

  // Called when the user delete the chip item.
  ValueChanged<int> chipOnDelete,

  // Chip color
  Color chipColor,

  // Chip border opacity
  double chipBorderOpacity,

  // Chip brightness
  Brightness chipBrightness,

  // Chip delete button color
  Color chipDeleteColor,

  // Chip delete button icon
  Icon chipDeleteIcon,

  // Chip spacing
  double chipSpacing,

  // Chip run spacing
  double chipRunSpacing,

  // Chip shape border
  ShapeBorder chipShape,

  // The [Widget] displayed when the [values] is null
  Widget placeholder,

  // Whether the chip list is scrollable or not
  bool scrollable,

  // Chip list padding
  EdgeInsetsGeometry padding,

})
/// usage example
SmartSelect<String>.multiple(
  ...,
  ...,
  value: users,
  tileBuilder: (context, state) {
    return S2Tile.fromState(
      state,
      hideValue: true,
      body: S2TileChips(
        chipLength: state.valueObject.length,
        chipLabelBuilder: (context, i) {
          return Text(state.valueObject[i].title);
        },
        chipAvatarBuilder: (context, i) {
          return CircleAvatar(
            backgroundImage: NetworkImage(state.valueObject[i].meta['picture']['thumbnail'])
          );
        },
        chipOnDelete: (i) {
          setState(() => users.remove(state.valueObject[i].value));
        },
        chipColor: Colors.blue,
        chipBrightness: Brightness.dark,
        chipBorderOpacity: .5,
      ),
    );
  },
);

License

Copyright (c) 2020 Irfan Vigma Taufik

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Comments
  • validation not worked on single select

    validation not worked on single select

    [✓] Flutter (Channel master, 1.22.0, on Mac OS X 10.14.6 18G6020, locale ru-RU) • Flutter version 1.22.0 at /usr/local/lib/flutter • Framework revision fd80503fd3 (3 months ago), 2020-07-10 14:41:02 +0530 • Engine revision 9b3e3410f0 • Dart version 2.9.0 (build 2.9.0-20.0.dev 06cb010247)

    smart_select: ^4.2.0

                SmartSelect<String>.single(
                    modalType: S2ModalType.bottomSheet,
                    title: "Wishes",
                    value: wish,
                    modalValidation: (value) => (value == null || value.isEmpty)
                        ? "Choose your wish"
                        : null,
                    placeholder: "Select wish",
                    onChange: (state) => wish = state.value,
                    choiceItems: wishItems)
    

    Expect behavior that we cannot close this bottom sheet without choose a value - but when i open this select, not choose, and close - validation not worked (select closed without any message)

    opened by Slava96 8
  • how to change font size for title

    how to change font size for title

    I'm having trouble changing the font size of the title. I tried changing the font size of the modal header but that does not change the font size of the title. Any help will be really appreciated. Thanks.

    Padding( padding: const EdgeInsets.only(top: 35.0), child: SmartSelect.single( title: "House Type", //i want to change the font size of this on the form value: this._houseType, options: options.houseType, onChange: (val) => setState(() => this._houseType = val), modalType: SmartSelectModalType.bottomSheet, modalConfig: SmartSelectModalConfig( headerStyle: SmartSelectModalHeaderStyle( textStyle: TextStyle( fontSize: 28.0 ) ) ) ), ),

    opened by serahzaveri 7
  • Accents and filter

    Accents and filter

    Hi I want to start by saying, smart_select is awesome, thanks for this helpful package!

    When it's filtering and the query or result item have and accent mark, nothing returns. I don't know if this is an expected behaviour but I think I fixed it in https://github.com/pblinux/flutter_smart_select/tree/accents. Can I make pull request of this?

    Also, I needed to filtering be auto. https://github.com/pblinux/flutter_smart_select/tree/autofilter Would this be something useful?

    Thanks.

    opened by pblinux 5
  • add option for providing custom header actions

    add option for providing custom header actions

    In our project we need the ability to provide custom actions to our bottom sheet modals. This is probably the only feature that this awesome library did not implement, so I felt like contributing my attempt at the implementation of that feature.

    The code is simple enough. However, you have a better overview over the codebase and know what I missed and/or didn't take into consideration.

    Feel free to point out any changes you feel like I should be making.
    Or, alternatively I have no issues with you closing this PR and doing your own implementation.
    Obviously, if you feel like this feature shouldn't be supported at all, you're also free to reject this. It's just that we really need this ability to customize the actions there.

    Here's one example for how we're using it:

    smart_select_header

    Thanks for the great library, by the way. You really took into account nearly every possible use case!

    [EDIT]
    There have been some auto-format changes. To be clear, the only relevant changes are:

    • modal_header.dart: 84-92 + 105
    • modal_config.dart: 31-33 + 55
    • modal_theme.dart: 52-54 + 65
    opened by SvenSchoene 4
  • Can't find a way to adjust font size for title.

    Can't find a way to adjust font size for title.

    Since the title is expecting a String, I was hoping if you can change it to accept Text so the the title can be styled.

    Right now the title when on an AlertDialog/Popup could be around 20 or 24.

    opened by rhyscoronado 4
  • Error in null saftey for change

    Error in null saftey for change

    onChange : (selected){

    } while changing [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: type '(S2SingleSelected) => void' is not a subtype of type '((S2SingleSelected<String?>) => void)?'

    E/flutter (10308): #0 S2SingleState.onChange package:smart_select/src/widget.dart:1709

    E/flutter (10308): #1 S2State.showModal package:smart_select/src/widget.dart:1630

    opened by bibekmakaju 3
  • This application cannot tree shake icons fonts when build

    This application cannot tree shake icons fonts when build

    Hi, thanks for your great package, I just upgrade to the latest version(4.2.0), an exception when build the appbundle, it says.

    This application cannot tree shake icons fonts. It has non-constant instances of IconData at the following locations:
      - file:///Users/xxxxx/development/tools/flutter/.pub-cache/hosted/pub.dartlang.org/smart_select-4.2.0/lib/src/choices_empty.dart:17:15
    

    I using --no-tree-shake-icons flag to avoid this error at the moment, hope will fix in next version, thanks.

    opened by harrykc 3
  • Customizing SmartSelectOption

    Customizing SmartSelectOption

    Such a feature rich package. Thanks! However, it would be nice to be able to customize each list option. Why not implement a child parameter or make the required title parameter accept a type of Widget instead of just a String.

    opened by antonbt 3
  • Testing the component

    Testing the component

    Hi man, first of all great package, thanks for you work.

    I saw that the package is not tested, so i want to test the component on my side.

    Right now i can't test the onChange callback for example.

    It would help me a lot if you could export ChoicesItem for example, so i can test the stuff.

    opened by rodrigobastosv 3
  • Confirmation override

    Confirmation override

    I am trying to customize the confirmation widget using confirmationBuilder but I can't seem to get the right syntax. Is there an example anywhere that does this?

    https://pub.dev/documentation/smart_select/latest/smart_select/SmartSelectModalConfirmationBuilder.html

    Here is what I am attempting:

    modalConfig: SmartSelectModalConfig(
      useConfirmation: true,
      confirmationBuilder: (context, () {
        return InkWell(
          child: Text('Send'),
          onTap: () {},
        );
      })
    ),
    
    opened by brettpappas 3
  • I need to change value color

    I need to change value color

    Widget get _valueWidget {
        return Text(
          isLoading ? loadingText : value,
          style: const TextStyle(color: Colors.grey),
          overflow: TextOverflow.ellipsis,
          maxLines: 1,
        );
      }
    

    why doesnt optional color

     Widget get _valueWidget {
        return Text(
          isLoading ? loadingText : value,
          style:  TextStyle(color: ListTileTheme.of(context).textColor),
          overflow: TextOverflow.ellipsis,
          maxLines: 1,
        );
      }
    
    opened by Osmancn 2
  • smart_select: ^4.3.2 package error

    smart_select: ^4.3.2 package error

    ../../src/flutter_windows_3.0.1-stable/flutter/.pub-cache/hosted/pub.dartlang.org/smart_select-4.3.2/lib/src/widget.dart:833:20: Error: The getter 'FlatButton' isn't defined for the class 'S2State'.

    • 'S2State' is from 'package:smart_select/src/widget.dart' ('../../src/flutter_windows_3.0.1-stable/flutter/.pub-cache/hosted/pub.dartlang.org/smart_select-4.3.2/lib/src/widget.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'FlatButton'. child: FlatButton.icon( ^^^^^^^^^^ ../../src/flutter_windows_3.0.1-stable/flutter/.pub-cache/hosted/pub.dartlang.org/smart_select-4.3.2/lib/src/widget.dart:851:20: Error: The method 'FlatButton' isn't defined for the class 'S2State'.
    • 'S2State' is from 'package:smart_select/src/widget.dart' ('../../src/flutter_windows_3.0.1-stable/flutter/.pub-cache/hosted/pub.dartlang.org/smart_select-4.3.2/lib/src/widget.dart'). Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'.
      child: FlatButton( ^^^^^^^^^^

    FAILURE: Build failed with an exception.

    • Where: Script 'C:\shubham\src\flutter_windows_3.0.1-stable\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159

    • What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.

    Process 'command 'C:\shubham\src\flutter_windows_3.0.1-stable\flutter\bin\flutter.bat'' finished with non-zero exit value 1

    • Try:

    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    • Get more help at https://help.gradle.org

    Running Gradle task 'assembleDebug'... 204.9s Exception: Gradle task assembleDebug failed with exit code 1

    opened by shubhamdtalekar 3
  • Add new Item into list

    Add new Item into list

    I am using single modal select. Now client want to add item if there is no specific item in list. If user add the new item and then auto selected that newly added item. Is there a way to integrate with this control.

    opened by alexaung 2
  • Change the value of the selected option from String to Text Widget

    Change the value of the selected option from String to Text Widget

    Hello,

    I want to ask for a change in tile.dart for class S2Tile from

        /// The value of the selected option.
        final String value; 
    

    to

        final Widget value;
    

    and further dependent adaptions to have the same customization options available as for

        /// The primary content of the list tile.
        final Widget title;
    
    Bildschirmfoto 2021-08-09 um 21 19 56

    for now I have to edit _valueWidge{} within tile.dart to handle long text to 2 lines when overflow or set font size to get every option into single line. So I would like to have an option to customize it inside my project. Bildschirmfoto 2021-08-09 um 21 25 39 Bildschirmfoto 2021-08-09 um 21 25 59

    Widget get _valueWidget {
        return Text(
          isLoading ? loadingText : value,
          style: const TextStyle(color: Colors.grey, fontSize: 26.0),
          overflow: TextOverflow.fade,
          softWrap: true,
          maxLines: 2,
        );
      }
    
    opened by maikksmt 1
  • Allow useRootNavigator as a config

    Allow useRootNavigator as a config

    I believe that allowing useRootNavigator as a config would benefit the component.

    This would be useful if we want to show the modal on top of a bottom navigator bar for example.

    I saw that on the code you have this:

     confirmed = await showModalBottomSheet(
              context: context,
              shape: modalStyle.shape,
              clipBehavior: modalStyle.clipBehavior ?? Clip.none,
              backgroundColor: modalStyle.backgroundColor,
              elevation: modalStyle.elevation,
              isDismissible: modalConfig.barrierDismissible,
              barrierColor: modalConfig.barrierColor,
              enableDrag: modalConfig.enableDrag,
              builder: (_) => modal,
            );
    

    So maybe it is just an extra config for the useRootNavigator as a default false.

    What do you think?

    opened by leonardoj-cit 1
Releases(v4.0.0)
  • v4.0.0(Sep 23, 2020)

    • Validate before confirm
    • Auto search on type
    • Accent marks handler on search
    • Highlight search result
    • New Chips tile widget
    • Horizotal or vertical choice list scroll direction
    • Use StatefulWidget instead of Provider as state management
    • Configuration supports copyWith and merge
    • Easy shortcut to define configuration
    • Simplify class name and enum
    • Removed sticky_headers package, provide simple API to easy implement sticky header
    • Choice text and group header text highlight on filter
    • Customizable choice layout and scroll direction
    • Customizable every part on modal widget (header, footer, searchbar, confirm button, searchbar toggle)
    • Choice select all/none, and provide an easy way to programmatic select
    • New Modal barrier color and dissmisible configuration
    • And many more useful configuration, please see the API documentation
    Source code(tar.gz)
    Source code(zip)
  • v3.0.2(Jan 24, 2020)

    • Support disabled and hidden option
    • Customizable choices wrapper padding
    • Single choice chips now use checkmark by default, can be configure by choiceConfig.useCheckmark
    • Improve documentation
    • Update example
    Source code(tar.gz)
    Source code(zip)
  • v3.0.0(Jan 22, 2020)

    • Breaking changes, more type safety, add more features, and simplify few properties
    • Remove isMultiChoice property, instead use SmartSelect<T>.single() or SmartSelect<T>.multiple()
    • Remove option property, instead use options property and change its value from SmartSelectOptionConfig to List<SmartSelectOption<T>>
    • Remove modal property, instead use modalType to change how to open modal and modalConfig to configure modal header, modal style, etc
    • Remove choice property, instead use choiceType to change choice widget and choiceConfig to configure choice style, etc
    • Choice modal can have different title with trigger/tile widget by configuring modalConfig.title
    • Choice modal can have leading and trailing widget by configuring modalConfig.leading and modalConfig.trailing
    Source code(tar.gz)
    Source code(zip)
A custom dropdown button lets the user select from a number of items

CircularDropDownMenu Description A custom dropdown button lets the user select from a number of items. The button shows the currently selected item as

Surya Dev Singh 2 Dec 5, 2020
Multi select flutter tejpal - A package for creating multi-select widgets in a variety of ways

Multi select flutter tejpal - A package for creating multi-select widgets in a variety of ways

Tejpal Singh 3 Jul 11, 2022
Flutter widget form select a date in horizontal timeline with customizable styles.

Flutter widget form select a date in horizontal timeline with customizable styles. Getting Started You can use this package when you need to add a dat

Jose Manuel Márquez 158 Dec 2, 2022
Making-form - A form design with dart programming and auto next facility

Making-form - A form design with dart programming and auto next facility

Munem Sarker 3 Nov 15, 2022
An alternative to Overlay which allows you to easily render and hit test a widget outside its parent bounds

An alternative to Overlay which allows you to easily render and hit test a widget outside its parent bounds. Based on the original idea by @shrouxm he

gskinner team 26 Dec 31, 2022
Widget to let the user search through a keyword string typed on a customizable keyboard in a single or multiple choices list presented as a dropdown in a dialog box or a menu.

searchable_dropdown Widget to let the user search through a keyword string typed on a customizable keyboard in a single or multiple choices list prese

Bobby Stenly Irawan 108 Sep 11, 2022
A simple Flutter widget library that helps us to select days in a week.

A simple Flutter widget library that helps us to select days in a week.

Shan Shaji 4 Oct 9, 2022
Cupertino buttons which are used as radio buttons in order to select one value

Flutter Cupertino Radio Choice Cupertino buttons which are used as radio buttons in order to select one value. Tutorial A complete tutorial how to use

Christoph Rothermel 4 Sep 18, 2022
A flutter package to select a country from a list of countries.

Country picker A flutter package to select a country from a list of countries. Getting Started Add the package to your pubspec.yaml: country_picker: ^

Daniel Ioannou 60 Dec 30, 2022
Plugin to the JSON Dynamic Widget to provide named support for Ionicons

json_dynamic_widget_plugin_ionicons Table of Contents Live Example Introduction Using the Plugin Live Example Web Introduction Plugin to the JSON Dyna

null 0 May 14, 2022
Main focus is to show dynamic operation not supported in Stateless Widget of Flutter

A new Flutter project. It will count the number of donut(Though increment doesnot take place Stateless Widget). Main focus is to show dynamic operation not supported in Stateless Widget of Flutter.

Avinandan Bose 2 Sep 9, 2022
Simple form maker for Flutter Framework

Flutter FormBuilder - flutter_form_builder This package helps in creation of data collection forms in Flutter by removing the boilerplate needed to bu

Danvick Miller 1.2k Jan 3, 2023
Flutter Credit Card Input form

This package provides visually beautiful UX through animation of credit card information input form. Preview Installing Add dependency to pubspec.yaml

Jeongtae Kim 426 Jan 5, 2023
A Flutter widget to show a text form field to display a date or clock dialog

A Flutter widget to show a text form field to display a date or clock dialog. This widget extend TextField and has a similar behavior as TextFormField.

m3uzz Soluções em TI 82 Jan 6, 2023
The flutter_otp_text_field package for flutter is a TextField widget that allows you to display different style pin.

flutter_otp_text_field flutter_otp_text_field The flutter_otp_text_field package for flutter is a TextField widget that allows you to display differen

David-Legend 30 Nov 8, 2022
Responsive Widgets Prefix allows you to add the "Responsive" prefix to any widget that needs scaling or font size increases

Responsive Widgets Prefix allows you to add the Responsive prefix to any widget that needs scaling or font size increases (for varying device screen sizes).

The Mobile Applications Community 2 Apr 18, 2022
An extensive snap tool/widget for Flutter that allows very flexible snap management and snapping between your widgets.

An extensive snap tool/widget for Flutter that allows very flexible snap management and snapping between your widgets.

AliYigitBireroglu 101 Dec 16, 2022
Helps to turn some popular widgets into Neumorphism style

Helps to turn some popular widgets into Neumorphism style. Features NeumorphicCard: a card with Neumorphism look and feel NeumorphicButton: implements

MinhHo 6 Jun 27, 2022
A library to easily create radio button and checkbox groups.

Check/Radio Group A library to easily create radio button and checkbox groups. Define font size, selection color, position of radios / check and text

Caiubi Tech 2 Jan 6, 2021