flutter_snackbar_plus 1.0.1
flutter_snackbar_plus: ^1.0.1 copied to clipboard
A minimal library to handle SnackBars with elaborate list of configuration & style options.
flutter_snackbar_plus #
flutter_snackbar_plus
is a minimal library to handle SnackBars with elaborate list of configuration & style options..
Table of Contents #
Demo #


Features #
- Custom Regex Styling: Apply styles dynamically to text patterns.
- Interactive Callbacks: Define actions for user interactions with matched text.
- Dynamic Updates: Modify regex patterns on the fly without recreating the controller.
- IME Composition Support: Smooth handling for languages like Japanese and Chinese.
- Performance Optimizations: Cached regex for better performance.
- RichWrapper Widget: A widget for seamless integration with the controller.
- Fine-grained Configuration: Control deletion behavior, styles, and tap actions for specific matches.
Installation #
- Add the package to your
pubspec.yaml
file:
dependencies:
flutter_snackbar_plus: ^[latest_version]
- Run the following command to install the package:
flutter pub get
- Import the package into your Dart file:
import 'package:flutter_snackbar_plus/flutter_snackbar_plus.dart';
Usage #
Here's a quick example of how to use RichTextController
to style specific patterns in a TextField
:
Example #
import 'package:flutter/material.dart';
import 'package:flutter_snackbar_plus/flutter_snackbar_plus.dart';
defaultTextStyle(BuildContext context) => TextStyle(color: Colors.black);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('RichTextController Example')),
body: Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: TextField(
controller: RichTextController(
text: '',
onMatch: (match, target) {
print('Match found: \$match');
},
targetMatches: [
MatchTargetItem(
textStyle: TextStyle(color: Colors.blue, fontWeight: FontWeight.bold),
regex: RegExp(r'#[a-zA-Z0-9_]+'),
),
MatchTargetItem(
textStyle: TextStyle(color: Colors.green),
regex: RegExp(r'@[a-zA-Z0-9_]+'),
),
],
),
decoration: InputDecoration(border: OutlineInputBorder()),
),
),
),
),
);
}
}
Contributing #
Contributions are always welcome! Here’s how you can help:
- Report bugs or request features via GitHub Issues.
- Submit pull requests with well-documented code and examples.
- Share your thoughts and ideas to improve the package.
License #
Licensed under the MIT License. You are free to use, modify, and distribute this package. See the LICENSE.md file for details.