skip to Main Content

Is there any way to do this in flutter.

enter image description here

I am trying to align the text inside container vertically.Just increased the height of container but it was not working. it camed like this :

https://phpout.com/wp-content/uploads/2023/11/yCqV6.png

Code :

enter image description here

enter image description here

3

Answers


  1. use RotatedBox Widget

    RotatedBox(
          quarterTurns: 3,
          child: Container(
            color: Colors.blue,
            child: Padding(
              padding: EdgeInsets.all(10),
              child: Text("Rotated Text"),
            ),
          ),
        )
    
                
                
    
    Login or Signup to reply.
  2. Use Transform Widget ,
    Here is the example:

    import dart.math;
    
    
    Transform.rotate(
      angle: math.pi * 15 / 90 // 180 ,45,30 degree based on your angle 
      child : your widget 
    )
    

    The Transform widget in Flutter allows us to apply various
    transformations to its child widget, such as rotating, scaling,
    translating, and skewing. This allows us to create visually appealing
    and dynamic user interfaces.

    Login or Signup to reply.
  3. You can achieve it using below code snippet:

    import dart.math;
    Transform.rotate(
    angle: math.pi *15 /90 
    

    // Set degree as per requirement
    child :CustomWidget()
    )

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search