From d3d64ad1ec820d5f3d34f5bd7f0eb51dd1e3c709 Mon Sep 17 00:00:00 2001 From: Lucas Delanier Date: Sat, 29 Jul 2023 01:17:39 +0200 Subject: [PATCH] add fake navigation --- .../lib/components/top_nav_bar_component.dart | 18 ++++++++++------ Sources/justMUSIC/lib/config/routes.dart | 21 +++++++++++++++++++ .../justMUSIC/lib/screens/feed_screen.dart | 1 - .../justMUSIC/lib/screens/profile_screen.dart | 19 ++++++++++------- 4 files changed, 44 insertions(+), 15 deletions(-) create mode 100644 Sources/justMUSIC/lib/config/routes.dart diff --git a/Sources/justMUSIC/lib/components/top_nav_bar_component.dart b/Sources/justMUSIC/lib/components/top_nav_bar_component.dart index 8af5c71..59fe4f6 100644 --- a/Sources/justMUSIC/lib/components/top_nav_bar_component.dart +++ b/Sources/justMUSIC/lib/components/top_nav_bar_component.dart @@ -3,6 +3,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; +import '../config/routes.dart'; import '../values/constants.dart'; class TopNavBarComponent extends StatefulWidget { @@ -33,11 +34,16 @@ class _TopNavBarComponentState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - const Flexible( + Flexible( flex: 1, - child: Image( - image: AssetImage("assets/images/add_friend.png"), - width: 25, + child: GestureDetector( + onTap: () { + Navigator.pushNamed(context, '/post'); + }, + child: const Image( + image: AssetImage("assets/images/add_friend.png"), + width: 25, + ), ), ), ConstrainedBox( @@ -126,12 +132,12 @@ class _TopNavBarComponentState extends State { flex: 1, child: GestureDetector( onTap: () { - Navigator.pushNamed(context, '/profile'); + Navigator.of(context).push(createRoute()); }, child: ClipOval( child: SizedBox.fromSize( // Image radius - child: Image( + child: const Image( image: AssetImage("assets/images/exemple_profile.png"), width: 25, ), diff --git a/Sources/justMUSIC/lib/config/routes.dart b/Sources/justMUSIC/lib/config/routes.dart new file mode 100644 index 0000000..ca5cf74 --- /dev/null +++ b/Sources/justMUSIC/lib/config/routes.dart @@ -0,0 +1,21 @@ +import 'package:flutter/Material.dart'; +import 'package:justmusic/screens/profile_screen.dart'; + +Route createRoute() { + return PageRouteBuilder( + pageBuilder: (context, animation, secondaryAnimation) => + const ProfileScreen(), + transitionsBuilder: (context, animation, secondaryAnimation, child) { + const begin = Offset(1.0, 0.0); + const end = Offset.zero; + const curve = Curves.ease; + + var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve)); + + return SlideTransition( + position: animation.drive(tween), + child: child, + ); + }, + ); +} diff --git a/Sources/justMUSIC/lib/screens/feed_screen.dart b/Sources/justMUSIC/lib/screens/feed_screen.dart index 39b4f7c..3e2c6ea 100644 --- a/Sources/justMUSIC/lib/screens/feed_screen.dart +++ b/Sources/justMUSIC/lib/screens/feed_screen.dart @@ -244,7 +244,6 @@ class _FeedScreenState extends State children: [ CircularRevealAnimation( animation: animation, -// centerAlignment: Alignment.centerRight, centerOffset: Offset(30.w, -100), child: SingleChildScrollView( child: SizedBox( diff --git a/Sources/justMUSIC/lib/screens/profile_screen.dart b/Sources/justMUSIC/lib/screens/profile_screen.dart index 0a046af..896cd91 100644 --- a/Sources/justMUSIC/lib/screens/profile_screen.dart +++ b/Sources/justMUSIC/lib/screens/profile_screen.dart @@ -30,14 +30,17 @@ class _ProfileScreenState extends State { alignment: Alignment.centerLeft, children: [ GestureDetector( - onTap: () { - Navigator.pop(context); - }, - child: Image( - image: AssetImage("assets/images/return_icon.png"), - height: 11.h, - ), - ), + onTap: () { + Navigator.pop(context); + }, + child: Container( + height: 15, + width: 15, + child: Image( + image: AssetImage("assets/images/return_icon.png"), + height: 8, + ), + )), Align( child: Text( "Profile",