Fliggy-Mobile / fsuper

A super powerful widget to help developers build complex views quickly and comfortably.
Other
515 stars 43 forks source link

fsuper相互嵌套,视图更新的时候,子元素会闪烁 #13

Closed TomVista closed 4 years ago

TomVista commented 4 years ago

测试代码

把AddNotesTextField 放到stfulwidget中,更新state,

AddNotesTextField ->FSuper->child1->child1 闪烁

class AddNotesTextField extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return FSuper(
      width: 303,
      height: 80.5,
      child1Alignment:Alignment.bottomCenter ,
      child1: FSuper( // 容器,需要注意child1和child2的层级
        width: 303,
        height: 63.5,
        backgroundColor: Color(0xFF26465C),
        corner:Corner(rightTopCorner:6,leftBottomCorner: 6,rightBottomCorner: 6),
        child1Alignment: Alignment.center,
        child1: FSuper(
          width: 283,
          height: 43.5,
          child1: TextField(
            maxLines: 2,
            maxLength: null,
            style: TextStyle(fontSize: 12,color: Colors.white),
            decoration: InputDecoration(
                isDense: true,
                contentPadding: EdgeInsets.all(5),
                border: OutlineInputBorder(borderRadius: BorderRadius.all(Radius.circular(6)),borderSide: BorderSide.none),
                fillColor:Color(0xff486F8D),
                filled: true
            ),
          ),
        ),
      ) ,
      child2Alignment: Alignment.topLeft,
      child2: FSuper( // 头部
        width: 70,
        height: 22.5,
        text: 'add notes',
        textSize: 12,
        textColor: Color(0xffF29D2C),
        textAlign: TextAlign.center,
        textAlignment: Alignment.center,
        backgroundColor: Color(0xFF26465C),
        corner:Corner(leftTopCorner: 5.625,rightTopCorner: 5.625),
      ),
    );
  }
}
chenBingX commented 4 years ago

你好,建议升级到最新的 2.0.0 版本,查看是否仍然存在这个问题。 此外,FSuper 不会对 child 大小作出约束,对 child 而言更像是一个锚定装饰。因此,也许你的 TextField 需要再加上一个尺寸约束。

TomVista commented 4 years ago

升级解决,约束加上了,谢谢.