flutter_text_anchor 0.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 48

flutter_text_anchor #

pub package

Screenshots #

Screenshot 2020-04-30 at 01 56 41 Screenshot 2020-04-30 at 01 55 55

  • A flutter package that helps in creating an anchored text.
  • Widget provides freedom to attach multiple link in a text.
  • A paragraph for texts including simple links "http://thisisalink.com" or markdown format links "(Some text)[http://thisisalink.com]".
  • This widget is build to identify links of both the format present in the paragraph.

Installing: #

In your pubspec.yaml

dependencies:
  flutter_text_anchor: ^0.0.1
import 'package:flutter_text_anchor/flutter_text_anchor.dart';

Basic Usage: #

    TextAnchor(
        text: '''
Hello, this is (Rana)[https://medium.com/@ranaranvijaysingh9]. 
This is my (YouTube)[https://www.youtube.com/channel/UCl7ETvRjLZsm9qXcxAKCd4w] channel. 
You can find this repository here: https://github.com/RanaRanvijaySingh/flutter_text_anchor.
              ''',
        onTapLink: (link) {
            print(link);
        },
    )
    TextAnchor(
        textColor: Colors.black54,
        linkColor: Colors.pink,
        fontWeight: FontWeight.w300,
        fontSize: 18.0,
        text: '''
Hello, this is (Rana)[https://medium.com/@ranaranvijaysingh9]. 
This is my (YouTube)[https://www.youtube.com/channel/UCl7ETvRjLZsm9qXcxAKCd4w] channel. 
You can find this repository here: https://github.com/RanaRanvijaySingh/flutter_text_anchor.
              ''',
        onTapLink: (link) {
            print(link);
        },
    )

Pull Requests #

I welcome and encourage all pull requests. It usually will take me within 24-48 hours to respond to any issue or request. Here are some basic rules to follow to ensure timely addition of your request:

  1. Match coding style (braces, spacing, etc.) This is best achieved using Reformat Code feature of Android Studio CMD+Option+L on Mac and CTRL + ALT + L on Linux + Windows .
  2. If its a feature, bugfix, or anything please only change code to what you specify.
  3. Please keep PR titles easy to read and descriptive of changes, this will make them easier to merge :)
  4. Pull requests must be made against develop branch. Any other branch (unless specified by the maintainers) will get rejected.
  5. Make sure you follow the set standard as all other projects in this repo do

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

License #

Copyright 2020 Rana Ranvijay Singh

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

[0.0.1] - 30 April 2020 #

  • First release

example/lib/example.dart

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

void main() {
  runApp(ExampleScreen());
}

class ExampleScreen extends StatelessWidget {
  final GlobalKey<ScaffoldState> key = GlobalKey<ScaffoldState>();
  final String text = '''
Hello, this is (Rana)[https://medium.com/@ranaranvijaysingh9]. 
This is my (YouTube)[https://www.youtube.com/channel/UCl7ETvRjLZsm9qXcxAKCd4w] channel. 
You can find this repository here: https://github.com/RanaRanvijaySingh/flutter_text_anchor.
              ''';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        key: key,
        appBar: AppBar(
          title: Text('Text Anchor'),
        ),
        body: Container(
          padding: EdgeInsets.all(24.0),
          child: Column(
            children: <Widget>[
              Divider(),
              Text('Simple text'),
              Divider(),
              Text(text),
              Divider(),
              Text('Text Anchor'),
              Divider(),

              /// Using TextAnchor widget.
              TextAnchor(
                text: text,
                onTapLink: (link) {
                  key.currentState.showSnackBar(SnackBar(content: Text(link)));
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_text_anchor: ^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:flutter_text_anchor/flutter_text_anchor.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]
90
Overall:
Weighted score of the above. [more]
48
Learn more about scoring.

We analyzed this package on Jul 8, 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_text_anchor] that is in a package requiring null.

Health suggestions

Format lib/widget/parser.dart.

Run flutter format to format lib/widget/parser.dart.

Format lib/widget/text_anchor_parser.dart.

Run flutter format to format lib/widget/text_anchor_parser.dart.

Maintenance suggestions

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.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.1
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test