|
|
|
@ -8,7 +8,6 @@ import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
import 'package:intl/date_symbol_data_file.dart';
|
|
|
|
|
import 'package:justmusic/screens/add_friend_screen.dart';
|
|
|
|
|
import 'package:justmusic/screens/explanations_screen.dart';
|
|
|
|
|
import 'package:justmusic/screens/feed_screen.dart';
|
|
|
|
@ -78,21 +77,6 @@ class _MyAppState extends State<MyApp> {
|
|
|
|
|
return ScreenUtilInit(
|
|
|
|
|
useInheritedMediaQuery: true,
|
|
|
|
|
builder: (context, child) {
|
|
|
|
|
return StreamBuilder(
|
|
|
|
|
stream: FirebaseAuth.instance.authStateChanges(),
|
|
|
|
|
builder: (context, snapshot) {
|
|
|
|
|
if (ConnectionState.waiting == snapshot.connectionState) {
|
|
|
|
|
return const CupertinoActivityIndicator();
|
|
|
|
|
}
|
|
|
|
|
if (snapshot.hasData) {
|
|
|
|
|
return FutureBuilder<userJustMusic.User?>(
|
|
|
|
|
future: MyApp.userViewModel.getUser(snapshot.data!.uid),
|
|
|
|
|
builder: (context, userSnapshot) {
|
|
|
|
|
if (userSnapshot.connectionState == ConnectionState.waiting) {
|
|
|
|
|
return const CupertinoActivityIndicator();
|
|
|
|
|
} else {
|
|
|
|
|
if (userSnapshot.hasData) {
|
|
|
|
|
MyApp.userViewModel.userCurrent = userSnapshot.data!;
|
|
|
|
|
return MaterialApp(
|
|
|
|
|
routes: {
|
|
|
|
|
'/welcome': (context) => const WellcomeScreen(),
|
|
|
|
@ -111,7 +95,22 @@ class _MyAppState extends State<MyApp> {
|
|
|
|
|
theme: ThemeData(
|
|
|
|
|
primarySwatch: Colors.blue,
|
|
|
|
|
),
|
|
|
|
|
home: FeedScreen());
|
|
|
|
|
home: StreamBuilder(
|
|
|
|
|
stream: FirebaseAuth.instance.authStateChanges(),
|
|
|
|
|
builder: (context, snapshot) {
|
|
|
|
|
if (ConnectionState.waiting == snapshot.connectionState) {
|
|
|
|
|
return const CupertinoActivityIndicator();
|
|
|
|
|
}
|
|
|
|
|
if (snapshot.hasData) {
|
|
|
|
|
return FutureBuilder<userJustMusic.User?>(
|
|
|
|
|
future: MyApp.userViewModel.getUser(snapshot.data!.uid),
|
|
|
|
|
builder: (context, userSnapshot) {
|
|
|
|
|
if (userSnapshot.connectionState == ConnectionState.waiting) {
|
|
|
|
|
return const CupertinoActivityIndicator();
|
|
|
|
|
} else {
|
|
|
|
|
if (userSnapshot.hasData) {
|
|
|
|
|
MyApp.userViewModel.userCurrent = userSnapshot.data!;
|
|
|
|
|
return FeedScreen();
|
|
|
|
|
} else {
|
|
|
|
|
return const Text('User data not found');
|
|
|
|
|
}
|
|
|
|
@ -119,27 +118,9 @@ class _MyAppState extends State<MyApp> {
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
return MaterialApp(
|
|
|
|
|
routes: {
|
|
|
|
|
'/welcome': (context) => const WellcomeScreen(),
|
|
|
|
|
'/feed': (context) => const FeedScreen(),
|
|
|
|
|
'/login': (context) => const LoginScreen(),
|
|
|
|
|
'/register': (context) => const RegistrationScreen(),
|
|
|
|
|
'/post': (context) => const PostScreen(),
|
|
|
|
|
'/profile': (context) => const ProfileScreen(),
|
|
|
|
|
'/explanation': (context) => const ExplanationsScreen(),
|
|
|
|
|
'/addFriend': (context) => const AddFriendScreen(),
|
|
|
|
|
'/launchingRocket': (context) => const LaunchingRocketScreen(),
|
|
|
|
|
'/verifyEmail': (context) => const VerifyEmailScreen(),
|
|
|
|
|
'/forgetPassword': (context) => const ForgetPasswordScreen(),
|
|
|
|
|
},
|
|
|
|
|
debugShowCheckedModeBanner: false,
|
|
|
|
|
theme: ThemeData(
|
|
|
|
|
primarySwatch: Colors.blue,
|
|
|
|
|
),
|
|
|
|
|
home: WellcomeScreen());
|
|
|
|
|
return WellcomeScreen();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}));
|
|
|
|
|
},
|
|
|
|
|
designSize: Size(390, 844),
|
|
|
|
|
);
|
|
|
|
|