패키지, 저장소 및 앱 카테고리 검색

패키지 상세v1.2.1

rich_input

풍부한 입력 상자, @someone 및 주제를 색상 강조로 구현.

30일 다운로드
23
좋아요
18
Pub 점수
40

패키지 설치

flutter pub add rich_input

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

RichInput은 @멘션 및 색상 강조 기능을 갖춘 주제 태그와 같은 풍부한 형식 지정 기능을 제공하는 Flutter 패키지입니다. 포맷된 텍스트에 대한 실시간 시각 피드백을 지원하여 채팅 인터페이스, 댓글 섹션 또는 공동 편집 도구에 적합합니다. 사용자 정의를 중심으로 설계되어 개발자가 동적 콘텐츠 렌더링을 위한 패턴과 스타일 규칙을 정의할 수 있습니다. 기존 폼과 텍스트 필드에 원활하게 통합되며 직관적이고 상호작용 가능한 입력 기능을 통해 사용자 경험을 향상시킵니다.

사용 사례

  • 채팅 애플리케이션
  • 댓글 시스템
  • 협업 문서 편집
  • 소셜 미디어 플랫폼
  • 작업 관리 도구

주요 기능

  • @mention 감지
  • 색상으로 주제 태그하기
  • 실시간 형식
  • 사용자 지정 스타일
  • 패턴 기반 텍스트 강조

적합한 대상

  • 인터랙티브 텍스트 입력을 구축하는 개발자
  • 멘션 기능이 필요한 앱
  • 풍부한 텍스트 주석이 있는 UI
  • 협업 텍스트 기능이 필요한 팀
  • 동적 콘텐츠 태그가 있는 프로젝트

고려 사항

  • 제한된 플랫폼 지원(지정된 플랫폼 없음)
  • 수동 패턴 구성이 필요합니다
  • 추가적인 스타일 조정이 필요할 수 있습니다
  • 업데이트를 위해 외부 소스 코드에 의존합니다
  • 대규모 텍스트 처리에 최적화되지 않음

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

rich_input

This is a high performance rich media input box, implemented through the native textfield extension, with less disruptive, but at the same time has a strong extensibility, implements the @ someone, # topics, expressions and other functions, support custom color highlighting

Language: English | 中文简体

Special feature

  • Use native textfield capabilities with less code, less disruption and subsequent compatibility
  • Support @someone #topic and insert emojis, etc
  • Support for custom highlighting, and custom styles
  • Support for using the backspace key to delete entire special text blocks
  • Support for special character handling
  • Support for custom data fields to enhance rich text

Demo

Getting Started

Core code

import 'package:rich_input/rich_input.dart';

RichInputController controller = RichInputController(text: "Text");

const block = RichBlock(
  text: "@somebody",
  data: "@123456",
  style: TextStyle(color: Colors.blue),
);
controller.insertBlock(block);

// Get custom data
print(controller.data);
// Get text
print(controller.text);

// RichInput(controller: controller);

Example

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  RichInputController _controller;
  FocusNode _focusNode;

  @override
  void initState() {
    _focusNode = FocusNode();
    _controller = RichInputController(text: "Text");

    // Refresh text display, not required
    _controller.addListener(() {
      setState(() {});
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Padding(
          padding: const EdgeInsets.all(15),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              RichInput(
                focusNode: _focusNode,
                controller: _controller,
              ),
              Wrap(
                spacing: 10,
                children: [
                  RaisedButton(
                    onPressed: () {
                      _controller.insertText("Text");
                    },
                    child: const Text("Add Text"),
                  ),
                  RaisedButton(
                    onPressed: () {
                      _controller.insertText("😁");
                    },
                    child: const Text("Add 😁"),
                  ),
                  RaisedButton(
                    onPressed: () {
                      _controller.insertText("👍");
                    },
                    child: const Text("Add 👍"),
                  ),
                  RaisedButton(
                    onPressed: () {
                      const block = RichBlock(
                        text: "@abc",
                        data: "@123456",
                        style: TextStyle(
                          color: Colors.blue,
                          fontWeight: FontWeight.bold,
                        ),
                      );
                      _controller.insertBlock(block);
                    },
                    child: const Text("Add @    "),
                  ),
                  RaisedButton(
                    onPressed: () {
                      const block = RichBlock(
                        text: "#subject",
                        data: "#888999",
                        style: TextStyle(
                          color: Colors.red,
                          fontWeight: FontWeight.bold,
                        ),
                      );
                      _controller.insertBlock(block);
                    },
                    child: const Text("Add #"),
                  ),
                  RaisedButton(
                    onPressed: () {
                      _focusNode.unfocus();
                    },
                    child: const Text("unfocus"),
                  )
                ],
              ),
              const SizedBox(height: 10),
              Text("Text:${_controller.text}"),
              const SizedBox(height: 10),
              Text("Data:${_controller.data}"),
            ],
          ),
        ),
      ),
    );
  }
}

For detailed examples

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.