플러터 Flutter 스크롤 뷰 간단 구현 Scroll View

반응형
  • 코드 작성
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyScrollableView(),
    );
  }
}

class MyScrollableView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Flutter Scroll View Example'),
      ),
      body: MyScrollViewContent(),
    );
  }
}

class MyScrollViewContent extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ListView(
      // Use children to specify the list of widgets inside the ListView
      children: <Widget>[
        ListTile(
          title: Text('Item 1'),
        ),
        ListTile(
          title: Text('Item 2'),
        ),
        ListTile(
          title: Text('Item 3'),
        ),
        // Add more ListTiles as needed
      ],
    );
  }
}

 

반응형