import 'package:aman_kassa_flutter/shared/ui_helpers.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class CardView extends StatefulWidget {

  final bool show;

  const CardView({this.show = false });

  @override
  _CardViewState createState() => _CardViewState();
}

class _CardViewState extends State<CardView> {
  @override
  Widget build(BuildContext context) {
    return Positioned(
      child: AnimatedOpacity(
        opacity: widget.show? 1 : 0.0,
        duration: Duration(seconds: 1),
        child: AnimatedContainer(
          height: ScreenUtil().setSp(250),
          width: ScreenUtil().setSp(250),
          transform: Matrix4.translationValues(widget.show? ScreenUtil().setSp(20.0) : 0.0, widget.show? ScreenUtil().setSp(-20.0) : 0.0, 0)
            //..rotateZ(widget.show? -0.2:0.0)
          ,
          duration: const Duration(milliseconds: 1500),
          curve: Curves.fastOutSlowIn,
          child: Container(
            //color: Colors.red.withOpacity(0.1),
            //alignment: Alignment.bottomCenter,
            child: Image.asset(
              'assets/images/card.png',
              fit: BoxFit.contain,
            ),
          ),
        ),
      ),
    );
  }
}
