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

discontinuedreplaced by: styled_text
outdated

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
40
pub points
32%
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

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on tag_highlighting