Coder Social home page Coder Social logo

davidsdearaujo / select_dialog Goto Github PK

View Code? Open in Web Editor NEW
65.0 3.0 43.0 279 KB

Flutter package designed to select an item from a list, with the option to filter and even search the items online.

License: MIT License

Kotlin 0.29% Swift 0.34% Objective-C 0.03% Dart 73.41% HTML 0.96% CMake 7.03% C++ 17.32% C 0.63%

select_dialog's Introduction

select_dialog Package

Package designed to select an item from a list, with the option to filter and even search the items online.

Versions

Non Null Safety Version: 1.2.3 or less

Null Safety Version: 2.0.0 or more

pubspec.yaml

select_dialog: <last version>

import

import 'package:select_dialog/select_dialog.dart';

Simple example

String ex1 = "No value selected";

SelectDialog.showModal<String>(
  context,
  label: "Simple Example",
  selectedValue: ex1,
  items: List.generate(50, (index) => "Item $index"),
  onChange: (String selected) {
    setState(() {
      ex1 = selected;
    });
  },
);

Multiple items select

List<String> ex5 = [];

SelectDialog.showModal<String>(
  context,
  label: "Multiple Items Example",
  multipleSelectedValues: ex5,
  items: List.generate(50, (index) => "Item $index"),
  onMultipleItemsChange: (List<String> selected) {
    setState(() {
      ex5 = selected;
    });
  },
); 

Attention

To use a template as an item type, you need to implement toString, equals and hashcode, as shown below:

class UserModel {
  final String id;
  final DateTime createdAt;
  final String name;
  final String avatar;

  UserModel({this.id, this.createdAt, this.name, this.avatar});

  @override
  String toString() => name;

  @override
  operator ==(o) => o is UserModel && o.id == id;

  @override
  int get hashCode => id.hashCode^name.hashCode^createdAt.hashCode;

}

Getting Started

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

select_dialog's People

Contributors

ascenio avatar benefic avatar blackleg15 avatar bwolfs2 avatar davidsdearaujo avatar domenicrz avatar felipefernandesleandro avatar jeremy-gill avatar rodrigobastosv avatar timurmirsaitov avatar tommimon avatar zlhz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

select_dialog's Issues

Reset Button

Hi everyone,

I would like to help your project by adding some features like:

  • Reset Button (I have already implemented this one)
  • Visualise selected items before in multi selection mode (Done this too)

If you are interested please tell me 👍

Regards

Auto-focus text field for searching

Hello,

It would be great if the text field for typing in search text would get focus automatically when you open the dialog, so that the user does not have to first tap in the field every time he wants to type in search text. Perhaps as an "autoFocusSearchField" option...

Thanks.

Error After Flutter Upgrade

After Upgrading to the latest flutter stable release 1.12.3 my project is not buildable anymore because of the following error:

../flutter/.pub-cache/hosted/pub.dartlang.org/select_dialog-1.0.6+1/lib/select_bloc.dart:9:3: Error: 'Observable' isn't a type. Observable<List<T>> _filteredListOnlineOut;

Update rxdart to ^0.24.1

Facing the below issue:
Because select_dialog >=1.0.7 depends on rxdart ^0.23.1 and flutter_plugin_pdf_viewer 1.0.7 depends on rxdart ^0.24.1, select_dialog >=1.0.7 is incompatible with flutter_plugin_pdf_viewer 1.0.7. And because no versions of flutter_plugin_pdf_viewer match >1.0.7 <2.0.0, select_dialog >=1.0.7 is incompatible with flutter_plugin_pdf_viewer ^1.0.7.

Error on Launching app

i`m using Flutter 3.13.1
In my app, is showing the error bellow:

Error: No named parameter with the name 'isAlwaysShown'.
select_dialog.dart:218
isAlwaysShown: widget.alwaysShowScrollBar,
^^^^^^^^^^^^^
: Context: Found this candidate, but the arguments don't match.
scrollbar.dart:87

const Scrollbar({
^^^^^^^^^

Method "showDialog" is not closing as it used to

A new attribute of the material's showDialog was added 10 months ago.
Basically, when this attribute is true, the opened dialog doesn't close when we tap Back in our device.
It'll only close if we tap outside the dialog.

autofocus issue

After searching online with autofocus set to true, when selecting a search result, the indicator continues to be displayed and does not become selected.

Custom Search Filtering

Hi guys! ❤️

Thank you so much for this amazing tool!

I would like to know if we can please override the default filtering. I am using the itemBuilder to build a list of a ICD10 model of mine. The documentation did not really go into detail about that part.
The model has an id, code and description in its fields.

_showICD10Dialog() {
    List<ICD10> ex5 = [];
    SelectDialog.showModal<ICD10>(
      context,
      label: "ICD10 Codes",
      multipleSelectedValues: ex5,
      items: _allICD10,
      onMultipleItemsChange: (List<ICD10> selected) {
        setState(() {
          ex5 = selected;
        });
      },
      itemBuilder: (BuildContext context, ICD10 icd10, bool isSelected) {
        return Container(
          decoration: !isSelected
              ? null
              : BoxDecoration(
                  borderRadius: BorderRadius.circular(5.0),
                  color: Colors.white,
                  border: Border.all(
                    color: Theme.of(context).primaryColor,
                  ),
                ),
          child: ListTile(
            selected: isSelected,
            title: Text(icd10.icd10Code),
            subtitle: Text(icd10.icd10Description),
          ),
        );
      },
    );

How can I make sure that it filters the code and description of the search?

Observable<List<T>> filteredListOut;

Observable<List> filteredListOut;
Compiler message:
../../../flutterApp/flutter/.pub-cache/hosted/pub.dartlang.org/select_dialog-1.0.6+1/lib/select_bloc.dart:8:3: Error: Type 'Observable' not found.
Observable<List> filteredListOut;

Error: Type 'Observable' not found

I had this problem today,could you help me solve it?

Compiler message:
../../Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/find_dropdown-0.1.7+1/lib/find_dropdown_bloc.dart:9:3: Error: Type 'Observable' not found.
Observable get validateMessageOut => _validateMessage$;
^^^^^^^^^^
../../Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/find_dropdown-0.1.7+1/lib/find_dropdown_bloc.dart:9:3: Error: Expected 0 type arguments.
Observable get validateMessageOut => _validateMessage$;
^
../../Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/select_dialog-1.0.6+1/lib/select_bloc.dart:8:3: Error: Type 'Observable' not found.
Observable<List> filteredListOut;
^^^^^^^^^^
../../Downloads/flutter/.pub-cache/hosted/pub.flutter-io.cn/select_dialog-1.0.6+1/lib/select_bloc.dart:8:3: Error: Expected 0 type arguments.
Observable<List> filteredListOut;

Update rxdart to 0.24.0

It's not too much of an issue since I just override the version manually, but it would be great if you upgraded the rxdart dependency.

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.