Flutter旋转位移等操作

flutter布局-5-Matrix4矩阵变换
Flutter 布局(六)- SizedOverflowBox、Transform、CustomSingleChildLayout详解

一个常见的展开关闭状态Transform

Widget _createSectionTitle(bool isOpen)
{
      String showTxt = isOpen ? '收起': '展开';
      double angle = isOpen ? pi/2*3 : pi/2;
      reuturn InkWell( 
                child: Container(width: 60,height: 50,
                      child: Row(
                            mainAxisAlignment: MainAxisAlignment.end,
                            children: <Widget>[
                              Text(showTxt, style: TextStyle(color: Colors.grey,fontSize: 11),) ,
                              SizedBox(width: 5,),
                              Transform(
                                transform: Matrix4.identity()..rotateZ(angle),// 旋转的角度
                                origin: Offset(6,6),// 旋转的中心点
                                child: Icon(Icons.arrow_forward_ios, color: Colors.grey,size: 12.0,),
                            ),
                    ]),
            ),
            onTap: (){
              // 做点击处理xxxx
            },
          );
    }
1605558-3fd922b71136b6c8.png
展开

1605558-a8096790e525647f.png
收起

转载于:https://www.jianshu.com/p/e606c74b208c

猜你喜欢

转载自blog.csdn.net/weixin_34367257/article/details/91181340
今日推荐