Skip to content
This repository was archived by the owner on Sep 7, 2022. It is now read-only.
This repository was archived by the owner on Sep 7, 2022. It is now read-only.

创建多次含有decoration的Container发生崩溃 #345

@tomcatter

Description

@tomcatter

测试代码如下:

using System.Collections;
using System.Collections.Generic;
using Unity.UIWidgets.engine;
using Unity.UIWidgets.material;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;

using ui_ = Unity.UIWidgets.widgets.ui_;
using TextStyle = Unity.UIWidgets.painting.TextStyle;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.foundation;
using uiwidgets;
using Unity.UIWidgets.rendering;

public class DialogTest : UIWidgetsPanel
{
    protected void OnEnable()
    {
        base.OnEnable();
    }

    protected override void main()
    {
        ui_.runApp(new MyApp());
    }
}

class MyApp : StatelessWidget
{
    public override Widget build(BuildContext context)
    {
        return new MaterialApp(home: new CounterApp());
    }
}

internal class CounterApp : StatefulWidget
{
    public override State createState()
    {
        return new CountDemoState();
    }
}

internal class CountDemoState : State<CounterApp>
{
    private int count = 0;

    public override Widget build(BuildContext context)
    {
        return new Container(
            color: Color.fromARGB(255, 0, 0, 0),
            child: new Column(
                children: new List<Widget>()
                {
                    new Text(
                        data: $"count: {count}",
                        style: new TextStyle(
                            decoration: TextDecoration.none,
                            color: Color.fromARGB(255, 0, 0, 255)
                        )
                    ),
                    new FlatButton(
                        onPressed: () =>
                        {
                            setState(
                                () =>
                                {
                                    count++;
                                }
                            );

                            material_.showDialog<object>(
                                context: context,
                                builder: (ctx) =>
                                {
                                    //var container = new Container(
                                    //    width: 600,
                                    //    height: 400,
                                    //    decoration: new ShapeDecoration(
                                    //        color: Color.fromRGBO(0, 166, 185, 0.24f),
                                    //        shape: new BeveledRectangleBorder(
                                    //            borderRadius: BorderRadius.all(Radius.circular(10)),
                                    //            side: new BorderSide(
                                    //                color: Color.fromRGBO(34, 232, 255, 1),
                                    //                width: 1.5f
                                    //            )
                                    //        )
                                    //        shadows: new List<BoxShadow>
                                    //        {
                                    //            new BoxShadow(
                                    //                color: Color.fromRGBO(255, 255, 255, 0.01f),
                                    //                blurRadius: 20
                                    //            )
                                    //        }
                                    //    )
                                    //);


                                    var container = new Container(
                                        width: 600,
                                        height: 400,
                                        decoration: new BoxDecoration(
                                            color: Color.fromRGBO(0, 166, 185, 0.24f),
                                            boxShadow: new List<BoxShadow>
                                            {
                                                new BoxShadow(
                                                    color: Color.fromRGBO(255, 255, 255, 0.01f),
                                                    blurRadius: 20
                                                )
                                            }
                                        )
                                    );

                                    return new Dialog(
                                        shape: new RoundedRectangleBorder(
                                            borderRadius: BorderRadius.circular(0)
                                        ),
                                        elevation: 0,
                                        child: container,
                                        backgroundColor: Colors.transparent
                                    );
                                }
                            );
                        },
                        child: new Container(
                            color: Color.fromARGB(255, 0, 255, 0),
                            width: 100,
                            height: 40
                        )
                    ),
                }
            )
        );
    }
}

使用Unity 2020.3.24f1c1版本,编译成Android mono
以上代码点击按钮调用showDialog多次发生崩溃,如果去掉decoration的设置则正常
日志见附件:

log.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions