fix: call updateEmail after initState to avoid runtime exception

updateEmail uses getEnteColorScheme() which adds an inherited widget as dependency to the widget. Adding an inherited widget as dependency before init state is completed throws an exception
This commit is contained in:
ashilkn 2024-04-13 12:41:08 +05:30
parent 8137825693
commit 04e45b7908

View file

@ -29,18 +29,18 @@ class _LoginPageState extends State<LoginPage> {
final Logger _logger = Logger('_LoginPageState');
@override
void initState() {
void didChangeDependencies() {
super.didChangeDependencies();
if ((_config.getEmail() ?? '').isNotEmpty) {
updateEmail(_config.getEmail()!);
} else if (kDebugMode) {
updateEmail(const String.fromEnvironment("email"));
}
super.initState();
}
@override
Widget build(BuildContext context) {
final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;
final isKeypadOpen = MediaQuery.viewInsetsOf(context).bottom > 100;
FloatingActionButtonLocation? fabLocation() {
if (isKeypadOpen) {