Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tunitowen/gradient_text
Flutter Widget to display gradient text
https://github.com/tunitowen/gradient_text
dart flutter flutter-plugin gradient text
Last synced: 5 days ago
JSON representation
Flutter Widget to display gradient text
- Host: GitHub
- URL: https://github.com/tunitowen/gradient_text
- Owner: tunitowen
- License: apache-2.0
- Created: 2018-12-20T17:35:33.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-10-12T12:13:05.000Z (about 3 years ago)
- Last Synced: 2024-08-01T12:25:20.408Z (3 months ago)
- Topics: dart, flutter, flutter-plugin, gradient, text
- Language: Dart
- Size: 142 KB
- Stars: 30
- Watchers: 2
- Forks: 9
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# GradientText
A Flutter Widget for displaying gradient text, text with a gradient drawn through it.
![GradientTextScreenshot](https://github.com/tunitowen/gradient_text/raw/master/gradient_text_screenshot.png "GradientText Example Screenshot")
# Getting Started
Add the plugin (pub coming soon):
```yaml
dependencies:
...
gradient_text: ^1.0.2
```# Usage
Import it:
```dart
import 'package:gradient_text/gradient_text.dart';
```Use it:
```dart
GradientText("this is my text",
gradient: LinearGradient(
colors: [Colors.deepPurple, Colors.deepOrange, Colors.pink]),
style: TextStyle(fontSize: 42),
textAlign: TextAlign.center);
```Parameters:
**data** :: (required) :: The `String` to be used in the `Text` Widget
**gradient** :: (required) :: A gradient to be drawn through the text
**style** :: (optional) :: `TextStyle` to be used in the `Text` Widget. Color is ignored, as the text must be white to have the gradient drawn.
**textAlign** :: (optional) :: `TextAlign` to be used in the `Text` Widget. Default is left.
# Credit
The idea to use `ShaderMask` came from Reddit user boformer. Thanks boformer.