import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'STONE',
home: Grade(),
);
}
}
class Grade extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.amber[700],
appBar: AppBar(
title: Text('STONE'),
backgroundColor: Colors.amber[800],
centerTitle: true,
elevation: 0.0,
),
body: Padding(
padding: EdgeInsets.fromLTRB(30.0, 40.0, 0.0, 0.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: CircleAvatar(
backgroundImage: AssetImage('assets/stone1.gif'),
backgroundColor: Colors.amber[200],
radius: 60.0,
),
),
Divider(
height: 60.0,
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('STONE',
style: TextStyle(
color: Colors.white,
letterSpacing: 2.0,
fontSize: 28.0,
fontWeight: FontWeight.bold
),),
SizedBox(
height: 30.0,
),
Text('STONE 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: 30.0,
),
Row(
children: [
Icon(Icons.check_circle_outline),
SizedBox(
width: 10.0,
),
Text('using lightsaber',
style: TextStyle(
fontSize: 16.0,
letterSpacing: 1.0
),
)
],
),
Row(
children: [
Icon(Icons.check_circle_outline),
SizedBox(
width: 10.0,
),
Text('face hero tattoo',
style: TextStyle(
fontSize: 16.0,
letterSpacing: 1.0
),
)
],
),
Row(
children: [
Icon(Icons.check_circle_outline),
SizedBox(
width: 10.0,
),
Text('fire flames',
style: TextStyle(
fontSize: 16.0,
letterSpacing: 1.0
),
)
],
),
Center(
child: CircleAvatar(
backgroundImage: AssetImage('assets/stone1.gif'),
radius: 40.0,
backgroundColor: Colors.amber[700],
),
)
],
),
),
);
}
}
d
d
assets 폴더를 새로 만든 뒤, assets 폴더에 이미지 파일을 옮겨 넣는다.
이후 pubspec.yaml 파일을 열어서
//assets:
// - ~~~~
//- ~~~~~
되어 있는 부분을 드래그해서 전부 선택한 뒤, Ctrl + /로 주석 처리를 제거한다.
그 다음에 적혀있는 파일 경로를 assets/파일이름.확장자명 으로 적어서 수정해주면, 위 코드가 제대로 작동한다.
'개발 > Flutter' 카테고리의 다른 글
Flutter - 캐릭터 페이지 디자인 2 : 실전 코딩 1 (0) | 2022.03.21 |
---|---|
Flutter - 캐릭터 페이지 디자인 1 : 위젯 정리 (0) | 2022.03.16 |
Flutter - 앱페이지 기본 코드 이해 3 (0) | 2022.03.16 |
Flutter - 앱페이지 기본 코드 이해 2 (0) | 2022.03.15 |
Flutter - 프로젝트 폴더와 기본코드 이해 (0) | 2022.03.15 |