When I start the application on the Android emulator and try to use the virtual keybord, it immediately gets closed and I see the following message on DEBUG CONSOLE:
D/InputConnectionAdaptor( 5956): The input method toggled cursor monitoring on
It seems the app gets restarted whenever I try to open the keyboard, because I see messages like below:
I/flutter ( 5956): isAuth is false and we are in authentication page
D/InputConnectionAdaptor( 5956): The input method toggled cursor monitoring on
2
I/flutter ( 5956): isAuth is false and we are in authentication page
D/InputConnectionAdaptor( 5956): The input method toggled cursor monitoring on
2
I/flutter ( 5956): isAuth is false and we are in authentication page
This is my main.dart
file and let me know if you think it helps if I put more code:
void main() {
WidgetsFlutterBinding.ensureInitialized();
Get.put(MenuController());
Get.put(NavigationController());
Get.put(AuthController());
Get.put(AuthCard);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
AuthController.instance.tryAutoLogin();
return GetMaterialApp(
// initialRoute: AuthController.instance.isAuth
// ? rootRoute
// : authenticationScreenRoute,
unknownRoute: GetPage(
name: '/not-found',
page: () => PageNotFound(),
transition: Transition.fadeIn),
getPages: [
GetPage(
name: rootRoute,
page: () {
return SiteLayout();
}),
GetPage(
name: authenticationScreenRoute,
page: () => const AuthenticationScreen()),
GetPage(name: homeScreenRoute, page: () => const HomeScreen()),
],
debugShowCheckedModeBanner: false,
title: 'BasicCode',
theme: ThemeData(
scaffoldBackgroundColor: light,
textTheme: GoogleFonts.mulishTextTheme(Theme.of(context).textTheme)
.apply(bodyColor: Colors.black),
pageTransitionsTheme: const PageTransitionsTheme(builders: {
TargetPlatform.iOS: FadeUpwardsPageTransitionsBuilder(),
TargetPlatform.android: FadeUpwardsPageTransitionsBuilder(),
}),
primarySwatch: Colors.blue,
),
// home: AuthController.instance.isAuth
home: Obx(()=>
AuthController.instance.isAuth
? SiteLayout()
: const AuthenticationScreen(),
),
);
}
}
I also tried to use my Android phone and I got the same error and behavior.
for me the solution was