material_search_bar 1.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 85

Material_Search_Bar

A materialistic and feature packed search bar with a Trie implementation for efficient autocorrect. Made by Christopher Gong and Ankush Vangari.

Usage

A simple usage example:

import 'package:search_bar/MaterialSearchBar.dart';

@override Widget build(BuildContext context) { MaterialSearchBar mSB = MaterialSearchBar( searchBarColor: Colors.white, searchBarTextColor: Colors.black, searchBarFontSize: 20.0, searchResultsBackgroundColor: Colors.white, searchResultsTextColor: Colors.black, searchResultsFontSize: 20.0, checkmarkIcon: Icon(Icons.check, color: Colors.teal[400]), submitButton: FloatingActionButton( heroTag: null, tooltip: "Search", child: new Icon(Icons.arrow_forward), backgroundColor: Theme.of(context).primaryColor, foregroundColor: Colors.white, ), items: ['apple', 'banana'], ); mSB.changeOnSubmit(() { for (String s in mSB.selectedItems) print(s); }); mSB.changeOnButtonSubmit((String value) { for (String s in mSB.selectedItems) print(s); }); return mSB; }

Features and bugs

Please file feature requests and bugs at the issue tracker.

0.0.1

  • TODO: Describe initial release.

example/main.dart

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

import 'package:flutter/services.dart';
import 'package:material_search_bar/material_search_bar.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      platformVersion = await MaterialSearchBar.platformVersion;
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
    });
  }

  @override
  Widget build(BuildContext context) {
    MaterialSearchBar mSB = MaterialSearchBar(
      searchBarColor: Colors.white,
      searchBarTextColor: Colors.black,
      searchBarFontSize: 20.0,
      searchResultsBackgroundColor: Colors.white,
      searchResultsTextColor: Colors.black,
      searchResultsFontSize: 20.0,
      checkmarkIcon: Icon(Icons.check, color: Colors.teal[400]),
      submitButton: FloatingActionButton(
        heroTag: null,
        tooltip: "Search",
        child: new Icon(Icons.arrow_forward),
        backgroundColor: Theme.of(context).primaryColor,
        foregroundColor: Colors.white,
      ),
      items: ['apple', 'banana'],
    );
    mSB.changeOnSubmit(() {
      for (String s in mSB.selectedItems) print(s);
    });
    mSB.changeOnButtonSubmit((String value) {
      for (String s in mSB.selectedItems) print(s);
    });
    return mSB;
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  material_search_bar: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:material_search_bar/material_search_bar.dart';
  
Version Uploaded Documentation Archive
1.0.0 Aug 15, 2018 Go to the documentation of material_search_bar 1.0.0 Download material_search_bar 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
75
Health:
Code health derived from static analysis. [more]
92
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
85
Learn more about scoring.

We analyzed this package on Nov 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.6
  • Flutter: 0.11.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/material_search_bar_results_item.dart. (-4.41 points)

Analysis of lib/material_search_bar_results_item.dart reported 9 hints, including:

line 4 col 7: This class inherits from a class marked as @immutable, and therefore should be immutable (all instance fields must be final).

line 5 col 15: The value of the field '_selectedItems' isn't used.

line 6 col 8: The value of the field '_checkmark' isn't used.

line 7 col 9: The value of the field '_state' isn't used.

line 8 col 9: The value of the field '_searchResultsBackgroundColor' isn't used.

Fix lib/material_search_bar.dart. (-2.96 points)

Analysis of lib/material_search_bar.dart reported 6 hints, including:

line 10 col 7: This class inherits from a class marked as @immutable, and therefore should be immutable (all instance fields must be final).

line 66 col 8: Method doesn't override an inherited method.

line 101 col 10: The value of the field '_lat' isn't used.

line 101 col 16: The value of the field '_lon' isn't used.

line 115 col 8: The value of the field '_rightIcon' isn't used.

Fix lib/material_search_bar_results.dart. (-0.50 points)

Analysis of lib/material_search_bar_results.dart reported 1 hint:

line 5 col 7: This class inherits from a class marked as @immutable, and therefore should be immutable (all instance fields must be final).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.55.0 <3.0.0
flutter 0.0.0
trie ^1.0.2 1.0.2
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8