action_text 0.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 39

action_text #

A new Flutter plugin.

Getting Started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

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

0.0.1 #

  • TODO: Describe initial release.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:action_text/action_text.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:flutter/gestures.dart';


void main() => runApp(MaterialApp(home: LinkPage(),));


class LinkPage extends StatefulWidget {
  @override
  _LinkPageState createState() => _LinkPageState();
}

class _LinkPageState extends State<LinkPage> {

  BuildContext _scaffoldContext;


  @override
  Widget build(BuildContext context) {

    var appBar = AppBar(title: new Text('UrlLauchner'),);
    /*
    var gesture = TapGestureRecognizer()
      ..onTap = () {
        print("Ta[ Detected");
        launch('https://docs.flutter.io/flutter/services/UrlLauncher-class.html');
      };


    var textSpan1 = TextSpan(text: 'This is no Link, ', style: new TextStyle(color: Colors.black),);
    var textSpan2 = TextSpan(text: 'but this is', style: new TextStyle(color: Colors.blue), recognizer: gesture,);
    var richTextSpan1 = RichText(text: TextSpan(children: [textSpan1, textSpan2]));
    */

    List<Map<String, StringCallback>> otherLinks = [];
    var callBack = (text) { this.showSnakeBar(context: this._scaffoldContext, message: "Click On Text ${text}"); };
    otherLinks.add({"link": callBack});

    var richTextSpan2 = ActionText(
      text: 'Hi, this is an example for both link example http://www.google.com and hashtag example #helloWorld user @user one',
      style: TextStyle(color: Colors.black, fontSize: 20.0),
      linkStyle: TextStyle(color: Colors.blue),
      tagStyle: TextStyle(color: Colors.red),
      mentionUserStyle: TextStyle(color: Colors.red),
      customTagStyle: TextStyle(color: Colors.grey),
      onOpen: (url) => this.showSnakeBar(context: this._scaffoldContext, message: "Click On ${url}"),
      onTagClick: (tag) => this.showSnakeBar(context: this._scaffoldContext, message: "Click On ${tag}"),
      onUserMensionClick: (tag) => this.showSnakeBar(context: this._scaffoldContext, message: "Click On Tag user ${tag}"),
      otherLinks: otherLinks,
    );

    var padding = Padding(padding: EdgeInsets.only(top: 100),);
    var colums = Column(children: <Widget>[padding,flutter packages pub publish richTextSpan2], crossAxisAlignment: CrossAxisAlignment.center,);

    return Scaffold(
        appBar: appBar,
        body: new Builder(builder: (BuildContext context) {
          _scaffoldContext = context;
          return Center(
            child: colums,
          );
        })
    );
  }

  //region show snakeBar
  void showSnakeBar({BuildContext context, String message}) {
    var snackBarContent = Text(message);
    var snakeBar = SnackBar(content: snackBarContent, duration: Duration(seconds: 2), backgroundColor: Colors.black,);
    Scaffold.of(context).showSnackBar(snakeBar);

  }
//endregion
}

Use this package as a library

1. Depend on it

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


dependencies:
  action_text: ^0.0.1

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

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

  • Dart: 2.8.4
  • pana: 0.13.9+1
  • Flutter: 1.17.3

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:action_text/action_text.dart]

Package does not support Flutter platform macos

Because of import path [package:action_text/action_text.dart]

Package does not support Flutter platform web

Because of import path [package:action_text/action_text.dart]

Package does not support Flutter platform windows

Because of import path [package:action_text/action_text.dart]

Package not compatible with SDK dart

because of import path [action_text]

Health suggestions

Fix lib/action_text.dart. (-3.93 points)

Analysis of lib/action_text.dart reported 8 hints, including:

line 1 col 8: Unused import: 'dart:async'.

line 6 col 8: Unused import: 'package:flutter/services.dart'.

line 145 col 42: This function has a return type of 'TextSpan', but doesn't end with a return statement.

line 170 col 44: 'body1' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText2. This feature was deprecated after v1.13.8..

line 171 col 48: 'body1' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText2. This feature was deprecated after v1.13.8..

Format lib/actionDetection.dart.

Run flutter format to format lib/actionDetection.dart.

Format lib/actionTextDetection.dart.

Run flutter format to format lib/actionTextDetection.dart.

Format lib/action_text1.dart.

Run flutter format to format lib/action_text1.dart.

Maintenance suggestions

Package is getting outdated. (-19.18 points)

The package was last published 62 weeks ago.

The package description is too short. (-18 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.

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