class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
// Домашняя страница
class _HomePageState extends State<HomePage> {
bool isSignedIn= false;
PageController pageController;
int getPageIndex=0;
void initState() {
super.initState();
pageController = PageController();
gSignIn.onCurrentUserChanged.listen((gSignInAccount){
controlSignIn(gSignInAccount);
},onError: (gError){
print("Error Message"+gError);
});
gSignIn.signInSilently(suppressErrors : false).then((gSignInAccount)
{
controlSignIn(gSignInAccount);
}
).catchError((gError){
print("Error Message"+gError);
});
}
// Для входа в аккаунт
controlSignIn(GoogleSignInAccount signInAccount) async
{
if(signInAccount != null)
{
await saveUserInfoToFireStore();
setState(() {
isSignedIn = true;
});
}
else{
setState(() {
isSignedIn = false;
});
}
}