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

added custom text selection actions #312

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions .idea/Animated-Text-Kit.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

196 changes: 196 additions & 0 deletions .idea/libraries/Dart_Packages.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions .idea/libraries/Dart_SDK.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/libraries/Flutter_Plugins.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 42 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,27 +281,48 @@ return SizedBox(

<img src="https://github.com/aagarwal1012/Animated-Text-Kit/blob/master/display/typewriter.gif?raw=true" align = "right" height = "300px">

```dart
return SizedBox(
width: 250.0,
child: DefaultTextStyle(
style: const TextStyle(
fontSize: 30.0,
fontFamily: 'Agne',
),
child: AnimatedTextKit(
animatedTexts: [
TypewriterAnimatedText('Discipline is the best tool'),
TypewriterAnimatedText('Design first, then code'),
TypewriterAnimatedText('Do not patch bugs out, rewrite them'),
TypewriterAnimatedText('Do not test bugs out, design them out'),
],
onTap: () {
print("Tap Event");
},
),
),
);
```
return SizedBox(
width: 250.0,
child: DefaultTextStyle(
style: const TextStyle(
fontSize: 30.0,
fontFamily: 'Agne',
),
child: AnimatedTextKit(
animatedTexts: [
TypewriterAnimatedText(
'Discipline is the best tool',
selectionActions: [
InkWell(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
color: Colors.black,
padding: const EdgeInsets.all(12),
child: Text(
'Custom action',
),
),
],
),
),
],
),
TypewriterAnimatedText('Design first, then code', cursor: '|'),
TypewriterAnimatedText('Do not patch bugs out, rewrite them',
cursor: '<|>'),
TypewriterAnimatedText('Do not test bugs out, design them out',
cursor: '💡'),
],
onTap: onTap,
),
),
),
```

## Scale
Expand Down
29 changes: 27 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ List<AnimatedTextExample> animatedTextExamples({VoidCallback? onTap}) =>
),
child: AnimatedTextKit(
animatedTexts: [
RotateAnimatedText('AWESOME'),
RotateAnimatedText(
'AWESOME',
),
RotateAnimatedText('OPTIMISTIC'),
RotateAnimatedText(
'DIFFERENT',
Expand Down Expand Up @@ -221,7 +223,30 @@ List<AnimatedTextExample> animatedTextExamples({VoidCallback? onTap}) =>
),
child: AnimatedTextKit(
animatedTexts: [
TypewriterAnimatedText('Discipline is the best tool'),
TypewriterAnimatedText(
'Discipline is the best tool',
selectionActions: (selectedText) {
return [
InkWell(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
color: Colors.black,
padding: const EdgeInsets.all(12),
child: Text(
'Custom action',
),
),
],
),
),
];
},
),
TypewriterAnimatedText('Design first, then code', cursor: '|'),
TypewriterAnimatedText('Do not patch bugs out, rewrite them',
cursor: '<|>'),
Expand Down
Loading