Giter Site home page Giter Site logo

ecrax / category_picker Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 2.0 270 KB

An input widget to handle selection of category like choices.

Home Page: https://pub.dev/packages/category_picker

License: GNU General Public License v3.0

Kotlin 1.03% Swift 3.36% Objective-C 0.32% Dart 95.30%
flutter flutter-package category-picker dart dartlang widget input

category_picker's Introduction

category_picker

An input widget to handle selection of category like choices.

Usage

To use this widget simply add category_picker as a dependency to your project in the pubspec.yaml file and import it if needed.

Example

(Barebone)

import 'package:category_picker/category_picker.dart';
import 'package:category_picker/category_picker_item.dart';
@override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: CategoryPicker(
          items: [
            CategoryPickerItem(
              value: "Test",
            ),
            CategoryPickerItem(
              value: "Test2",
            ),
            CategoryPickerItem(
              value: "Test3",
            ),
          ],
          onValueChanged: (value) {
            print(value.label);
          },
        ),
      ),
    );
  }

A more detailed example is available in the example folder

CategoryPickerItem() parameters

PropName Description Default value
isSelected Determines if the item is currently selected false (not in constructor)
value The value of the item required
label String to be displayed on the item itself String value of value if null

CategoryPicker() parameters

PropName Description Default value
items List of children to be displayed required
defaultSelected Default selected item in range of 0 - items.length 0
onValueChanged Callback with entire item when user switches selection. () => {}
backgroundColor Background color of entire category picker Colors.transparent
selectedItemColor Background color of selected item Theme.of(context).accentColor
unselectedItemColor Background color of all items that are not selected Colors.transparent
selectedItemBorderColor Border color of the selected item Colors.transparent
unselectedItemBorderColor Border color of all unselected items Colors.grey[800]
selectedItemTextDarkThemeColor Text color of the text for light theme inside an item while selected Colors.white
selectedItemTextLightThemeColor Text color of the text for light theme inside an item while not selected Colors.black
unselectedItemTextDarkThemeColor Text color of the text for dark theme inside an item while selected Colors.white
unselectedItemTextLightThemeColor Text color of the text for dark theme inside an item while not selected Colors.white
itemBorderRadius Border radius for all items BorderRadius.circular(30)
itemHeight Height of all items 32.0
itemLabelFontSize Font size of the text inside of all items 16.0
categoryPickerMargin Margin of the entire category picker EdgeInsets.symmetric(vertical: 11)
categoryPickerPadding Padding of the entire category picker EdgeInsets.symmetric(horizontal: 16, vertical: 8)
itemMargin Margin applied to each individual item EdgeInsets.symmetric(horizontal: 4)
itemPadding Padding applied to each individual item EdgeInsets.symmetric(horizontal: 12)

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.