美文网首页
Flutter旋转位移等操作

Flutter旋转位移等操作

作者: 独孤流 | 来源:发表于2019-06-01 10:58 被阅读0次

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
            },
          );
    }
展开
收起

相关文章

网友评论

      本文标题:Flutter旋转位移等操作

      本文链接:https://www.haomeiwen.com/subject/hqpotctx.html