localhost: 로컬호스트는 자신의 컴퓨터를 가리키는 호스트 이름입니다. 예를 들어, 브라우저에서 "localhost:8000"과 같이 입력하면 자신의 컴퓨터에서 실행 중인 로컬 웹 서버의 8000번 포트에 접속할 수 있습니다
PageView나 ListView는 유저의 행동에 따라서 작동되는데
유저의 행동을 제한하고 싶으면 어떤 속성 값을 설정해야하는지...
이거는 이해가 어려운운데 잘모르겠습니다;
ListView 위젯 안에 다른 ListView 위젯이 중첩되어 있습니다 Flutter에서는 ListView 위젯 안에 또 다른 ListView 위젯을 넣을 수 없습니다
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Container(
width: 1000,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
Colors.red,
Colors.orange,
Colors.yellow,
Colors.green,
Colors.blue,
Colors.purple,
],
)),
),
),
);
}
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'오늘의 하루는',
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
),
Text(
'어땠나요?',
style: TextStyle(
fontSize: 20,
color: Colors.grey,
),
),
SizedBox(
height: 200,
child: PageView(
scrollDirection: Axis.horizontal,
children: [
Container(
width: 300,
height: 200,
decoration: BoxDecoration(
color: Color.fromARGB(255, 54, 244, 152),
gradient: LinearGradient(
colors: [
Color.fromARGB(255, 42, 184, 99),
Color.fromARGB(255, 54, 244, 152),
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
child: Center(
child: Text(
'상쾌함',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 24,
),
),
),
),
Container(
width: 300,
height: 200,
decoration: BoxDecoration(
color: Color.fromARGB(255, 255, 178, 63),
gradient: LinearGradient(
colors: [
Color.fromARGB(255, 255, 172, 29),
Color.fromARGB(255, 251, 255, 129),
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
),
child: Center(
child: Text(
'행복함',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 24,
),
),
),
),
Container(
width: 300,
height: 200,
color: Colors.grey,
child: Center(
child: Text(
'우울함',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 24,
),
),
),
),
],
),
),
],
),
),
);
}
}