open:transform

Transform

Container(
  height: 300,
  width: double.infinity,
  child: PageView.builder(
    controller: _pageController,
    onPageChanged: (int) {
      print('page is $int');
    },
    itemCount: 20,
    itemBuilder: (context, index) {
      double scale = max(viewportFraction,
          (1 - (pageOffset - index).abs()) + viewportFraction);
      double angle = (pageOffset - index).abs();
 
      if (angle > 0.5) {
        angle = 1 - angle;
      }
 
      return Container(
        margin: EdgeInsets.only(left: 20, top: 80 - scale * 25),
        child: Transform(
          transform: Matrix4.identity()
            ..setEntry(3, 2, 0.001)
            ..rotateY(angle),
          alignment: Alignment.center,
          child: Container(
            decoration: BoxDecoration(
              color: Colors.white,
              borderRadius:
                  BorderRadius.all(Radius.circular(10)),
            ),
            child: Center(
              child: Text(
                'Page index : $index',
                style: TextStyle(fontSize: 20),
              ),
            ),
          ),
        ),
      );
    },
  ),
),


  • open/transform.txt
  • 마지막으로 수정됨: 2020/12/30 03:34
  • 저자 127.0.0.1