flutter_tag_layout 0.0.3

  • Readme
  • Changelog
  • Installing
  • new37

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


1 添加依赖

flutter_tag_layout: ^0.0.3

2 导包


import 'package:flutter_tag_layout/flutter_tag_layout.dart';

3 标签创建文本

class TextTagPage extends StatefulWidget {
  _FirstPageState createState() => _FirstPageState();

class _FirstPageState extends State<TextTagPage> {
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("文本标签"),
        body: Container(
          margin: EdgeInsets.all(30.0),
          child: Row(children: [

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

4 结合流式布局使用

class TextWarpTagPage extends StatefulWidget {
  _FirstPageState createState() => _FirstPageState();

class _FirstPageState extends State<TextWarpTagPage> {
  List<String> tagList = ["文本标签", "测试", "这是什么", "早上好","吃饭", "再来一次"];

  Widget build(BuildContext context) {
    List<Widget> itemWidgetList = [];

    for (var i = 0; i < tagList.length; i++) {
      var str = tagList[i];

    return Scaffold(
        appBar: AppBar(
          title: Text("文本标签"),
        body: Container(
          margin: EdgeInsets.only(top: 30.0, left: 10, right: 10),

          child: Wrap(
              spacing: 8.0,
              runSpacing: 8.0,

              children: itemWidgetList),

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

完毕 公众号 我的大前端生涯

[0.0.3] 新增 TextTagWidget 文本标签 #

[0.0.2] 文本标签Tag增加点击事件 #

[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:

  flutter_tag_layout: ^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_tag_layout/flutter_tag_layout.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [flutter_tag_layout] that is in a package requiring null.

Health suggestions

Fix lib/src/text_main_layout_page.dart. (-1.49 points)

Analysis of lib/src/text_main_layout_page.dart reported 3 hints:

line 7 col 8: Unused import: 'layout_painter.dart'.

line 9 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: TextLayoutMainPage.textLayoutModelList, TextLayoutMainPage.margins, TextLayoutMainPage.padding, TextLayoutMainPage.tagClickCallback

line 203 col 10: The value of the local variable 'size' isn't used.

Fix lib/src/text_tag_widget.dart. (-1 points)

Analysis of lib/src/text_tag_widget.dart reported 2 hints:

line 6 col 1: Prefer using /// for doc comments.

line 14 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: TextTagWidget.text, TextTagWidget.margin, TextTagWidget.padding, TextTagWidget.textStyle, TextTagWidget.backgroundColor, TextTagWidget.borderColor, TextTagWidget.borderRadius

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

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

line 6 col 1: Prefer using /// for doc comments.

Fix additional 3 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/flutter_tag_layout.dart (Run flutter format to format lib/flutter_tag_layout.dart.)
  • lib/src/layout_painter.dart (Run flutter format to format lib/src/layout_painter.dart.)
  • lib/src/text_layout_model.dart (Run flutter format to format lib/src/text_layout_model.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_tag_layout.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.


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
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies