상대경로와 절대경로는 파일이나 디렉토리의 경로를 지정하는 방법입니다
상대경로는 현재 작업 중인 디렉토리를 기준으로 경로를 표시합니다
절대경로는 파일이나 디렉토리의 전체 경로를 표시합니다
Row위젯, Column위젯
mainAxisAlignment, crossAxisAlignment, mainAxisSize 속성:
mainAxisAlignment: 자식 위젯들을 주 축(main axis)을 기준으로 정렬하는 속성입니다.
crossAxisAlignment: 주 축과 수직축(cross axis)을 기준으로 자식 위젯들을 정렬하는 속성입니다.
mainAxisSize: 주 축의 길이를 얼마나 사용할 것인지를 결정하는 속성입니다.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Container(
height: 200,
width: 200,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.red,
Colors.orange,
Colors.yellow,
Colors.green,
Colors.blue,
Colors.purple,
],
),
),
),
),
),
);
}
}
2.아래의 이미지와 동일한 결과물을 만들고, 이를 만들기 위한 전체 코드를 작성하세요.
(그라디언트 색상 2개 이상, 색상 자유)
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Container(
height: 250,
width: 250,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(80),
topRight: Radius.circular(0),
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(80),
),
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
Colors.blue,
Colors.orange,
],
),
),
child: Container(
height: 10,
width: 10,
decoration: BoxDecoration(
color: Colors.orange,
borderRadius: BorderRadius.circular(100)),
),
),
),
),
);
}
}