woong
woong

Reputation: 17

I want to apply Flutter ListView

class Page1 extends StatefulWidget {
  Page1({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _Page1State createState() => _Page1State();
}

class _Page1State extends State<Page1> {
  @override
  Widget build(BuildContext context) {
    
    var dateSection =
        Row(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
      Text("날짜"),
      Padding(
        padding: EdgeInsets.all(10),
      ),
      Padding(
        padding: EdgeInsets.all(20),
      )
    ]);
    var placeSection =
        Row(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
      Text("도시락,식당"),
      Padding(
        padding: EdgeInsets.all(10),
      ),
    ]);

    var morningASection = Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          Text('조식A',style: TextStyle(fontSize:30,fontWeight: FontWeight.bold),),
          Padding(padding: EdgeInsets.all(10),),
          Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Text('현미밥',style: TextStyle(
                fontSize: 20,
              ),),
              Text('쌀밥',style: TextStyle(
              fontSize: 20,
    ),),
              Text('누룽',style: TextStyle(
                fontSize: 20,
              ),),
              Text('나주곰탕*다데',style: TextStyle(
                fontSize: 20,
              ),),
              Text('해물완자채소조림 ',style: TextStyle(
                fontSize: 20,
              ),),
              Text('맛살계란찜 ',style: TextStyle(
                fontSize: 20,
              ),),
              Text('양파돈채볶음 ',style: TextStyle(
                fontSize: 20,
              ),),
              Text('깐마늘무침 ',style: TextStyle(
                fontSize: 20,
              ),),
              Text('깍두기 ',style: TextStyle(
                fontSize: 20,
              ),),
              Text('바나나슬라이스',style: TextStyle(
                fontSize: 20,
              ),),

            ],
          )
          ,Padding(
            padding: EdgeInsets.all(10),
          ),


          ],);

    var underLine = Container(
         margin: const EdgeInsets.only(left:70,right: 70),
        child: Divider(
          color: Colors.black,
          height: 46,
        ));
    var morningBSection = Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Text('조식B',style: TextStyle(fontSize:30,fontWeight: FontWeight.bold),),
        Padding(padding: EdgeInsets.all(10),),
        Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text('현미밥',style: TextStyle(
              fontSize: 20,
            ),),
            Text('쌀밥',style: TextStyle(
              fontSize: 20,
            ),),
            Text('누룽',style: TextStyle(
              fontSize: 20,
            ),),
            Text('나주곰탕*다데',style: TextStyle(
              fontSize: 20,
            ),),
            Text('해물완자채소조림 ',style: TextStyle(
              fontSize: 20,
            ),),
            Text('맛살계란찜 ',style: TextStyle(
              fontSize: 20,
            ),),
            Text('양파돈채볶음 ',style: TextStyle(
              fontSize: 20,
            ),),
            Text('깐마늘무침 ',style: TextStyle(
              fontSize: 20,
            ),),
            Text('깍두기 ',style: TextStyle(
              fontSize: 20,
            ),),
            Text('바나나슬라이스',style: TextStyle(
              fontSize: 20,
            ),),

          ],
        )
        ,Padding(
          padding: EdgeInsets.all(10),
        ),


      ],);

    var EasyfoodSection =Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Text('간편식',style: TextStyle(fontSize:30,fontWeight: FontWeight.bold),),
        Padding(padding: EdgeInsets.all(10),),
        Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text('현미밥',style: TextStyle(
              fontSize: 20,
            ),),
            Text('쌀밥',style: TextStyle(
              fontSize: 20,
            ),),
            Text('누룽',style: TextStyle(
              fontSize: 20,
            ),),
            Text('나주곰탕*다데',style: TextStyle(
              fontSize: 20,
            ),),
                      ],
        )
        ,Padding(
          padding: EdgeInsets.all(10),
        ),


      ],);

    var NexticonSection = Row();
    var IconSection = Row();
    return MaterialApp(
        title: 'Food List1',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: Scaffold(
          appBar: AppBar(
            title: Text('식당'),
            leading: Icon(Icons.list),
          ),
          body: Column(children: <Widget>[
            dateSection,
            placeSection,
            morningASection,
            underLine,
            morningBSection,
            EasyfoodSection,
            NexticonSection,
            IconSection,
          ]),
        ));
  }
}

I want to apply this page as a listview but I don't know how to apply it.

It comes out when I search, but I don't know where to put the code.

Right now the screen is full of text so I can't see any other text. I wish I could scroll up and down. I would appreciate it if you could tell me the code that was applied. If it's hard, I'd also like a small hint

Upvotes: 0

Views: 54

Answers (2)

Amani Saaduddin
Amani Saaduddin

Reputation: 458

You can try wrapping your Scaffold body with SingleChildScrollView.

Upvotes: 2

Ghaith Chamieh
Ghaith Chamieh

Reputation: 33

There is lots of scrollable widgets in flutter search for SingleCHildScrollView, ListView, Sliver, and if you want there is a video tutorial on flutter channel in the boring show. how you can add them imagine your application as a tree first should come the material app then the scaffold to give a general backGround coloring ,appbar ,bottombar etc.. after that put your scroll widget depend on your need

Upvotes: 0

Related Questions