gradient_text
텍스트에 그라데이션을 그려서 표시하는 Flutter 위젯입니다. TextStyle과 TextAlign를 수락하므로 Text 위젯과 매우 유사하게 사용할 수 있습니다.
그라데이션 텍스트를 표시하는 Flutter 위젯
{"sdk":"flutter"}{"sdk":"flutter"}아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
A Flutter Widget for displaying gradient text, text with a gradient drawn through it.
GradientTextScreenshot
Add the plugin (pub coming soon):
dependencies:
...
gradient_text: ^1.0.2
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.
The idea to use ShaderMask came from Reddit user boformer. Thanks boformer.