Buscar pacotes, repositórios e categorias de apps

Capa de flutter_picker
Detalhes do pacotev2.1.0

flutter_picker

Plugin Flutter picker. Inclui NumberPicker, DateTimePicker, ArrayPicker e Picker de ligação padrão. Oferece parâmetros flexíveis para atender diversas necessidades.

Downloads em 30 dias
4,5 mil
Curtidas
441
Pontos Pub
70

Instalar pacote

flutter pub add flutter_picker

Visão geral do pacote

Orientação gerada a partir de informações públicas. Apenas para referência.

O Flutter Picker é um plugin versátil para Flutter que oferece múltiplos componentes de seleção, incluindo NumberPicker, DateTimePicker, ArrayPicker e um seletor padrão de ligação. Ele fornece opções flexíveis de configuração para personalizar aparência e comportamento, tornando-o adequado para várias entradas de formulários e fluxos de seleção. Projetado para facilitar a integração, suporta vinculação dinâmica de dados e interações suaves com o usuário em diferentes casos de uso.

Casos de uso

  • Entradas de formulário com seleção numérica
  • Seletor de data e hora em formulários
  • Seleção de opções baseada em array personalizado
  • Menus suspensores vinculados para escolhas em cascata
  • Interfaces de entrada de dados orientadas para dispositivos móveis

Principais recursos

  • Vários tipos de seletores incluídos
  • parâmetros altamente personalizáveis
  • Suporte à ligação entre seletores
  • Rolagem suave e animação
  • Integração fácil com formulários existentes

Indicado para

  • Desenvolvedores criando formulários de entrada de dados
  • Aplicativos que exigem seleção de data/hora
  • Projetos que precisam de menus suspensores em cascata
  • Aplicativos móveis com foco em UI
  • Equipes procurando componentes de seleção reutilizáveis

Considerações

  • Nenhuma limitação específica de plataforma mencionada
  • Requer manipulação manual da gestão de estado
  • Documentação limitada além da configuração básica
  • Não otimizado para conjuntos de dados muito grandes
  • Pode ser necessário estilização adicional para temas personalizados

README original

Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.

flutter_picker

pub package GitHub GitHub stars

Flutter plugin picker. Include NumberPicker, DateTimePicker, ArrayPicker, and default linkage Picker. Provide flexible parameters to meet various needs. At the same time, you can extend more functions through custom adapters.

Supported Platforms

  • Android
  • IOS
  • Windows
  • MacOS
  • Linux
  • Web

image

How to Use

# add this line to your dependencies
flutter_picker:
  git:
    url: https://github.com/yangyxd/flutter_picker.git
import 'package:flutter_picker/flutter_picker.dart';

    showPicker(BuildContext context) {
      Picker picker = new Picker(
        adapter: PickerDataAdapter<String>(pickerdata: new JsonDecoder().convert(PickerData)),
        changeToFirst: true,
        textAlign: TextAlign.left,
        columnPadding: const EdgeInsets.all(8.0),
        onConfirm: (Picker picker, List value) {
          print(value.toString());
          print(picker.getSelectedValues());
        }
      );
      picker.show(_scaffoldKey.currentState);
    }

    showPickerModal(BuildContext context) {
      new Picker(
        adapter: PickerDataAdapter<String>(pickerdata: new JsonDecoder().convert(PickerData)),
        changeToFirst: true,
        hideHeader: false,
        onConfirm: (Picker picker, List value) {
          print(value.toString());
          print(picker.adapter.text);
        }
      ).showModal(this.context); //_scaffoldKey.currentState);
    }

    showPickerIcons(BuildContext context) {
      new Picker(
        adapter: PickerDataAdapter(data: [
          new PickerItem(text: Icon(Icons.add), value: Icons.add, children: [
            new PickerItem(text: Icon(Icons.more)),
            new PickerItem(text: Icon(Icons.aspect_ratio)),
            new PickerItem(text: Icon(Icons.android)),
            new PickerItem(text: Icon(Icons.menu)),
          ]),
          new PickerItem(text: Icon(Icons.title), value: Icons.title, children: [
            new PickerItem(text: Icon(Icons.more_vert)),
            new PickerItem(text: Icon(Icons.ac_unit)),
            new PickerItem(text: Icon(Icons.access_alarm)),
            new PickerItem(text: Icon(Icons.account_balance)),
          ]),
          new PickerItem(text: Icon(Icons.face), value: Icons.face, children: [
            new PickerItem(text: Icon(Icons.add_circle_outline)),
            new PickerItem(text: Icon(Icons.add_a_photo)),
            new PickerItem(text: Icon(Icons.access_time)),
            new PickerItem(text: Icon(Icons.adjust)),
          ]),
          new PickerItem(text: Icon(Icons.linear_scale), value: Icons.linear_scale, children: [
            new PickerItem(text: Icon(Icons.assistant_photo)),
            new PickerItem(text: Icon(Icons.account_balance)),
            new PickerItem(text: Icon(Icons.airline_seat_legroom_extra)),
            new PickerItem(text: Icon(Icons.airport_shuttle)),
            new PickerItem(text: Icon(Icons.settings_bluetooth)),
          ]),
          new PickerItem(text: Icon(Icons.close), value: Icons.close),
        ]),
        title: new Text("Select Icon"),
        onConfirm: (Picker picker, List value) {
          print(value.toString());
          print(picker.getSelectedValues());
        }
    ).show(_scaffoldKey.currentState);
  }

  showPickerDialog(BuildContext context) {
    new Picker(
        adapter: PickerDataAdapter<String>(pickerdata: new JsonDecoder().convert(PickerData)),
        hideHeader: true,
        title: new Text("Select Data"),
        onConfirm: (Picker picker, List value) {
          print(value.toString());
          print(picker.getSelectedValues());
        }
    ).showDialog(context);
  }

  showPickerArray(BuildContext context) {
    new Picker(
        adapter: PickerDataAdapter<String>(pickerdata: new JsonDecoder().convert(PickerData2), isArray: true),
        hideHeader: true,
        title: new Text("Please Select"),
        onConfirm: (Picker picker, List value) {
          print(value.toString());
          print(picker.getSelectedValues());
        }
    ).showDialog(context);
  }

  showPickerNumber(BuildContext context) {
    new Picker(
        adapter: NumberPickerAdapter(data: [
          NumberPickerColumn(begin: 0, end: 999),
          NumberPickerColumn(begin: 100, end: 200),
        ]),
        delimiter: [
          PickerDelimiter(child: Container(
            width: 30.0,
            alignment: Alignment.center,
            child: Icon(Icons.more_vert),
          ))
        ],
        hideHeader: true,
        title: new Text("Please Select"),
        onConfirm: (Picker picker, List value) {
          print(value.toString());
          print(picker.getSelectedValues());
        }
    ).showDialog(context);
  }

PickerData Example

Array

const PickerData2 = '''
[
    [
        1,
        2,
        3,
        4
    ],
    [
        11,
        22,
        33,
        44
    ],
    [
        "aaa",
        "bbb",
        "ccc"
    ]
]
    ''';
Linkage
const PickerData = '''
[
    {
        "a": [
            {
                "a1": [
                    1,
                    2,
                    3,
                    4
                ]
            },
            {
                "a2": [
                    5,
                    6,
                    7,
                    8
                ]
            },
            {
                "a3": [
                    9,
                    10,
                    11,
                    12
                ]
            }
        ]
    },
    {
        "b": [
            {
                "b1": [
                    11,
                    22,
                    33,
                    44
                ]
            },
            {
                "b2": [
                    55,
                    66,
                    77,
                    88
                ]
            },
            {
                "b3": [
                    99,
                    1010,
                    1111,
                    1212
                ]
            }
        ]
    },
    {
        "c": [
            {
                "c1": [
                    "a",
                    "b",
                    "c"
                ]
            },
            {
                "c2": [
                    "aa",
                    "bb",
                    "cc"
                ]
            },
            {
                "c3": [
                    "aaa",
                    "bbb",
                    "ccc"
                ]
            }
        ]
    }
]
    ''';

版本更新说明 (Version Update Notes)

v2.1.2 (2023.08.15)

Flutter Picker插件已经更新以支持最新版本的Flutter。主要更新内容如下:

  1. 兼容性升级:

    • 升级SDK版本支持范围到Flutter 3.x
    • 修复与新版Flutter的兼容性问题
  2. API更新:

    • 替换已弃用的ScaffoldState.showBottomSheet方法为Scaffold.maybeOf
    • 更新ButtonStyle和颜色相关的API,使用colorScheme.primary替代过时的colorScheme.secondary
    • 修复其他过时的API使用
  3. 使用说明:

    • 如果您正在使用此插件,请更新到最新版本以获得更好的兼容性
    • 对于现有代码,无需进行任何改变,API保持向后兼容

The Flutter Picker plugin has been updated to support the latest versions of Flutter. Major updates include:

  1. Compatibility Upgrade:

    • Expanded SDK version support to Flutter 3.x
    • Fixed compatibility issues with newer Flutter versions
  2. API Updates:

    • Replaced deprecated ScaffoldState.showBottomSheet method with Scaffold.maybeOf
    • Updated ButtonStyle and color-related APIs, using colorScheme.primary instead of the deprecated colorScheme.secondary
    • Fixed other deprecated API usages
  3. Usage Notes:

    • If you are using this plugin, please update to the latest version for better compatibility
    • No changes needed for existing code, the API remains backward compatible

Categorias

Repositório-fonte

Projetos que usam este pacote