Codelessly / ResponsiveFramework

Easily make Flutter apps responsive. Automatically adapt UI to different screen sizes. Responsiveness made simple. Demo: https://gallery.codelessly.com/flutterwebsites/minimal/
https://codelessly.com
MIT License
1.28k stars 151 forks source link

Add Conditions to ResponsiveRowColumnItem #120

Closed radvansky-tomas closed 1 year ago

radvansky-tomas commented 1 year ago

Hi, thank you for great package, one thing which is not really clear, is how to hide/show flex items in RowColumn.

I mean I can add child with ResponsiveVisibility but that will not change the fact that flex is still being applied.

So only option is to add conditionals on top of ResponsiveRowColumnItem. But to be more consistent, that class should have conditions field like other Responsive widgets to hide/show.

Any other advice ?

radvansky-tomas commented 1 year ago

Resolved by wrapping responsive value in

  ResponsiveRowColumnItem(
                      columnFlex: ResponsiveValue<int?>(
                        context,
                        defaultValue: 10,
                        valueWhen: [
                          const Condition.smallerThan(
                            breakpoint: 1000,
                            value: 0,
                          ),
                        ],
                      ).value,
                      child: Container(color: Colors.red),
                    ),