quote_painter 0.2.3 copy "quote_painter: ^0.2.3" to clipboard
quote_painter: ^0.2.3 copied to clipboard

Flutter package for rendering styled text on image/video canvas with gradient fill, stroke, shadow, decorative quotation marks, line badges, and themes.

quote_painter #

Pub Version Pub Points Pub Likes CI License Platform

A high-performance Flutter package for rendering beautifully styled text, inspirational quotes, titles, and captions over image/video canvas surfaces with gradients, outlines, multi-layer shadows, background highlight badges, decorative quote glyphs, ready-to-use themes, per-line overrides, and PNG export.

Now available on pub.flutter-io.cn/packages/quote_painter.


quote_painter screenshot


✨ Features #

  • 🌈 Gradient Fills β€” Full support for Linear and Radial gradients across text characters or solid colors.
  • πŸ–‹οΈ Strokes & Outlines β€” Configurable stroke widths, outline colors, and join styles to make text readable against any backdrop.
  • πŸŒ‘ Multi-Layer Shadows β€” Customizable blur radius, shadow color, and 2D offset for crisp depth.
  • 🏷️ Line Badges & Highlights β€” Add colored or gradient background pills/badges behind text lines (LineHighlight).
  • ❝ Decorative Quotation Marks β€” Typographic quote mark embellishments (QuoteMarkStyle) with smart placement (QuoteMarkPlacement).
  • 🎨 Pre-built Typography Themes β€” Quick start with QuoteThemes.editorial, QuoteThemes.cyberpunkNeon, QuoteThemes.minimalistDark, QuoteThemes.sunsetGlow, and QuoteThemes.highlightedBadge.
  • πŸ”„ Auto-Wrapping Helper β€” Split continuous text into properly constrained lines using QuotePainter.fromText(...).
  • πŸ“ Per-Line Customization β€” Override font size, color, gradient, stroke, and text alignment (left, center, right) per individual line.
  • 🌐 Unicode & Mixed Scripts β€” Full emoji, multilingual, and complex script support via Flutter's TextPainter.
  • πŸ–ΌοΈ High-Resolution PNG Export β€” Convert canvas designs directly to Uint8List bytes at custom pixel ratios (2x, 3x, 4x for 4K exports).

πŸ“¦ Installation #

Add quote_painter to your Flutter project:

flutter pub add quote_painter

Or add it to your pubspec.yaml dependencies:

dependencies:
  quote_painter: ^0.2.0

Then run flutter pub get and import:

import 'package:quote_painter/quote_painter.dart';

πŸš€ Usage #

1. Basic Quote Canvas with Presets #

Display a styled quote using built-in theme presets:

import 'package:flutter/material.dart';
import 'package:quote_painter/quote_painter.dart';

class QuoteCardDemo extends StatelessWidget {
  const QuoteCardDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return Center(
      child: QuoteCanvas(
        lines: const [
          TextLine('β€œThe greatest glory in living'),
          TextLine('lies not in never falling,'),
          TextLine('but in rising every time we fall.”'),
          TextLine(
            'β€” Nelson Mandela',
            style: LineStyle(
              fontSize: 16,
              fontWeight: FontWeight.w400,
              color: Colors.white70,
              textAlign: TextAlign.right,
            ),
          ),
        ],
        quoteStyle: QuoteThemes.cyberpunkNeon,
        width: 360,
        height: 260,
        backgroundDecoration: BoxDecoration(
          borderRadius: BorderRadius.circular(16),
          color: const Color(0xFF0F172A),
          boxShadow: const [
            BoxShadow(
              color: Colors.black45,
              blurRadius: 16,
              offset: Offset(0, 8),
            ),
          ],
        ),
        padding: const EdgeInsets.all(24),
      ),
    );
  }
}

2. Auto-Wrapping Long Quotes (fromText) #

Generate canvas lines automatically for continuous text:

final painter = QuotePainter.fromText(
  text: 'Creativity is intelligence having fun.',
  quoteStyle: QuoteThemes.editorial,
  maxWidth: 320,
  maxHeight: 200,
);

3. Decorative Quotation Marks & Line Badges #

final customStyle = QuoteStyle(
  fontSize: 24,
  fontWeight: FontWeight.bold,
  color: Colors.white,
  defaultHighlight: const LineHighlight(
    color: Color(0x3300E5FF),
    borderRadius: BorderRadius.all(Radius.circular(6)),
    padding: EdgeInsets.symmetric(horizontal: 10, vertical: 4),
  ),
  quoteMarkStyle: const QuoteMarkStyle(
    show: true,
    color: Color(0x4400E5FF),
    fontSize: 50,
    placement: QuoteMarkPlacement.topLeft,
  ),
);

4. Exporting Canvas to PNG #

Easily capture the painted canvas as a PNG image for sharing or video composition:

import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:quote_painter/quote_painter.dart';

final GlobalKey canvasKey = GlobalKey();

// In widget tree:
QuoteCanvas(
  key: canvasKey,
  lines: lines,
  quoteStyle: style,
  width: 1080,
  height: 1920,
)

// In export button callback:
Future<void> saveQuoteImage() async {
  final Uint8List pngBytes = await exportToPng(canvasKey, pixelRatio: 3.0);
  // Save or share pngBytes
}

πŸ› οΈ Architecture & API Reference #

Class Description
QuoteCanvas Interactive/static Flutter widget managing layout, bounding constraints, and export boundary.
QuotePainter Core CustomPainter rendering lines, gradients, strokes, shadows, and quote marks.
QuotePainter.fromText Factory constructing QuotePainter with automatic word-wrap layout.
QuoteStyle Styling configuration (font, gradients, drop shadows, highlights, quote marks).
QuoteThemes Out-of-the-box typography presets (editorial, cyberpunkNeon, minimalistDark, sunsetGlow, etc.).
LineHighlight Background badge / pill styling per text line.
QuoteMarkStyle Typographic quotation marks configuration and placement.
exportToPng Headless rasterizer converting a QuoteCanvas into PNG bytes.

πŸ§ͺ Testing #

flutter test

Explore complementary production-grade libraries built for high-performance Flutter & Dart development:

Package Description Version
country_mobile_validator Zero-dependency per-country mobile validation (249 ISO regions). ^0.2.0
currency_field_formatter Exact cursor-tracking currency and financial input formatter. ^1.1.0
ambient_backdrop_glow Dynamic ambient background glow & fluid OKLab mesh gradients. ^1.1.0
segmented_ring_painter High-performance segmented progress & concentric activity rings. ^1.1.0
scratch_reveal GPU-accelerated scratch cards with sub-ms bitmask area tracking. ^1.1.0
offline_outbox Offline-first resilient transactional outbox and retry queue. ^1.1.0
cron_schedule Pure-Dart cron expression parser, predictor & fluent builder. ^1.1.0
flutter_whisper On-device speech-to-text transcription powered by whisper.cpp. ^0.2.0
waveform_pro Audio waveform visualizer with discrete bars, splines & live buffer. ^1.1.2

πŸ“„ License #

This package is licensed under the MIT License.

2
likes
160
points
493
downloads

Documentation

API reference

Publisher

verified publishergovindtank.is-a.dev

Weekly Downloads

Flutter package for rendering styled text on image/video canvas with gradient fill, stroke, shadow, decorative quotation marks, line badges, and themes.

Repository (GitHub)
View/report issues

Topics

#text #canvas #image #rendering #quote

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on quote_painter