textfield_search 0.3.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new50

flutter_textfield_search #

Build and Test

FTFS is a Flutter package which uses a TextField Widget to search and select a value from a list. It's a simple, lightweight, and fully tested package unlike other "autocomplete" or textfield search packages. View complete code coverage results in JSON format here.

Usage #

To use this package, add flutter_textfield_search as a dependency in your pubsec.yaml file.

Example #

Import the package.

`import 'package:flutter_textfield_search/search.dart'`;

Then include the widget anywhere you would normally use a TextField widget with a label, and a List
Example MaterialApp using TextFieldSearch Widget

    const label = "Some Label";
    const dummyList = ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5'];
    MaterialApp(
      home: Scaffold(
        body: TextFieldSearch(initialList: dummyList, label: label)
      ),
    )

Issues #

Please email any issues, bugs, or additional features you would like to see built to arindone@nubeer.io.

Contributing #

If you wish to contribute to this package you may fork the repository and make a pull request to this repository.

Note: Testing by running flutter test --coverage will generate coverage/lcov.info. Running bash test-coverage.sh will parse the lcov.info file into JSON format. This happens automatically within the CI/CD pipeline on a pull request to master but it is always good to test locally.

Changelog #

0.3.0 #

5-23-2020

  • Added automated testing to CI/CD pipelines
  • Added code coverage to CI/CD pipelines via bash script that's auto commited to repo

0.2.0 #

Initial Release

  • Delivering an easy to use text field that searches through a predefined list of selectable options
  • Developers can set the label for the text field and the static list of options to be searched and selected from

example/main.dart

// EXAMPLE use case for TextFieldSearch Widget
import 'package:flutter/material.dart';
import '../lib/textfield_search.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final listOfStyles = [
    'Stout',
    'Oatmeal Stout',
    'Chocolate Stout',
    'Gose',
    'IPA',
    'New England IPA',
    'India Pale Ale',
    'Lager',
    'Ale',
    'Red Ale'
  ];
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Padding(
        padding: EdgeInsets.all(20),
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: Form(
          child: ListView(
            children: <Widget>[
              SizedBox(height: 16),
              TextFormField(
                decoration: InputDecoration(
                    labelText: 'Brewery'
                ),
              ),
              SizedBox(height: 16),
              TextFormField(
                decoration: InputDecoration(
                    labelText: 'Beer Name'
                ),
              ),
              SizedBox(height: 16),
              TextFormField(
                decoration: InputDecoration(
                    labelText: 'Description'
                ),
              ),
              TextFieldSearch(initialList: listOfStyles, label: 'Style',),
              SizedBox(height: 16),
              TextFormField(
                decoration: InputDecoration(
                    labelText: 'ABV.'
                ),
              ),
              SizedBox(height: 16),
              TextFormField(
                decoration: InputDecoration(
                    labelText: 'IBU'
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  textfield_search: ^0.3.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:textfield_search/textfield_search.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on May 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.1
  • pana: 0.13.8-dev
  • Flutter: 1.17.0

Health suggestions

Format lib/textfield_search.dart.

Run flutter format to format lib/textfield_search.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test