flutter_text_anchor 0.0.1 copy "flutter_text_anchor: ^0.0.1" to clipboard
flutter_text_anchor: ^0.0.1 copied to clipboard

A flutter package that helps in creating an anchored text. Widget provides freedom to attach multiple link in a text.

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)));
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}
4
likes
40
pub points
57%
popularity

Publisher

unverified uploader

A flutter package that helps in creating an anchored text. Widget provides freedom to attach multiple link in a text.

Repository (GitHub)
View/report issues

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_text_anchor