반응형
appbar 부분 배경색이 존재하지 않는다.
플러터 appbar에 색상을 추가해주려면,
them 속성에서 primarySwatch를 본인이 원하는 색으로 추가해 준다.
primarySwatch: Colors.blue
수정 전 main.dart 코드
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const RegisterPage(),
);
}
}
class RegisterPage extends StatefulWidget {
const RegisterPage({super.key});
@override
State<RegisterPage> createState() => _RegisterPageState();
}
class _RegisterPageState extends State<RegisterPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('회원가입 페이지'),
),
);
}
}
불필요한 속성은 삭제해 주고 primarySwatch를 추가해 주었다.
수정 후 main.dart 코드
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
//primarySwatch 추가
primarySwatch: Colors.blue,
),
home: const RegisterPage(),
//debug 표시 삭제 속성
debugShowCheckedModeBanner: false,
);
}
}
class RegisterPage extends StatefulWidget {
const RegisterPage({super.key});
@override
State<RegisterPage> createState() => _RegisterPageState();
}
class _RegisterPageState extends State<RegisterPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('회원가입 페이지'),
),
);
}
}
수정 후 플러터 화면
반응형
'Dart&Flutter' 카테고리의 다른 글
[ Flutter ] PathExistsException: Cannot create link, path 오류 해결 (0) | 2023.08.31 |
---|---|
[ Flutter ] Spring & DB 연동해서 User 정보 저장하기 (0) | 2023.08.31 |
[ Flutter ] Flutter 프로젝트 만들기, 프로젝트 생성 하는 방법 (0) | 2023.08.23 |
[Flutter] Hello World 출력 소스 코드 (0) | 2023.08.21 |
[Flutter] windows에서 Flutter 설치 방법 & 프로젝트 생성까지 비전공자도 쉽게 가능하게 상세한 설명 (0) | 2023.08.20 |
댓글