0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Flutterで背景にグラデーションを設定する方法

0
Posted at

背景にグラデーションを設定する方法です。

グラデーションの設定方法

Flutterでは、Container の decoration を使ってグラデーションを設定します。

.dart
Scaffold(
 body: Container(
   decoration: const BoxDecoration(
     gradient: LinearGradient(
       colors: [Color(0xFFF6A55F), Color(0xFFFF7A4E)],
       begin: Alignment.topCenter,
       end: Alignment.bottomCenter,
     ),
   ),
 ),
) 

colors → グラデーションの色(配列)
begin → 開始位置
end → 終了位置

背景として使用する場合は、Scaffoldのbodyをラップします。

実行結果

Screenshot_20260410_164348.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?