flutter
flutter background color 설정하기
햎피
2022. 6. 17. 16:43
반응형
플러터에서 전체 스크린의 배경색을 설정하는 방법을 알아보겠다.
materialapp을 만들어주는 쪽에서 theme을 추가해주면 된다.
return MaterialApp(
// your other app initialization code
theme: ThemeData(scaffoldBackgroundColor: Colors.white),
);
각 화면에서 배경색 설정하는 방법은
이렇게 scaffold 밑에 backgroundcolor로 배경색을 설정해주면 된다.
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Testing',
home: new Scaffold(
//Here you can set what ever background color you need.
backgroundColor: Colors.white,
),
);
}
}
반응형