You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import'package:flutter/material.dart';
import'package:rich_text_controller/rich_text_controller.dart';
voidmain() {
runApp(constMyApp());
}
classMyAppextendsStatelessWidget {
constMyApp({super.key});
@overrideWidgetbuild(BuildContext context) {
returnMaterialApp(
home:RichTextExample(),
);
}
}
classRichTextExampleextendsStatelessWidget {
RichTextExample({super.key});
final controller =RichTextController(
targetMatches: [
MatchTargetItem(
style:TextStyle(color:Colors.blue, fontWeight:FontWeight.bold),
regex:RegExp(r'#[a-zA-Z0-9_]+'), // Doesn't work
),
MatchTargetItem(
style:TextStyle(color:Colors.green),
regex:RegExp(r'@[a-zA-Z0-9_]+'), // Doesn't work
),
MatchTargetItem(
style:TextStyle(color:Colors.red),
regex:RegExp(
r'(foo|bar)+:'), // Used to highlight right after ':' character is typed in version 1.x.x, now you need to type another character for it to highlight
),
],
onMatch: (matches) {
print('Matched: $matches');
},
);
@overrideWidgetbuild(BuildContext context) {
returnScaffold(
body:Center(
child:TextField(
controller: controller,
),
),
);
}
}
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: