반응형
위젯 UI 배치 연습
main.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'BBANTO',
home: Grade(),
);
}
}
class Grade extends StatelessWidget {
const Grade({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.amber[800],
appBar: AppBar(
title: Text('BBANTO'),
backgroundColor: Colors.amber[700],
elevation: 0.0,
),
body: Padding(
padding: const EdgeInsets.fromLTRB(30.0, 40.0, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: CircleAvatar(
backgroundImage: AssetImage('./assets/bbanto.gif'),
radius: 60.0,
),
),
SizedBox(
height: 10.0,
),
Divider(
height: 60.0, // margin top & bottom
color: Colors.grey[850],
thickness: 0.5,
endIndent: 30.0,
),
Text('Name',
style: TextStyle(
color: Colors.white,
letterSpacing: 2.0
),),
SizedBox(
height: 10.0,
),
Text('BBANTO',
style: TextStyle(
color: Colors.white,
letterSpacing: 2.0,
fontSize: 28.0,
fontWeight: FontWeight.bold
),),
SizedBox(
height: 30.0,
),
Text('BBANTO POWER LEVEL',
style: TextStyle(
color: Colors.white,
letterSpacing: 2.0
),),
SizedBox(
height: 10.0,
),
Text('14',
style: TextStyle(
color: Colors.white,
letterSpacing: 2.0,
fontSize: 28.0,
fontWeight: FontWeight.bold
),),
SizedBox(
height: 10.0,
),
Row(
children: [
Icon(Icons.check_circle_outline),
SizedBox(width: 10.0),
Text('Using lightsaber',
style: TextStyle(
fontSize: 16.0,
letterSpacing: 1.0
),)
],
),
SizedBox(
height: 10.0,
),
Row(
children: [
Icon(Icons.check_circle_outline),
SizedBox(width: 10.0),
Text('face hero tattoo',
style: TextStyle(
fontSize: 16.0,
letterSpacing: 1.0
),)
],
),
SizedBox(
height: 10.0,
),
Row(
children: [
Icon(Icons.check_circle_outline),
SizedBox(width: 10.0),
Text('Fire flames',
style: TextStyle(
fontSize: 16.0,
letterSpacing: 1.0
),)
],
),
SizedBox(height: 10,),
Center(
child: CircleAvatar(
backgroundImage: AssetImage('assets/bbanto.jpeg'),
radius: 40,
backgroundColor: Colors.amber[800],
)
)
],
),
),
bottomNavigationBar: BottomAppBar(
height: 50.0,
child:
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Icon(Icons.call),
Icon(Icons.menu),
Icon(Icons.message),
],
),
),
);
}
}
perspec.yaml
flutter: 밑에
assets:
- assets/bbanto.jpeg
- assets/bbanto.gif
추가
assets 폴더 생성
- bbanto.jpeg
- bbanto.gif
'Flutter with dart' 카테고리의 다른 글
[Flutter] WebView 위젯 (0) | 2023.09.25 |
---|---|
[Flutter] 플러터 위젯 정리 (0) | 2023.09.24 |
[Flutter] 플러터 프로젝트 구조 (0) | 2023.07.19 |
[dart] dart(다트) - List 타입 (0) | 2023.06.22 |
[dart] dart(다트) - 기초 문법 (0) | 2023.06.22 |