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

How to center column item center of screen? #125

Closed NTMS2017 closed 1 year ago

NTMS2017 commented 1 year ago

In web and iOS version of ResponsiveRowColumn is not working as expected. Axis alignment also is not allow.

In web if screen is big responsive work (but item only center to top screen and not middle of screen). In web if screen small responsive is center left side of screen.

My goal to make like this:

Screenshot 2023-02-11 at 15 01 07

Currently is showing like this:

Screenshot 2023-02-11 at 13 53 17 Screenshot 2023-02-11 at 13 53 04 Screenshot 2023-02-11 at 13 53 53
NTMS2017 commented 1 year ago

Ok, I find the solution but I am not sure if is the correct way of doing it. I wrap the ResponsiveRowColumn with Center widget. Its work on web, iOS (iPhone and iPad) and android.

Code:

      /// Wrap with CENTER widget to center (middle of screen) the item on screen
      /// Wrap with LIST_VIEW widget to center (top of the screen) the item on screen
      body: Center(
        child: ResponsiveRowColumn(

            /// ROW
            rowMainAxisAlignment: MainAxisAlignment.center,
            rowMainAxisSize: MainAxisSize.max,
            rowCrossAxisAlignment: CrossAxisAlignment.center,
            rowVerticalDirection: VerticalDirection.down,

            /// COLUMN
            columnMainAxisAlignment: MainAxisAlignment.center,
            columnMainAxisSize: MainAxisSize.max,
            columnCrossAxisAlignment: CrossAxisAlignment.center,
            columnVerticalDirection: VerticalDirection.down,

            /// SPACING
            columnSpacing: 10.0,
            rowSpacing: 10.0,

Images:

Screenshot 2023-02-12 at 15 10 33 Screenshot 2023-02-12 at 15 10 46