0
votes

Performing hot restart... Syncing files to device sdk gphone x86 arm... Restarted application in 1,910ms.

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════ The following assertion was thrown building MyApp(state: _MyAppState#6de06): MediaQuery.of() called with a context that does not contain a MediaQuery.

No MediaQuery ancestor could be found starting from the context that was passed to MediaQuery.of(). This can happen because you do not have a WidgetsApp or MaterialApp widget (those widgets introduce a MediaQuery), or it can happen if the context you use comes from a widget above those widgets. The context used was: Scaffold dirty
state: ScaffoldState#edc68(lifecycle state: initialized, tickers: tracking 2 tickers) The relevant error-causing widget was: MyApp file:///S:/Businesses/Furniture/APP/movonpf/lib/main.dart:10:10 When the exception was thrown, this was the stack: #0 MediaQuery.of (package:flutter/src/widgets/media_query.dart:819:5) #1 ScaffoldState.didChangeDependencies (package:flutter/src/material/scaffold.dart:2207:50) #2 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4786:12) #3 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5) ... Normal element mounting (9 frames) ... ════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════ The following assertion was thrown building MyApp(state: _MyAppState#6de06): MediaQuery.of() called with a context that does not contain a MediaQuery.

No MediaQuery ancestor could be found starting from the context that was passed to MediaQuery.of(). This can happen because you do not have a WidgetsApp or MaterialApp widget (those widgets introduce a MediaQuery), or it can happen if the context you use comes from a widget above those widgets. The context used was: Scaffold dirty
state: ScaffoldState#b5bf9(lifecycle state: initialized, tickers: tracking 2 tickers) The relevant error-causing widget was: MyApp file:///S:/Businesses/Furniture/APP/movonpf/lib/main.dart:10:10 When the exception was thrown, this was the stack: #0 MediaQuery.of (package:flutter/src/widgets/media_query.dart:819:5) #1 ScaffoldState.didChangeDependencies (package:flutter/src/material/scaffold.dart:2207:50) #2 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4786:12) #3 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5) #4 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14) ... ════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════ MediaQuery.of() called with a context that does not contain a MediaQuery. The relevant error-causing widget was: MyApp file:///S:/Businesses/Furniture/APP/movonpf/lib/main.dart:10:10

import 'package:flutter/material.dart';
import 'package:movonpf/views/login_page.dart';
import 'package:splashscreen/splashscreen.dart';
import 'package:firebase_core/firebase_core.dart';


void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Container(
            child: SplashScreen(
            seconds: 1,
               image: Image.asset('assets/movonSplash.gif'),
              photoSize: 200.0,
              loaderColor: Colors.white,
              navigateAfterSeconds: LoginScreen(),
    ))
    );
  }
}
1

1 Answers

0
votes

Wrap Scaffold widget with a MaterialApp to provide the MediaQuery.