Conditional statements for widgets can be used in different ways as per requirement.

Method 1: Using Ternary Operator

eg.

Center( 
      child: condition ? Widget1():  Widget2() 
  )

Method 2: Apply if…else in children property

eg.

Column(
      children: [
          if (condition)...[
             // Your widget1 here
          ] else if (condition)...[
             // Your widget2 here
          ] else...[
             // Your widget3 here
          ],
      ],
  ),

Method 3: Apply if…else on LayoutBuilder property

eg.

Container(
      child: LayoutBuilder(builder: (context, constraints) { 
          if (condition) {
              return Text("Y is greater than or equal to 10");
          } else {
              return Text("Y is less than 10");
          }  
      })
  )

Support On Demand!

                                         
Flutter