Search packages, repositories and app categories

Package detailsv1.0.2

gradient_text

A Flutter Widget for displaying Text with a gradient drawn through it. Accepts TextStyle, and TextAlign so it can be used very similarly to a Text widget

30-day downloads
82
Likes
31
Pub points
40

Install package

flutter pub add gradient_text

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter widget that renders text with a gradient effect, allowing developers to apply smooth color transitions across individual characters or the entire text string. It supports standard TextStyle and TextAlign properties, making it compatible with existing text styling workflows. Ideal for creating visually engaging UI elements like headings, buttons, or labels with dynamic color effects. The package is lightweight and easy to integrate, requiring minimal configuration.

Use cases

  • Creating styled headlines with gradient effects
  • Adding visual flair to app buttons
  • Enhancing UI elements with dynamic color transitions
  • Designing modern splash screens
  • Implementing animated text in dashboards

Key features

  • Supports TextStyle and TextAlign
  • Smooth gradient rendering through text
  • Minimal setup required
  • Lightweight and performant
  • Compatible with standard Text widget properties

Suitable for

  • UI designers seeking visual enhancements
  • Developers building modern Flutter apps
  • Projects requiring gradient text without custom painting
  • Apps focused on aesthetic appeal

Considerations

  • Limited to text-only gradients (no background effects)
  • May impact performance on large text blocks
  • Gradient direction and stops require manual configuration
  • Not suitable for complex text layouts with multiple styles

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

GradientText

A Flutter Widget for displaying gradient text, text with a gradient drawn through it.

GradientTextScreenshot

Getting Started

Add the plugin (pub coming soon):

dependencies:
  ...
  gradient_text: ^1.0.2

Usage

Import it:

import 'package:gradient_text/gradient_text.dart';

Use it:

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.

Categories

Source repository

Projects using this package