Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allow Text Widget to Overflow Between Containers

Tags:

flutter

I've just started learning Flutter. I'm currently trying to get a Text widget to overflow between two containers that are inside a row.

Here's the code:

      Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Container(
            color: Colors.green,
            width: 100.273,
            height: 150,
            child: const Text(
              "Test",
              overflow: TextOverflow.visible,
              style: TextStyle(
                color: Colors.black,
                decoration: TextDecoration.none,
              ),
            ),
          ),
          Container(
            color: Colors.white,
            width: 100,
            height: 150,
          ),
        ],
      ),

I've tried using different widgets, to foster the containers and tried different values for TextOverflow. Visible and Clip don't seem to do anything. Tried moving the Text widget up to the row and then making it clip trough both containers, but it didn't work too.

Here's the current layout, I want the "test" in the green Container to be able to clip into the white Container.

[image]

like image 892
Torres Avatar asked Jan 16 '26 18:01

Torres


1 Answers

If your intention is to create a text on top of 2 containers, you can try using Stack widget,

This is for the code:

Stack(
    children: [
      Row(
        children: [
          Container(
            color: Colors.green,
            width: 100.273,
            height: 150,
          ),
          Container(
            color: Colors.red,
            width: 100,
            height: 150,
          ),
        ],
      ),
      Text('Hallo, this is just test'),
    ],
  ),

see screenshoot

like image 186
Novan Noviansyah Pratama Avatar answered Jan 19 '26 18:01

Novan Noviansyah Pratama



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!