why we can't use the decoration and clipBehavior properties on the same Container widget

990 views Asked by At

as the title says, I want to know why we do this:

Container(
      clipBehavior: Clip.hardEdge,
      decoration: BoxDecoration(color: Colors.red),
      child: Text("example"),
    ),

we get the following assertion error:

_AssertionError ('package:flutter/src/widgets/container.dart': Failed assertion: line 272 pos 15: 'decoration != null || clipBehavior == Clip.none': is not true.)

it requires that only one of them should be set.

my question why this is throws and what's the relation between both, or what it will result if they are combined in the same Container widget

0

There are 0 answers