rainbow_text 0.0.1
rainbow_text: ^0.0.1 copied to clipboard
A customizable Flutter widget for rendering text with beautiful linear gradients.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:rainbow_text/rainbow_text.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Rainbow Text Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Rainbow Text Demo'),
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const RainbowText(
'Hello Rainbow!',
colors: [Colors.red, Colors.blue, Colors.green],
style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold),
),
const SizedBox(height: 20),
RainbowText(
'Vertical Gradient',
colors: const [Colors.orange, Colors.purple],
style: const TextStyle(fontSize: 40, fontWeight: FontWeight.bold),
direction: GradientDirection.vertical,
),
const SizedBox(height: 20),
RainbowText(
'More Colors',
colors: const [
Colors.red,
Colors.orange,
Colors.yellow,
Colors.green,
Colors.blue,
Colors.indigo,
Colors.purple,
],
style: const TextStyle(fontSize: 40, fontWeight: FontWeight.bold),
),
],
),
),
);
}
}