Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing using Japanese IME will always use the color of the first targetMatches when in composition phase #54

Open
khoadng opened this issue Jan 25, 2025 · 0 comments

Comments

@khoadng
Copy link

khoadng commented Jan 25, 2025

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: RichTextExample(),
    );
  }
}

class RichTextExample extends StatelessWidget {
  RichTextExample({super.key});
  final controller = RichTextController(
    targetMatches: [
      MatchTargetItem.text(
        'highlight', // Match exact text
        style: const TextStyle(color: Colors.blue, fontWeight: FontWeight.bold),
      ),
    ],
    onMatch: (matches) {
      print('Matched: $matches');
    },
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: TextField(
          controller: controller,
        ),
      ),
    );
  }
}
Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant