Unity-Technologies / com.unity.uiwidgets

UIWidgets is a Unity Package which helps developers to create, debug and deploy efficient, cross-platform Apps.
https://unity.cn/uiwidgets
626 stars 78 forks source link

CupertinoSegmentedControl 组件无法点击切换,在flutter里面是可以的 #352

Closed xuexirong closed 2 years ago

xuexirong commented 2 years ago

c#代码: private int _value;

private Widget showRemindBottomSheetTest()
{
    Dictionary<int, Widget> segment = new Dictionary<int, Widget>();
    segment[0] = new Container(
        height:50,
        child: new Text("测试0")
    );
    segment[1] = new Container(
        height:50,
        child: new Text("测试1")
    );
    segment[2] = new Container(
        height:50,
        child: new Text("测试2")
    );
    return new Center(
        child: new CupertinoSegmentedControl<int>(
            groupValue: _value,
            children: segment,
            onValueChanged: (index) =>
            {
                Debug.Log("=============");
                setState(() => { _value = index; });
                Debug.Log(index.ToString());
            }
        )
    );
}

dart代码: int _value = 0;

Widget showRemindBottomSheetTest() { Map<int, Widget> segment = new HashMap<int, Widget>(); segment[0] = new Container(height: 50, child: new Text("测试0")); segment[1] = new Container(height: 50, child: new Text("测试1")); segment[2] = new Container(height: 50, child: new Text("测试2")); return new Center( child: new CupertinoSegmentedControl( groupValue: _value, children: segment, onValueChanged: (index) => { setState(() => {_value = index}) })); }

zhuxingwei commented 2 years ago

Thanks for the report!

We will investigate the issue asap and let you know when we have any progress

zhuxingwei commented 2 years ago

fixed in #354