main.dart
import 'package:flutter/material.dart';
void main(){
runApp(
MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text("Flutter - Text Gradient Background")
),
body: Center(
child: Text(
"Lorem Ipsum is simply dummy text.",
style: TextStyle(
fontSize: 70,
background: Paint()
..shader = const RadialGradient(
colors: [
Colors.pink,Colors.yellow
],
).createShader(
const Rect.fromLTWH(0, 0, 300, 600)
)
),
textAlign: TextAlign.center,
)
),
),
)
);
}
More flutter tutorials
- flutter – How to draw a line through the Text
- flutter – How to set Text line height
- flutter – How to overline Text
- flutter – How to draw Text outline
- flutter – Gradient Text
- flutter – How to set Text letter spacing
- flutter – Text capitalize first letter
- flutter – ElevatedButton onPressed
- flutter – How to add padding to ElevatedButton
- flutter – How to change ElevatedButton shape
- flutter – How to create rounded corners ElevatedButton
- flutter – ElevatedButton border radius only
- flutter – How to change OutlinedButton splash color
- flutter – How to add padding to OutlinedButton
- flutter – OutlinedButton shape