How to make a widget inside a widget transparent so that the third widget is visible

NoProgress

I want the first widget to be transparent and display the colors of the third widget. on the third widget there is an animation with changing colors

enter image description here

dumazy

You can use a ColorFiltered for that.

Stack(
  alignment: Alignment.center,
  children: [
    Container(
      width: 300,
      height: 300,
      color: Colors.green,
    ),
    Material(
      clipBehavior: Clip.antiAlias, // make sure the filter is restricted
      color: Colors.transparent,
      child: SizedBox(
        width: 150,
        height: 150,
        child: ColorFiltered(
          colorFilter: ColorFilter.mode(
            Colors.black, // Color of the box, must be same color as text color used below
            BlendMode.xor,
          ),
          child: Center(
            child: Text(
              'test',
              style: TextStyle(
                fontSize: 32,
                color: Colors.black, // Same color as filter color used above
              ),
            ),
          ),
        ),
      ),
    ),
  ],
);

The BlendMode.xor will cut out everything with the same color within the current canvas, which is the Material widget above it.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Create widget with transparent hole inside

How to pass data to a widget inside of another widget

How to access parent widget inside child widget?

How to place widget to the bottom inside Form widget?

How to set width of widget in Tkinter with a widget inside?

What kind of widget is this? / How to make this widget?

Color of a widget inside a Stack is always slightly transparent

Custom Widget is not visible in WIdget window

How to make Text widget visible if ListView snapshot returns empty?

Make sidebar widget transparent on macOS Mojave

What is the function of visible=true inside Blogspot widget?

In Tkinter is there any way to make a widget not visible?

How to visible child widget of specific widget in ListView in Flutter?

Widget inside another widget Qt

How to trigger events inside a widget?

how to have a widget inside a text?

How to update a Widget inside a List

How to Position inside a Stack widget

How to sticky widget inside frame?

Flutter How to make a Text widget in a Wrap widget start from the end of the previous widget and not start bellow the previous widget?

How to make background of cell widget inside QTableWidget not selectable?

how to make a child width same as parent (center widget inside datacolumn)?

How to make the signals of child widgets inside a custom widget connectable?

How to make a widget 'aways on top' inside ListView in flutter?

How to create widget with transparent hole in flutter

how to change Linkedin Widget background color to transparent?

How to make AppCompatImageView works in widget?

How to make a style widget on ShowDialog?

How to make widget without '?' and 'required'