FLUTTER ECOSYSTEM

rockerhieu/flutter_richtext_composer

समृद्ध पाठ बनाने के लिए एक Flutter पैकेज

flutter_richtext_composer प्रोजेक्ट कवर
Stars
1
Forks
2
अंतिम पुश (UTC)
24 फ़र॰ 2022
प्रोजेक्ट स्थिति
सक्रिय
Hieu Hua GitHub avatar
GITHUB User

Hieu Hua ↗

Palo Alto NetworksMinnesota
भाषाएँDartRubySwiftKotlinObjective-C

इस रिपॉज़िटरी के पैकेज

उपयोग की गई निर्भरताएँ

निर्भरता सूची 2 आइटम
  • flutter{"sdk":"flutter"}
  • flutter_testडेवलपमेंट{"sdk":"flutter"}

मूल README

यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।

README खोलें / बंद करें

flutter_richtext_composer

Latest version on pub.dev

A Flutter package for composing RichText in a i18n friendly way.

Getting Started

Import the library with

import 'package:flutter_richtext_composer/flutter_richtext_composer.dart';

Example

Then you can start composing RichText like this:

RichTextComposer(
  'Hi {name}, I am {my_name}! {icon}',
  style: TextStyle(fontSize: 30),
  placeholders: {
    'name': TextSpan(
          text: 'Son',
          style: TextStyle(fontWeight: FontWeight.bold),
    ),
    'my_name': TextSpan(
          text: 'Dad',
          style: TextStyle(
            color: Colors.red,
            decoration: TextDecoration.underline,
          ),
    ),
    'icon': WidgetSpan(
      child: GestureDetector(
        child: Icon(Icons.person),
        onTap: () {
          ScaffoldMessenger.of(context).showSnackBar(SnackBar(
            content: Text('Icon has been clicked'),
          ));
        },
      ),
    ),
  },
),

To escape the placeholder, prefix with \, e.g \{placeholder}:

RichTextComposer(
  'Hi \\{dad}, I am {batman}!',
  style: TextStyle(fontSize: 25),
  placeholders: {
    'batman': TextSpan(
          text: 'Batman',
          style: TextStyle(
            color: Colors.red,
            decoration: TextDecoration.underline,
          ),
    ),
  },
),

Example