पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

choice कवर
पैकेज विवरणv2.3.2

choice

स्मार्ट सेलेक्ट और चिप्स_चॉइस का उत्तराधिकारी, एकल या बहु-चयन के साथ आंतरिक या प्रेरित चयन विजेट बनाने के लिए साफ, अधिक लचीला और रचनात्मक API।

AndroidiOSWebmacOSWindowsLinux
30-दिन डाउनलोड
14 हज़ार
लाइक
143
Pub अंक
150

पैकेज इंस्टॉल करें

flutter pub add choice

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

Choice एक आधुनिक Flutter पैकेज है जो लचीले, संयोज्य चयन विकल्प बनाने के लिए डिज़ाइन किया गया है, जिसमें एकल और बहु-चयन का समर्थन है। इसने पुराने पैकेज जैसे smart_select और chips_choice को बदल दिया है, जो आंतरिक या प्रेरित चयन इंटरफेस के लिए एक साफ एपीआई प्रदान करता है। फॉर्म, फ़िल्टर और टैग-आधारित इनपुट के लिए उपयुक्त, यह प्लेटफॉर्म के बीच एक स्थिर और कस्टमाइज़ किया जा सकने वाला अनुभव प्रदान करता है। पैकेज विकासकर्ता की उपयोगकर्ता अनुभव और UI लचीलेपन पर जोर देता है, जिससे विभिन्न ऐप डिज़ाइन में आसानी से एकीकरण संभव होता है।

उपयोग

  • चयन करने योग्य विकल्प वाले फॉर्म इनपुट
  • फ़िल्टरिंग इंटरफ़ेस
  • टैग-आधारित डेटा इनपुट
  • गतिशील चयन सूची
  • उपयोगकर्ता प्राथमिकता चयन
  • बहु-चयन ड्रॉपडाउन

मुख्य विशेषताएँ

  • स्पष्ट और सुव्यवस्थित API
  • एकल और बहुचयन का समर्थन
  • लचीले इनलाइन या प्रॉम्प्टेड लेआउट
  • उच्च रूप से कस्टमाइज़ किया गया दिखावट
  • क्रॉस-प्लेटफॉर्म संगतता
  • योजना योग्य उपकरण डिज़ाइन

इनके लिए उपयुक्त

  • पुराने चयन पैकेज के आधुनिक विकल्प खोज रहे विकासकर्ता
  • गतिशील, पुनर्उपयोगी चयन घटकों की आवश्यकता वाले ऐप्स
  • यूआई सुसंगतता और रखरखाव पर जोर देने वाले प्रोजेक्ट
  • डेवलपर अनुभव और कोड स्पष्टता को प्राथमिकता देने वाली टीमें
  • जटिल फ़िल्टरिंग या टैगिंग की आवश्यकता वाले अनुप्रयोग

विचार योग्य बातें

  • Flutter के विजेट संयोजन की समझ की आवश्यकता है
  • जटिल थीम के लिए अतिरिक्त स्टाइलिंग की आवश्यकता हो सकती है
  • परिपक्व पैकेज की तुलना में सीमित दस्तावेज़
  • अक्सर उपयोगकर्ता चयन के लिए सबसे उपयुक्त
  • बिना इंटरैक्टिविटी के सरल स्थिर विकल्पों के लिए उपयुक्त नहीं

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

Pub Version GitHub GitHub GitHub

The successor to smart_select and chips_choice with cleaner, more flexible, and composable API for creating inline or prompted choice widgets with single or multiple selection.

Features

  • Cleaner, flexible, and composable API
  • Inline or prompted choice widget
  • Single or multiple choice widget
  • Searchable choice items with highlighted result
  • Specifies whether the choice selection needs to be confirmed
  • Use any type of choice data and load it easily, either synchronously or asynchronously
  • Build your own choice item that fits your needs
  • Groupable choice items that can be sorted
  • Supports leading and trailing choice items, as well as divider choice items
  • Use a predefined wrapped, scrollable, virtualized choice list, or build one that fits your needs
  • Use a predefined popup dialog, bottom sheet, new page prompt, or build one that fits your needs
  • Use a predefined modal header, footer, and separator, or build one that fits your needs
  • Use a predefined group list, group item, and group header, or build one that fits your needs
  • Use a predefined anchor widget or build one that fits your needs
  • Use a predefined widget on loading, on error, and placeholder when empty, or build one that fits your needs

Usage

For a complete usage, please see the example.

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

Single Choice

Preview

There are a few constructors to create a single selection choice widget:

By default, the choice controller maintains the selection state within a List. Any constructors other than those dedicated to single choice will have a List<T> for their value and onChanged prop. If we want to use a single value of T, we can use ChoiceSingle.value adapter to fill the value prop and ChoiceSingle.onChanged adapter to fill the onChanged prop.

Here is an example of how to use the ChoiceSingle.value and ChoiceSingle.onChanged adapters

import 'package:flutter/material.dart';
import 'package:choice/choice.dart';

class InlineScrollableX extends StatefulWidget {
  const InlineScrollableX({super.key});

  @override
  State<InlineScrollableX> createState() => _InlineScrollableXState();
}

class _InlineScrollableXState extends State<InlineScrollableX> {
  List<String> choices = [
    'News',
    'Entertainment',
    'Politics',
    'Automotive',
    'Sports',
    'Education',
    'Fashion',
    'Travel',
    'Food',
    'Tech',
    'Science',
    'Arts'
  ];

  String? selectedValue;

  void setSelectedValue(String? value) {
    setState(() => selectedValue = value);
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Choice<String>.inline(
          clearable: true,
          value: ChoiceSingle.value(selectedValue),
          onChanged: ChoiceSingle.onChanged(setSelectedValue),
          itemCount: choices.length,
          itemBuilder: (state, i) {
            return ChoiceChip(
              selected: state.selected(choices[i]),
              onSelected: state.onSelected(choices[i]),
              label: Text(choices[i]),
            );
          },
          listBuilder: ChoiceList.createScrollable(
            spacing: 10,
            padding: const EdgeInsets.symmetric(
              horizontal: 20,
              vertical: 25,
            ),
          ),
        ),
        InlineChoice<String>.single(
          clearable: true,
          value: selectedValue,
          onChanged: setSelectedValue,
          itemCount: choices.length,
          itemBuilder: (state, i) {
            return ChoiceChip(
              selected: state.selected(choices[i]),
              onSelected: state.onSelected(choices[i]),
              label: Text(choices[i]),
            );
          },
          listBuilder: ChoiceList.createWrapped(
            spacing: 10,
            runSpacing: 10,
            padding: const EdgeInsets.symmetric(
              horizontal: 20,
              vertical: 25,
            ),
          ),
        ),
      ],
    );
  }
}
Multiple Choice

Preview

There are a few constructors to create an multiple selection choice widget:

Inline Choice

Preview

There are a few constructors to create an inline choice widget:

Prompted Choice

Preview

There are a few constructors to create a prompted choice widget:

Choice Data

Preview

Choice Item

Preview

With Future Builder

Preview

With Form and FormField

Preview

TODO

  • :white_check_mark: Grouped choice items
  • :x: Sortable choice items better to do this outside
  • :black_square_button: Add scroll wheel list
  • :black_square_button: Add dropdown choice widget
  • :black_square_button: Add chainable choice widget

Sponsoring

Buy Me A Coffee Ko-Fi

If this package or any other package I created is helping you, please consider to sponsor me so that I can take time to read the issues, fix bugs, merge pull requests and add features to these packages.

श्रेणियाँ

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट