tag_highlighting 0.0.2 icon indicating copy to clipboard operation
tag_highlighting: ^0.0.2 copied to clipboard

discontinuedreplaced by: styled_text

A Flutter package that allows you to highlight certain parts of a text using tags (like in HTML).

example/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Tag Highlighting',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
        scaffoldBackgroundColor: Color(0xFFEBEBEB),
      ),
      home: Scaffold(
        appBar: AppBar(title: Text("tag_highlighting")),
        body: Home(),
      ),
    );
  }
}

class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Align(
      alignment: Alignment.center,
      child: TagHighlighting(
        text:
            "Hello, <strong>World</strong> ! How <em>are you</em> ? <how>Extremely fine</how> !",
        defaultTextStyle: TextStyle(
          color: Colors.black,
          fontSize: 16,
        ),
        textAlign: TextAlign.center,
        tags: [
          TagHighlight(
            tagName: "strong", // the name of the tag above.
            textStyle: TextStyle(
              fontWeight: FontWeight.w900,
              color: Colors.redAccent,
              fontSize: 16,
            ), // the style of "you".
          ),
          TagHighlight(
            tagName: "em",
            textStyle: TextStyle(
              fontStyle: FontStyle.italic,
              color: Colors.blueAccent,
              fontSize: 16,
            ),
          ),
          TagHighlight(
            tagName: "how",
            textStyle: TextStyle(
              fontStyle: FontStyle.italic,
              color: Colors.orangeAccent,
              fontSize: 16,
            ),
          ),
        ],
      ),
    );
  }
}
3
likes
0
pub points
27%
popularity

Publisher

unverified uploader

A Flutter package that allows you to highlight certain parts of a text using tags (like in HTML).

Repository (GitHub)
View/report issues

Documentation

API reference

License

Icon for licenses.unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on tag_highlighting