'Return two design elements in builder

       Widget build(BuildContext context) {
    super.build(context);
    return Scaffold(
...
...
...

builder: (BuildContext context) { //BuildContext context
              final innerScrollController = PrimaryScrollController.of(context);
              return TabMedium(
                sc: innerScrollController,
                tc: _tabController,
              );
              return  BannerAdAdmob();            
            }

For now, it shows only TabMedium() view. How can I put top & bottom these views?

What do I get?

enter image description here

What do I want?

enter image description here

Thanks...



Solution 1:[1]

You can not add two return, only first return will be executed. If you want to show two widget as you show in the picture you can use Column.

       Widget build(BuildContext context) {
    super.build(context);
    return Scaffold(
...
...
...

builder: (BuildContext context) { //BuildContext context
              final innerScrollController = PrimaryScrollController.of(context);
              return Column(
               mainAxisSize: MainAxisSize.max,
               children:[
                 Expanded(
                   child:TabMedium(
                           sc: innerScrollController,
                           tc: _tabController,
                   ),
                 ),
                 BannerAdAdmob(),
               ],
              );         
            }

Solution 2:[2]

this happens bcs you just return one of them.

try to put them in a Column, maybe like this:

(I did not Compiled it but it should work)

builder: (BuildContext context) { //BuildContext context
          final innerScrollController = PrimaryScrollController.of(context);
          return Column(
           mainAxisSize: MainAxisSize.max,
            children[
              TabMedium(
              sc: innerScrollController,
              tc: _tabController,
              ),
              BannerAdAdmob(),  
            ],


          );
          
              
        }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Miftakhul Arzak
Solution 2 YaHoova