0

I'm new to flutter, I wanna show container if a specific value exists in Kinds model, the model contains stores, groceries and markets I don't know how to do it exactly please help me with my code the controller returns the json is kindController.kindDataList

so if market exist in the json then show

     child: HomeFlatBtn(image: 'market', height: 150, currentTab: 1,),



         Container(
          child: Padding(
            padding: EdgeInsets.symmetric(
                horizontal: Dimensions.PADDING_SIZE_SMALL),
            child: IntrinsicHeight(
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.stretch,
                children: [
                  Expanded(
                    child: Column(children: [
                      
                      Padding(
                        padding: EdgeInsets.symmetric(vertical: Dimensions
                            .PADDING_SIZE_SMALL,
                            horizontal: Dimensions.PADDING_SIZE_SMALL),
                        child: HomeFlatBtn(
                          image: 'market', height: 150, currentTab: 1,),
                      ),

                      Padding(
                        padding: EdgeInsets.symmetric(horizontal: Dimensions
                            .PADDING_SIZE_SMALL),

                        child: HomeFlatBtn(
                          image: 'grocery', height: 150, currentTab: 1,),
                      ),
                    ]
                    ),
                  ),
                  Expanded(child: HomeFlatBtn(image: 'food',
                      height: 0,
                      currentTab: 1),
                  ),
                ],
              ),
            ),
          ),
        ),
Ismail Muhammad
  • 320
  • 3
  • 15
  • Does this answer your question? [Show/hide widgets in Flutter programmatically](https://stackoverflow.com/questions/44489804/show-hide-widgets-in-flutter-programmatically) – Shourya Shikhar Nov 27 '21 at 13:34

1 Answers1

2

You can use Visibility widget for this.

Just wrap Container with Visibility. Like this:

Visibility(
  visible: true,  //set this to either true or false
  child: Container(
    //the contents of Container
  ),
),
//visible decides whether your Container will be visible or not.
Shourya Shikhar
  • 1,342
  • 1
  • 11
  • 29