[flutter] 플러터 Container에서 스크롤 가능한 화면을 만드는 방법은 무엇인가요?
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Scrollable Container'),
),
body: SingleChildScrollView(
child: Container(
height: 1000, // Adjust the height based on content
color: Colors.blue,
),
),
),
);
}
}
위 코드에서는 SingleChildScrollView로 Container를 감싸어 화면을 스크롤 가능하게 만들었습니다. 원하는 만큼의 높이를 설정하고, 그 안에 표시하고 싶은 컨텐츠를 추가하면 됩니다.
참고 자료: