使用以下代码时收到警告,但我的应用运行良好:

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
The following assertion was thrown during paint():
A borderRadius can only be given for uniform borders.
'package:flutter/src/painting/box_border.dart':
Failed assertion: line 510 pos 12: 'borderRadius == null'

这是我的代码:
           Container(
              height: screenSize.height*.13,
              width: AppSize.medium,
              decoration: BoxDecoration(
                color: Colors.red,
                border: Border(
                  right: BorderSide(
                    width: 1.0,
                    color: Colors.blue
                  ),
                ),
                borderRadius: BorderRadius.only(
                  topRight: Radius.circular(AppSize.small),
                  bottomRight: Radius.circular(AppSize.small),
                )
              ),
            )

最佳答案

Flutter在抱怨,因为您只对容器应用了正确的边框,但也希望具有边框半径。

Flutter希望在应用边界半径时,边界是统一的,即始终围绕且颜色相同。如果您跳到引发断言错误的源代码,则可以查看实际的断言。

08-18 08:10