본문 바로가기

# 02/Flutter

[Flutter] How to use Expanded in SingleChildScrollView?

반응형

Instead of using SingleChildScrollView, It's easier to use CustomScrollView with a SliverFillRemaining.

Try this:

CustomScrollView(
  slivers: [
    SliverFillRemaining(
      hasScrollBody: false,
      child: Column(
        children: <Widget>[
          const Text('Header'),
          Expanded(child: Container(color: Colors.red)),
          const Text('Footer'),
        ],
      ),
    ),
  ],
)

 

 

 

출처 - https://stackoverflow.com/questions/56326005/how-to-use-expanded-in-singlechildscrollview

반응형

'# 02 > Flutter' 카테고리의 다른 글

[Flutter] show Performance Overlay  (0) 2022.09.01
[Flutter] Native Shared Preferences !  (0) 2022.06.15
[Flutter] scroll physics no bounce no scroll  (0) 2022.04.21
[Flutter] in app messaging  (0) 2022.03.11
[Flutter] RichText  (0) 2022.02.22