728x90
반응형
##appBar
1, main.dart
import 'package:flutter/material.dart';
import 'package:web_view/screen/home_screen.dart';
void main() {
runApp(
MaterialApp(
home: HomeScreen(
),
),
);
}
# 먼저 main.dart 에서는 가독성을 위하여 HomeScreen 이라는 함수를 만들어 import 하였다.
2, home_screen.dart
import 'package:flutter/material.dart';
class HomeScreen extends StatelessWidget {
const HomeScreen ({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Developer Hkkim'),
backgroundColor: Colors.green,
centerTitle: true,
titleTextStyle: TextStyle(
color: Colors.white,
fontSize: 20.0,
),
),
);
}
}
# appBar는 모바일 화면 맨위에 타이틀을 설정하는 명령어다.
# appBar는 title 이름을 지정하거나 backgroundColor , text 정렬 , textStyle 등 여러 설정이 가능하다.
728x90
반응형
'개발일기 > Flutter' 카테고리의 다른 글
Flutter#Image_Carousel (0) | 2024.02.29 |
---|---|
Flutter#WEB_VIEW#2.WebViewController (0) | 2024.02.28 |
Flutter#Row and Column#3 (0) | 2024.02.22 |
Flutter#Row and Column#2 (0) | 2024.02.21 |
Flutter#Row and Column#1 (1) | 2024.02.21 |