본문 바로가기
기초다지기/Flutter&Dart

Flutter Widget LinearGradient

by 김빵그 2023. 5. 22.
  • 그라데이션 컬러를 이용할 때 LinearGradient를 사용하게 된다. 적어도 두가지 색상은 이용해야한다
  • stops : 기본적으로 그라데이션의 모든 색상은 고르게 분포되어있지만,  stops를 사용하여 정확하게 정의할 수도 있다
  • begin , end: 그라데이션 방향, 두 앵커 포인트를 지정할 수 있다
  • 그외  ShaderMask 를 사용하여 문자로도 꾸밀수 있다
Container(
	decoration : const BoxDecoration(
    	gradient : LinearGradient(
        	colors:[
            	Color(0xff0273Fd),
                Color(0xff4100e0),
            ], 
            stops:[0.1, 0.75],
            begin : Alignment.topLeft,
            end : Alignment.bottomRight,
        )
    )
)

 

 

LinearGradient class - painting library - Dart API

A 2D linear gradient. This class is used by BoxDecoration to represent linear gradients. This abstracts out the arguments to the ui.Gradient.linear constructor from the dart:ui library. A gradient has two anchor points, begin and end. The begin point corre

api.flutter.dev

 

 

'기초다지기 > Flutter&Dart' 카테고리의 다른 글

flutter splash 화면 구현하기  (0) 2023.05.31
Flutter FloatingActionButton  (0) 2023.05.22
Flutter Provider?  (0) 2023.05.21
flutter hasSize Colume ListView error  (0) 2023.05.13
[dart] 문자열 중복 카운트 구하기  (1) 2023.04.17