颤振列表轴随动画而变化

时间:2020-05-31 17:37:23

标签: flutter dart flutter-layout flutter-listview

我正在尝试更改颤动列表的轴并为调整大小的内容设置动画。但是animationcontainer无效。容器大小突然改变。

IconButton(icon: Icon(Icons.apps),
                      color: util.getTheme(context).primaryColorDark,
                      onPressed: () {
                        setState(() {
                          scrollDirection = scrollDirection == Axis.horizontal ? Axis.vertical : Axis.horizontal;
                        });
                      })


GridTile(
      child: GestureDetector(
        child: Card(
            elevation: constants.dElevation,
            margin: EdgeInsets.all(constants.dPadding12),
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(constants.dRadius),
            ),
            child: AnimatedContainer(
              curve: Curves.easeOut,
              duration: constants.dAnimDuration,
              child: Container(
                  width: MediaQuery.of(context).size.width * 0.70,
                  child: Column(children: <Widget>[
                    Row(
                      children: <Widget>[
                        SizedBox(width: constants.d16),
                        Expanded(
                            child: UtilUI.getText("${note.title}\n", constants.fHeader16, util.getTheme(context).accentColor,
                                textAlign: TextAlign.start, fontWeight: constants.fWeight8)),
                        )
                    SizedBox(
                        width: constants.d100,
                        height: constants.d1,
                        child: Divider(
                          color: util.getTheme(context).buttonColor,
                        )),
                    Container(
                    padding: EdgeInsets.all(constants.dPadding16),
                    child: scrollDirection == Axis.vertical
                        ? UtilUI.getText(note.desctiption, maxLines: constants.i2)),   //2 lines
                        : UtilUI.getText(note.desctiption, maxLines: constants.i200)), //200 lines
                  ])),
            )),
        onTap: () => _onTileClicked(context, note.id),
      ),
    )

0 个答案:

没有答案