Commit 41eabe4c authored by Michal Cikatricis's avatar Michal Cikatricis
Browse files

Feat (collections): added animation and image now fits the screen

parent 0ea7ac29
Loading
Loading
Loading
Loading
+25 −6
Original line number Original line Diff line number Diff line
@@ -14,22 +14,41 @@ class PostcardDetail extends StatelessWidget {
      title: '',
      title: '',
      padding: 0,
      padding: 0,
      child: GestureDetector(
      child: GestureDetector(

        onTap: () {
        onTap: () {
          Navigator.push(
          Navigator.of(context).push(_createRoute());
            context,
          // Navigator.push(
            MaterialPageRoute(
          //   context,
                builder: (context) => PostcardDetailBack(postcard: postcard)),
          //   MaterialPageRoute(
          );
          //       builder: (context) => PostcardDetailBack(postcard: postcard)),
          // );
        },
        },
        child: Container(
        child: Container(
          decoration: BoxDecoration(
          decoration: BoxDecoration(
            image: DecorationImage(
            image: DecorationImage(
              image: NetworkImage(postcard.imagePath),
              image: NetworkImage(postcard.imagePath),
              fit: BoxFit.contain,
              fit: BoxFit.cover,
            ),
            ),
          ),
          ),
        ),
        ),
      ),
      ),
    );
    );
  }
  }

  Route _createRoute() {
    return PageRouteBuilder(
      pageBuilder: (context, animation, secondaryAnimation) => PostcardDetailBack(postcard: postcard),
      transitionsBuilder: (context, animation, secondaryAnimation, child) {
        const begin = Offset(1.0, 0);
        const end = Offset.zero;
        var curve = Curves.easeInOutCubic;
        var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
        final offsetAnimation = animation.drive(tween);
        return SlideTransition(
          position: offsetAnimation,
          child: child,
        );
      },
    );
  }
}
}
+0 −1
Original line number Original line Diff line number Diff line
@@ -58,7 +58,6 @@ class PostcardTile extends StatelessWidget {
              Expanded(
              Expanded(
                child: Container(
                child: Container(
                  decoration: BoxDecoration(
                  decoration: BoxDecoration(
                    color: Colors.black,
                    image: DecorationImage(
                    image: DecorationImage(
                      image: NetworkImage(postcard.imagePath),
                      image: NetworkImage(postcard.imagePath),
                      fit: BoxFit.fitWidth,
                      fit: BoxFit.fitWidth,