flutter how can I make this whole page scrollable?












0















I'm stuck with how to fix this problem.
What I want to achieve is make whole this page scrollable.
So, when you scroll down, top portion of page will invisible and only TabBarView is visible.

I have this code.



return DefaultTabController(
length: 3,
child: Scaffold(
appBar: AppBar(
elevation: 0.0,
backgroundColor: Colors.white,
),
body: ListView(
shrinkWrap: true,
children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(15.0, 30.0, 15.0, 5.0),
child: Column(
children: <Widget>[
ListTile(
leading: CircleAvatar(backgroundImage: NetworkImage('https://images.unsplash.com/photo-1543194094-3fb5703804d5?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=cb818de45a33597672b648166ce73764&auto=format&fit=crop&w=500&q=60'), radius: 42.0),
title: RaisedButton(
textColor: Colors.white,
child: Text(
'Edit Profile',
maxLines: 1,
),
color: Theme.of(context).primaryColor,
onPressed: () {},
),
),
Padding(
padding: const EdgeInsets.only(top: 22.0, bottom: 5.0, left: 30.0),
child: Row(
children: <Widget>[
Flexible(
child: Text(
'Spider-Man',
style: const TextStyle(fontSize: 16.0),
overflow: TextOverflow.ellipsis,
),
),
const SizedBox(width: 1.0),
Icon(Icons.check_circle, size: 16.0, color: Theme.of(context).primaryColor),
],
),
),
],
),
),
Container(
width: double.infinity,
height: 40.0,
decoration: const BoxDecoration(color: Colors.white),
child: TabBar(
controller: _controller,
labelColor: Colors.black,
indicatorColor: Theme.of(context).primaryColor,
unselectedLabelColor: Colors.grey,
tabs: [
Tab(text: 'Following'),
Tab(text: 'Follower'),
Tab(text: 'Likes'),
],
),
),
Expanded(
child: TabBarView(
physics: const NeverScrollableScrollPhysics(),
controller: _controller,
children:
[
Center(
child: Text('Following'),
),
Center(
child: Text('Follower'),
),
ListView.builder(
itemCount: 100,
itemExtent: 100.0,
itemBuilder: (c ,i) {
return Center(
child: Text(i.toString())
);
},
)
]
),
)
],
)
),
);


But because of Expanded console says




flutter: Incorrect use of ParentDataWidget.




And I tried to wrap Column or Flex but console says those this time




RenderFlex children have non-zero flex but incoming height constraints are unbounded.




How can I make this whole page scrollable?










share|improve this question



























    0















    I'm stuck with how to fix this problem.
    What I want to achieve is make whole this page scrollable.
    So, when you scroll down, top portion of page will invisible and only TabBarView is visible.

    I have this code.



    return DefaultTabController(
    length: 3,
    child: Scaffold(
    appBar: AppBar(
    elevation: 0.0,
    backgroundColor: Colors.white,
    ),
    body: ListView(
    shrinkWrap: true,
    children: <Widget>[
    Padding(
    padding: const EdgeInsets.fromLTRB(15.0, 30.0, 15.0, 5.0),
    child: Column(
    children: <Widget>[
    ListTile(
    leading: CircleAvatar(backgroundImage: NetworkImage('https://images.unsplash.com/photo-1543194094-3fb5703804d5?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=cb818de45a33597672b648166ce73764&auto=format&fit=crop&w=500&q=60'), radius: 42.0),
    title: RaisedButton(
    textColor: Colors.white,
    child: Text(
    'Edit Profile',
    maxLines: 1,
    ),
    color: Theme.of(context).primaryColor,
    onPressed: () {},
    ),
    ),
    Padding(
    padding: const EdgeInsets.only(top: 22.0, bottom: 5.0, left: 30.0),
    child: Row(
    children: <Widget>[
    Flexible(
    child: Text(
    'Spider-Man',
    style: const TextStyle(fontSize: 16.0),
    overflow: TextOverflow.ellipsis,
    ),
    ),
    const SizedBox(width: 1.0),
    Icon(Icons.check_circle, size: 16.0, color: Theme.of(context).primaryColor),
    ],
    ),
    ),
    ],
    ),
    ),
    Container(
    width: double.infinity,
    height: 40.0,
    decoration: const BoxDecoration(color: Colors.white),
    child: TabBar(
    controller: _controller,
    labelColor: Colors.black,
    indicatorColor: Theme.of(context).primaryColor,
    unselectedLabelColor: Colors.grey,
    tabs: [
    Tab(text: 'Following'),
    Tab(text: 'Follower'),
    Tab(text: 'Likes'),
    ],
    ),
    ),
    Expanded(
    child: TabBarView(
    physics: const NeverScrollableScrollPhysics(),
    controller: _controller,
    children:
    [
    Center(
    child: Text('Following'),
    ),
    Center(
    child: Text('Follower'),
    ),
    ListView.builder(
    itemCount: 100,
    itemExtent: 100.0,
    itemBuilder: (c ,i) {
    return Center(
    child: Text(i.toString())
    );
    },
    )
    ]
    ),
    )
    ],
    )
    ),
    );


    But because of Expanded console says




    flutter: Incorrect use of ParentDataWidget.




    And I tried to wrap Column or Flex but console says those this time




    RenderFlex children have non-zero flex but incoming height constraints are unbounded.




    How can I make this whole page scrollable?










    share|improve this question

























      0












      0








      0








      I'm stuck with how to fix this problem.
      What I want to achieve is make whole this page scrollable.
      So, when you scroll down, top portion of page will invisible and only TabBarView is visible.

      I have this code.



      return DefaultTabController(
      length: 3,
      child: Scaffold(
      appBar: AppBar(
      elevation: 0.0,
      backgroundColor: Colors.white,
      ),
      body: ListView(
      shrinkWrap: true,
      children: <Widget>[
      Padding(
      padding: const EdgeInsets.fromLTRB(15.0, 30.0, 15.0, 5.0),
      child: Column(
      children: <Widget>[
      ListTile(
      leading: CircleAvatar(backgroundImage: NetworkImage('https://images.unsplash.com/photo-1543194094-3fb5703804d5?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=cb818de45a33597672b648166ce73764&auto=format&fit=crop&w=500&q=60'), radius: 42.0),
      title: RaisedButton(
      textColor: Colors.white,
      child: Text(
      'Edit Profile',
      maxLines: 1,
      ),
      color: Theme.of(context).primaryColor,
      onPressed: () {},
      ),
      ),
      Padding(
      padding: const EdgeInsets.only(top: 22.0, bottom: 5.0, left: 30.0),
      child: Row(
      children: <Widget>[
      Flexible(
      child: Text(
      'Spider-Man',
      style: const TextStyle(fontSize: 16.0),
      overflow: TextOverflow.ellipsis,
      ),
      ),
      const SizedBox(width: 1.0),
      Icon(Icons.check_circle, size: 16.0, color: Theme.of(context).primaryColor),
      ],
      ),
      ),
      ],
      ),
      ),
      Container(
      width: double.infinity,
      height: 40.0,
      decoration: const BoxDecoration(color: Colors.white),
      child: TabBar(
      controller: _controller,
      labelColor: Colors.black,
      indicatorColor: Theme.of(context).primaryColor,
      unselectedLabelColor: Colors.grey,
      tabs: [
      Tab(text: 'Following'),
      Tab(text: 'Follower'),
      Tab(text: 'Likes'),
      ],
      ),
      ),
      Expanded(
      child: TabBarView(
      physics: const NeverScrollableScrollPhysics(),
      controller: _controller,
      children:
      [
      Center(
      child: Text('Following'),
      ),
      Center(
      child: Text('Follower'),
      ),
      ListView.builder(
      itemCount: 100,
      itemExtent: 100.0,
      itemBuilder: (c ,i) {
      return Center(
      child: Text(i.toString())
      );
      },
      )
      ]
      ),
      )
      ],
      )
      ),
      );


      But because of Expanded console says




      flutter: Incorrect use of ParentDataWidget.




      And I tried to wrap Column or Flex but console says those this time




      RenderFlex children have non-zero flex but incoming height constraints are unbounded.




      How can I make this whole page scrollable?










      share|improve this question














      I'm stuck with how to fix this problem.
      What I want to achieve is make whole this page scrollable.
      So, when you scroll down, top portion of page will invisible and only TabBarView is visible.

      I have this code.



      return DefaultTabController(
      length: 3,
      child: Scaffold(
      appBar: AppBar(
      elevation: 0.0,
      backgroundColor: Colors.white,
      ),
      body: ListView(
      shrinkWrap: true,
      children: <Widget>[
      Padding(
      padding: const EdgeInsets.fromLTRB(15.0, 30.0, 15.0, 5.0),
      child: Column(
      children: <Widget>[
      ListTile(
      leading: CircleAvatar(backgroundImage: NetworkImage('https://images.unsplash.com/photo-1543194094-3fb5703804d5?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=cb818de45a33597672b648166ce73764&auto=format&fit=crop&w=500&q=60'), radius: 42.0),
      title: RaisedButton(
      textColor: Colors.white,
      child: Text(
      'Edit Profile',
      maxLines: 1,
      ),
      color: Theme.of(context).primaryColor,
      onPressed: () {},
      ),
      ),
      Padding(
      padding: const EdgeInsets.only(top: 22.0, bottom: 5.0, left: 30.0),
      child: Row(
      children: <Widget>[
      Flexible(
      child: Text(
      'Spider-Man',
      style: const TextStyle(fontSize: 16.0),
      overflow: TextOverflow.ellipsis,
      ),
      ),
      const SizedBox(width: 1.0),
      Icon(Icons.check_circle, size: 16.0, color: Theme.of(context).primaryColor),
      ],
      ),
      ),
      ],
      ),
      ),
      Container(
      width: double.infinity,
      height: 40.0,
      decoration: const BoxDecoration(color: Colors.white),
      child: TabBar(
      controller: _controller,
      labelColor: Colors.black,
      indicatorColor: Theme.of(context).primaryColor,
      unselectedLabelColor: Colors.grey,
      tabs: [
      Tab(text: 'Following'),
      Tab(text: 'Follower'),
      Tab(text: 'Likes'),
      ],
      ),
      ),
      Expanded(
      child: TabBarView(
      physics: const NeverScrollableScrollPhysics(),
      controller: _controller,
      children:
      [
      Center(
      child: Text('Following'),
      ),
      Center(
      child: Text('Follower'),
      ),
      ListView.builder(
      itemCount: 100,
      itemExtent: 100.0,
      itemBuilder: (c ,i) {
      return Center(
      child: Text(i.toString())
      );
      },
      )
      ]
      ),
      )
      ],
      )
      ),
      );


      But because of Expanded console says




      flutter: Incorrect use of ParentDataWidget.




      And I tried to wrap Column or Flex but console says those this time




      RenderFlex children have non-zero flex but incoming height constraints are unbounded.




      How can I make this whole page scrollable?







      flutter flutter-layout






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 26 '18 at 20:00









      DaibakuDaibaku

      5001212




      5001212
























          1 Answer
          1






          active

          oldest

          votes


















          1














          The issue is with the parent of your TabBarView, if you use Expanded it doesn't know how much it will have to expand because there are no constraints for ListView.



          Replace your Expanded by SizedBox or Container with a fixed height:



          SizedBox(
          height: 600.0,
          child: TabBarView(





          share|improve this answer
























          • Thank you always diegoveloper for your help! It worked! But is there any way to fix without fixed height? Since I want to set ListView.builder's physics to NeverScrollableScrollPhysics because two scrollable ListView working kind of weird.

            – Daibaku
            Nov 27 '18 at 4:03











          • You could use MediaQuery to get the height of the screen and play with those values.

            – diegoveloper
            Nov 27 '18 at 4:05











          • I'll try that thank you!

            – Daibaku
            Nov 27 '18 at 4:51











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53488158%2fflutter-how-can-i-make-this-whole-page-scrollable%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          The issue is with the parent of your TabBarView, if you use Expanded it doesn't know how much it will have to expand because there are no constraints for ListView.



          Replace your Expanded by SizedBox or Container with a fixed height:



          SizedBox(
          height: 600.0,
          child: TabBarView(





          share|improve this answer
























          • Thank you always diegoveloper for your help! It worked! But is there any way to fix without fixed height? Since I want to set ListView.builder's physics to NeverScrollableScrollPhysics because two scrollable ListView working kind of weird.

            – Daibaku
            Nov 27 '18 at 4:03











          • You could use MediaQuery to get the height of the screen and play with those values.

            – diegoveloper
            Nov 27 '18 at 4:05











          • I'll try that thank you!

            – Daibaku
            Nov 27 '18 at 4:51
















          1














          The issue is with the parent of your TabBarView, if you use Expanded it doesn't know how much it will have to expand because there are no constraints for ListView.



          Replace your Expanded by SizedBox or Container with a fixed height:



          SizedBox(
          height: 600.0,
          child: TabBarView(





          share|improve this answer
























          • Thank you always diegoveloper for your help! It worked! But is there any way to fix without fixed height? Since I want to set ListView.builder's physics to NeverScrollableScrollPhysics because two scrollable ListView working kind of weird.

            – Daibaku
            Nov 27 '18 at 4:03











          • You could use MediaQuery to get the height of the screen and play with those values.

            – diegoveloper
            Nov 27 '18 at 4:05











          • I'll try that thank you!

            – Daibaku
            Nov 27 '18 at 4:51














          1












          1








          1







          The issue is with the parent of your TabBarView, if you use Expanded it doesn't know how much it will have to expand because there are no constraints for ListView.



          Replace your Expanded by SizedBox or Container with a fixed height:



          SizedBox(
          height: 600.0,
          child: TabBarView(





          share|improve this answer













          The issue is with the parent of your TabBarView, if you use Expanded it doesn't know how much it will have to expand because there are no constraints for ListView.



          Replace your Expanded by SizedBox or Container with a fixed height:



          SizedBox(
          height: 600.0,
          child: TabBarView(






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 26 '18 at 21:28









          diegoveloperdiegoveloper

          12.5k11630




          12.5k11630













          • Thank you always diegoveloper for your help! It worked! But is there any way to fix without fixed height? Since I want to set ListView.builder's physics to NeverScrollableScrollPhysics because two scrollable ListView working kind of weird.

            – Daibaku
            Nov 27 '18 at 4:03











          • You could use MediaQuery to get the height of the screen and play with those values.

            – diegoveloper
            Nov 27 '18 at 4:05











          • I'll try that thank you!

            – Daibaku
            Nov 27 '18 at 4:51



















          • Thank you always diegoveloper for your help! It worked! But is there any way to fix without fixed height? Since I want to set ListView.builder's physics to NeverScrollableScrollPhysics because two scrollable ListView working kind of weird.

            – Daibaku
            Nov 27 '18 at 4:03











          • You could use MediaQuery to get the height of the screen and play with those values.

            – diegoveloper
            Nov 27 '18 at 4:05











          • I'll try that thank you!

            – Daibaku
            Nov 27 '18 at 4:51

















          Thank you always diegoveloper for your help! It worked! But is there any way to fix without fixed height? Since I want to set ListView.builder's physics to NeverScrollableScrollPhysics because two scrollable ListView working kind of weird.

          – Daibaku
          Nov 27 '18 at 4:03





          Thank you always diegoveloper for your help! It worked! But is there any way to fix without fixed height? Since I want to set ListView.builder's physics to NeverScrollableScrollPhysics because two scrollable ListView working kind of weird.

          – Daibaku
          Nov 27 '18 at 4:03













          You could use MediaQuery to get the height of the screen and play with those values.

          – diegoveloper
          Nov 27 '18 at 4:05





          You could use MediaQuery to get the height of the screen and play with those values.

          – diegoveloper
          Nov 27 '18 at 4:05













          I'll try that thank you!

          – Daibaku
          Nov 27 '18 at 4:51





          I'll try that thank you!

          – Daibaku
          Nov 27 '18 at 4:51




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53488158%2fflutter-how-can-i-make-this-whole-page-scrollable%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Contact image not getting when fetch all contact list from iPhone by CNContact

          count number of partitions of a set with n elements into k subsets

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks