Skip to content

Commit 2f2017d

Browse files
author
Rohan
committed
Merge branch 'dev'
2 parents 080be7c + 6c20644 commit 2f2017d

File tree

11 files changed

+826
-111
lines changed

11 files changed

+826
-111
lines changed

.github/workflows/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ jobs:
1818
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
1919
with:
2020
flutter_channel: 'stable'
21-
flutter_version: '3.16.4'
21+
flutter_version: '3.24.0'
2222
min_coverage: 80

CHANGELOG.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11

22
# Changelog
33

4+
# 2.3.0
5+
### New
6+
- *TypeSetEditingController* - Give your chatroom life.
7+
- Added back url_launcher package for default link behavior.
8+
9+
### Others
10+
- Test suite for TypeSetEditingController
11+
- Updated example app to showcase all features including TypeSetEditingController and - getTypesetContextMenus.
12+
413
# 2.2.0
514
### New
615
- Recognize individual links and apply desired actions on tap.
716

817
### Breaking
9-
- `recognizer` is now `linkGestureRecognizer` callback
10-
- Removed `url_launcher` dependency
18+
- `recognizer` is now `linkRecognizerBuilder` callback
1119

1220
# 2.1.2
1321
### Chore
@@ -65,9 +73,9 @@
6573

6674
**Usage**
6775
- BOLD → Hello, \*World!*
68-
- ITALIC → Hello, \_World!_
76+
- ITALIC → Hello, \_World!_
6977
- STRIKETHROUGH → Hello, \~World!~
70-
- UNDERLINE → Hello, //World!//
78+
- UNDERLINE → Hello, //World!//
7179
- MONOSPACE → Hello, \`World!`
7280
- LINK → [google.com|https://google.com]
7381

@@ -91,5 +99,5 @@ Thanks for choosing our text formatting widget for all your formatting needs. We
9199
- feat: WhatsApp like formatting for you all!🎉
92100

93101

94-
Thank you for being part of our journey. Your feedback is the beacon that guides our innovation.
95-
*Please note that all changes included in beta releases are for testing purposes and may change before the final release.*
102+
Thank you for being part of our journey. Your feedback is the beacon that guides our innovation.
103+
*Please note that all changes included in beta releases are for testing purposes and may change before the final release.*

README.md

Lines changed: 152 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,199 @@
11
---
22

3-
# TypeSet: Elegant Text Styling for Flutter
3+
<div align="center">
4+
5+
# ✨ TypeSet ✨
6+
### Powerful Text Styling for Flutter
7+
48
[![style: very good analysis][very_good_analysis_badge]][very_good_analysis_link]
59
[![pub package][pub_badge]][pub_link]
610
![pub points][pub_points_badge]
11+
[![build status][build_badge]][tracker]
12+
13+
</div>
714

8-
Enhance your Flutter app's text presentation with TypeSet, the all-in-one solution for text styling and formatting that's as dynamic as your app needs to be. Inspired by familiar markdown formatting, TypeSet allows you to seamlessly integrate rich text features, including variable font sizes and web links, without disrupting the underlying logic of your code. With backend-driven formatting capability, WhatsApp-like ease, and additional formatting options, TypeSet offers the fluidity to make any text come alive!
15+
## Transform Your Text Experience
916

10-
## Preview of Possibilities
17+
TypeSet brings WhatsApp, Telegram-like text styling to your Flutter apps with a powerful twist. Create rich, dynamic text experiences that can be driven by your backend or controlled directly in your UI.
1118

12-
<img width="346" alt="Screenshot 2023-03-18 at 10 25 42" src="https://github.com/rohanjsh/typeset/assets/35066779/34c49da7-4a47-41a2-8af1-0f9d5a093689">
19+
With TypeSet, you can seamlessly integrate **bold**, _italic_, ~~strikethrough~~, underlined text, `monospace`, hyperlinks, and even dynamic font sizing without complex widgets or convoluted styling code.
1320

14-
Craft the perfect user experience with customizable text that embraces bold, italic, strikethrough, underline, monospace, hyperlinks, and dynamic font sizes – all at your fingertips.
21+
## 📱 See It In Action
1522

16-
## Getting Started 🚀
23+
<table align="center">
24+
<tr>
25+
<th>TypeSet Widget</th>
26+
<th>TypeSetEditingController</th>
27+
</tr>
28+
<tr>
29+
<td>
30+
<img width="346" alt="TypeSet Widget" src="https://github.com/user-attachments/assets/a0f9695d-5735-426d-9f66-5e7e991791fa">
31+
</td>
32+
<td>
33+
<img width="346" alt="TypeSetEditingController" src="https://github.com/user-attachments/assets/6ecc0930-c38f-4253-807c-c8fcd8fb6482">
34+
</td>
35+
</tr>
36+
</table>
1737

18-
To unleash the power of TypeSet in your Flutter application, ensure you have the Flutter SDK installed and up to date.
38+
Craft the perfect user experience with text styling that feels natural to your users. TypeSet makes it easy to implement rich text features that would otherwise require complex custom solutions.
39+
40+
## 🚀 Getting Started
1941

2042
### Installation
2143

22-
In your `pubspec.yaml`, under dependencies, add the following line:
44+
Add TypeSet to your project by including it in your `pubspec.yaml`:
2345

2446
```yaml
2547
dependencies:
26-
typeset: ^latest_version
48+
typeset: ^2.3.0 # Check pub.dev for the latest version
2749
```
2850

29-
Run the following command to install the package:
51+
Then run:
3052

3153
```shell
32-
flutter packages get
54+
flutter pub get
3355
```
3456

35-
### Usage 🌟
57+
## 💎 Usage
3658

37-
Utilize the TypeSet widget as easily as you would use the native `Text.rich()` in Flutter:
59+
TypeSet is designed to be as simple as using Flutter's built-in `Text` widget:
3860

3961
```dart
4062
import 'package:typeset/typeset.dart';
4163
42-
// Bold Text Example
43-
TypeSet('Hello, *World!*'); // Renders 'World!' in bold
64+
// Just drop in your formatted text
65+
TypeSet('Hello *Flutter* developers!');
66+
```
67+
68+
### Text Formatting Syntax
4469

45-
// Italic Text Example
46-
TypeSet('Hello, _World!_'); // Renders 'World!' in italic
70+
| Style | Syntax | Result |
71+
|-------|--------|--------|
72+
| **Bold** | `*text*` | **text** |
73+
| _Italic_ | `_text_` | _text_ |
74+
| ~~Strikethrough~~ | `~text~` | ~~text~~ |
75+
| Underline | `#text#` | <ins>text</ins> |
76+
| `Monospace` | `` `text` `` | `text` |
77+
| [Link](https://flutter.dev) | `§Link text\|https://url§` | [Link text](https://url) |
78+
| Font Size | `text<size>` | Renders text at specified size |
4779

48-
// Strikethrough Text Example
49-
TypeSet('Hello, ~World!~'); // Renders 'World!' with a strikethrough
80+
### Advanced Examples
5081

51-
// Underline Text Example
52-
TypeSet('Hello #World!#'); // Renders 'World!' underlined
82+
```dart
83+
// Hyperlink with custom tap action
84+
TypeSet(
85+
'§Visit Flutter\|https://flutter.dev§',
86+
linkRecognizerBuilder: (linkText, url) =>
87+
TapGestureRecognizer()..onTap = () {
88+
// Your custom action here
89+
},
90+
);
91+
92+
// Dynamic font sizing
93+
TypeSet('Regular text with *bigger<24>* words');
94+
95+
// Escape formatting characters
96+
TypeSet('Use the ¦* symbol to show *asterisks*');
97+
```
5398

54-
// Monospace Text Example
55-
TypeSet('Hello, `World!`'); // Renders 'World!' in monospace
99+
## 💬 Interactive Text Editing
56100

57-
// Hyperlink Text Example
58-
TypeSet('§google.com|https://google.com§',
59-
linkRecognizerBuilder: (linkText, url) =>
60-
TapGestureRecognizer()
61-
..onTap = () {
62-
// your desired action
63-
},
64-
); // Renders 'google.com' as a link
101+
### TypeSetEditingController
65102

66-
// Dynamic Font Size Example
67-
TypeSet('Hey, *Hello world<30>*'); // Renders 'Hello world' with font size 30
103+
New in v2.3.0! Add WhatsApp-like styling to your text input fields with real-time formatting preview:
104+
105+
```dart
106+
import 'package:typeset/typeset.dart';
107+
import 'package:flutter/material.dart';
108+
109+
// Create a controller with optional styling parameters
110+
final controller = TypeSetEditingController(
111+
// Initial text with formatting
112+
text: 'This is *bold* and _italic_',
113+
// Style for the formatting markers
114+
markerColor: Colors.grey.shade400,
115+
// Style for links
116+
linkStyle: const TextStyle(color: Colors.blue),
117+
// Style for bold text
118+
boldStyle: const TextStyle(fontWeight: FontWeight.bold),
119+
// Style for monospace text
120+
monospaceStyle: const TextStyle(fontFamily: 'Courier'),
121+
);
122+
123+
// Use it with a TextField
124+
TextField(
125+
controller: controller,
126+
maxLines: 3,
127+
decoration: const InputDecoration(
128+
border: OutlineInputBorder(),
129+
hintText: 'Type formatted text here...',
130+
),
131+
);
68132
```
69133

70-
TypeSet inherits all properties of the `Text.rich()` widget, allowing for a familiar and versatile configuration experience.
134+
### Context Menu Integration
135+
136+
Add formatting options to the text selection context menu with `getTypesetContextMenus()`:
71137

72-
### Use **`¦` (broken bar)** and append with any reserved character to render them.
73-
Example:
74138
```dart
75-
Typeset('*Hello ¦* World*');
139+
import 'package:typeset/typeset.dart';
140+
import 'package:flutter/material.dart';
141+
142+
TextField(
143+
controller: TypeSetEditingController(),
144+
contextMenuBuilder: (context, editableTextState) {
145+
return AdaptiveTextSelectionToolbar.buttonItems(
146+
anchors: editableTextState.contextMenuAnchors,
147+
buttonItems: [
148+
// Add TypeSet formatting options to the context menu
149+
...getTypesetContextMenus(
150+
editableTextState: editableTextState,
151+
// Optional: specify which formatting options to include
152+
// styleTypes: [StyleTypeEnum.bold, StyleTypeEnum.italic],
153+
),
154+
// Keep the default context menu items
155+
...editableTextState.contextMenuButtonItems,
156+
],
157+
);
158+
},
159+
);
76160
```
77-
## Features 🎨
78161

79-
- **Backend-driven formatting**: Keep your text styling logic server-side for easy updates without the need to redeploy your app.
80-
- **Rich markdown-like formatting**: Easily implement bold, italic, strikethrough, underline, monospace, and hyperlinked text.
81-
- **Dynamic font resizing**: Adjust text sizes on the fly for emphasis or accessibility.
82-
- **Extensible**: Designed with openness for adding more styling options in future updates.
162+
This adds formatting buttons (Bold, Italic, Strikethrough, etc.) to the text selection menu, allowing users to easily format selected text.
163+
## ✨ Key Features
83164

84-
## We Value Your Feedback 📬
165+
- **WhatsApp-like Formatting** - Familiar syntax that users already understand
166+
- **Backend-driven Styling** - Update text formatting from your server without app updates
167+
- **TypeSetEditingController** - Add rich text capabilities to input fields
168+
- **Dynamic Font Sizing** - Adjust text size inline for emphasis or hierarchy
169+
- **Context Menus** - Built-in support for copy/paste with formatting
170+
- **Highly Customizable** - Style each formatting type independently
171+
- **Lightweight** - Minimal dependencies for a smaller app footprint
172+
- **Well-tested** - 95%+ test coverage for production reliability
85173

86-
Have ideas for more features? Found a bug? Feel free to [open an issue][tracker] on our issue tracker. Your contributions make TypeSet better for everyone.
174+
## 🤝 Community & Support
87175

88-
## Keep Your App's Text Styling Dynamic and Engaging with TypeSet!
176+
- **[GitHub Issues][tracker]** - Report bugs or request features
177+
- **[GitHub Discussions](https://github.com/rohanjsh/typeset/discussions)** - Get help and share ideas
178+
- **[Pub.dev Documentation][pub_link]** - Detailed API documentation
89179

90-
---
180+
### Contributing
181+
182+
Contributions are welcome! Check out our [contribution guidelines](https://github.com/rohanjsh/typeset/blob/main/CONTRIBUTING.md) to get started.
91183

92-
Remember to include accurate links where necessary, like a link to the image of the demo snapshot, and the issue tracker. Also, replace the placeholder `^latest_version` with the actual latest version number of your package.
184+
### Support the Project
185+
186+
If TypeSet has been helpful for your projects, consider:
187+
- ⭐ Starring the repository
188+
- 🔄 Sharing with other developers
189+
- 💬 Providing feedback and suggestions
190+
- 🐛 Reporting bugs and issues
191+
192+
## 📝 License
193+
194+
TypeSet is available under the [Apache License, Version 2.0](https://github.com/rohanjsh/typeset/blob/main/LICENSE).
195+
196+
---
93197

94198

95199
[flutter_install_link]: https://docs.flutter.dev/get-started/install
@@ -109,5 +213,5 @@ Remember to include accurate links where necessary, like a link to the image of
109213
[pub_badge]: https://img.shields.io/pub/v/typeset.svg
110214
[pub_link]: https://pub.dev/packages/typeset
111215
[coverage_badge]: /coverage_badge.svg
112-
[build_badge]: https://img.shields.io/github/workflow/status/rohanjsh/typeset/ci.svg
216+
[build_badge]: https://img.shields.io/github/actions/workflow/status/rohanjsh/typeset/main.yaml
113217
[pub_points_badge]: https://img.shields.io/pub/points/typeset

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
97C146EC1CF9000F007C117D /* Resources */,
139139
9705A1C41CF9048500538489 /* Embed Frameworks */,
140140
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
141-
39BFEA8F06E16CFCB9002380 /* [CP] Embed Pods Frameworks */,
141+
ABA13FFC3C101274000616A6 /* [CP] Embed Pods Frameworks */,
142142
);
143143
buildRules = (
144144
);
@@ -219,23 +219,6 @@
219219
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
220220
showEnvVarsInLog = 0;
221221
};
222-
39BFEA8F06E16CFCB9002380 /* [CP] Embed Pods Frameworks */ = {
223-
isa = PBXShellScriptBuildPhase;
224-
buildActionMask = 2147483647;
225-
files = (
226-
);
227-
inputFileListPaths = (
228-
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
229-
);
230-
name = "[CP] Embed Pods Frameworks";
231-
outputFileListPaths = (
232-
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
233-
);
234-
runOnlyForDeploymentPostprocessing = 0;
235-
shellPath = /bin/sh;
236-
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
237-
showEnvVarsInLog = 0;
238-
};
239222
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
240223
isa = PBXShellScriptBuildPhase;
241224
alwaysOutOfDate = 1;
@@ -267,6 +250,23 @@
267250
shellPath = /bin/sh;
268251
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
269252
};
253+
ABA13FFC3C101274000616A6 /* [CP] Embed Pods Frameworks */ = {
254+
isa = PBXShellScriptBuildPhase;
255+
buildActionMask = 2147483647;
256+
files = (
257+
);
258+
inputFileListPaths = (
259+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
260+
);
261+
name = "[CP] Embed Pods Frameworks";
262+
outputFileListPaths = (
263+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
264+
);
265+
runOnlyForDeploymentPostprocessing = 0;
266+
shellPath = /bin/sh;
267+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
268+
showEnvVarsInLog = 0;
269+
};
270270
/* End PBXShellScriptBuildPhase section */
271271

272272
/* Begin PBXSourcesBuildPhase section */

0 commit comments

Comments
 (0)