flutter_search_bars 0.0.3

  • Readme
  • Changelog
  • Installing
  • new52

题记 —— 执剑天涯,从你的点滴积累开始,所及之处,必精益求精,即是折腾每一天。

重要消息


1 使用封装库 #

1.1 添加依赖

小编已将本效果写成一个依赖库,读者可根据使用直接添加依赖,代码如下: github方式依赖

  flutter_search_bars:
    git:
      url: https://github.com/zhaolongs/flutter_search_bar.git
      ref: master

pub仓库依赖 查看最新版本

  #搜索框
  flutter_search_bars: ^0.0.1

1.2 导包

在使用到搜索框 SearchBar 的地方导包如下:

import 'package:flutter_search_bars/flutter_search_bars.dart';

1.3 使用

1.3.1 默认大小使用
///这里只是用于显示的搜索框不用做输入
///参数[heroTag]用于页面过渡动画tag
///参数clickCallBack为当前搜索框点击事件回调
SearchStaticBar(
	heroTag: "searchStatidBar",
	clickCallBack: () {
	  NavigatorUtils.pushPage(context, TestPage2());
	},
)
1.3.2 指定大小使用
 Container(
     width: 120,
      ///这里只是用于显示的搜索框不用做输入
      ///参数[heroTag]用于页面过渡动画tag
      ///参数clickCallBack为当前搜索框点击事件回调
      child: SearchStaticBar(
        heroTag: "searchStatidBar",
        clickCallBack: () {
          NavigatorUtils.pushPage(context, TestPage2());
        },
      ),
    )

运行效果如下: 在这里插入图片描述

[0.0.3] 左侧返回键 #

[0.0.2] 补充文档 #

[0.0.1] - TODO: Add release date. #

  • TODO: Describe initial release.

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_search_bars: ^0.0.3

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:flutter_search_bars/flutter_search_bars.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
29
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
40
Overall:
Weighted score of the above. [more]
52
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • flutter_search_bars that is a package requiring null.

Health suggestions

Fix lib/src/search_static_bar.dart. (-0.50 points)

Analysis of lib/src/search_static_bar.dart reported 1 hint:

line 16 col 7: This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance fields aren't final: SearchStaticBar.hint, SearchStaticBar.heroTag, SearchStaticBar.defaultBorderRadius, SearchStaticBar.margin, SearchStaticBar.padding, SearchStaticBar.clickCallBack, SearchStaticBar.splashColor

Fix lib/src/search_textfield_bar.dart. (-0.50 points)

Analysis of lib/src/search_textfield_bar.dart reported 1 hint:

line 19 col 7: This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance fields aren't final: SearchTextFieldBar.hint, SearchTextFieldBar.heroTag, SearchTextFieldBar.defaultBorderRadius, SearchTextFieldBar.margin, SearchTextFieldBar.padding, SearchTextFieldBar.splashColor, SearchTextFieldBar.focusNode, SearchTextFieldBar.controller, SearchTextFieldBar.onSubmitted, SearchTextFieldBar.clearCallback, SearchTextFieldBar.onBackCallback, SearchTextFieldBar.inputKeyWordsLength, SearchTextFieldBar.fontSize, SearchTextFieldBar.isShowBackButton, SearchTextFieldBar.width, SearchTextFieldBar.height

Format lib/flutter_search_bars.dart.

Run flutter format to format lib/flutter_search_bars.dart.

Maintenance issues and suggestions

The description contains too many non-ASCII characters. (-20 points)

The site uses English as its primary language. The value of the description field in your package's pubspec.yaml field should primarily contain characters used in English.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and flutter_search_bars.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

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 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test