FLUTTER ECOSYSTEM

rockerhieu/flutter_richtext_composer

리치 텍스트 조합을 위한 Flutter 패키지

flutter_richtext_composer 프로젝트 이미지
Stars
1
Forks
2
최근 푸시(UTC)
2022. 2. 24.
프로젝트 상태
활성
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