こんにちは、フラメルです。
今回はAppBar
の背景色を変更する方法を紹介します。
目次
対処法


AppBar
の背景色を変更するにはbackgroundColor
を使用します。
下記コードではbackgroundColor
でColors
を使用して色を変更しています。
AppBar(
title: Text('Flutter'),
backgroundColor: Colors.purpleAccent,
),
サンプルコード
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Flutter'),
backgroundColor: Colors.purpleAccent,
),
),
);
}
}
以上です。