Created
October 8, 2019 19:03
-
-
Save rpsnaik/7baff3a82c8c42581f42f6349ffb53cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SplashScreen extends StatefulWidget { | |
@override | |
_SplashScreenState createState() => _SplashScreenState(); | |
} | |
class _SplashScreenState extends State<SplashScreen> { | |
Future onloadDecider() async { | |
FirebaseUser user = await FirebaseAuth.instance.currentUser(); | |
if(user == null){ | |
print("No User"); | |
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context)=>Material( | |
child: ChangeNotifierProvider( | |
builder: (_)=>SessionManagement(), | |
child: FirebaseSession(), | |
), | |
))); | |
}else{ | |
print("Current User : "+user.uid); | |
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context)=>Material( | |
child: MultiProvider( | |
providers: [ | |
ChangeNotifierProvider(builder: (_)=>SessionManagement(),), | |
], | |
child: SpotifyHome(), | |
), | |
))); | |
} | |
} | |
@override | |
void initState() { | |
Future.delayed(Duration(seconds: 2), (){ | |
onloadDecider(); | |
}); | |
super.initState(); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
child: Center( | |
child: Image.asset("./images/spotify_logo_title.png"), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment