Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 在我的Flitter应用程序中,黑屏在闪屏前来去匆匆_Flutter_Dart - Fatal编程技术网

Flutter 在我的Flitter应用程序中,黑屏在闪屏前来去匆匆

Flutter 在我的Flitter应用程序中,黑屏在闪屏前来去匆匆,flutter,dart,Flutter,Dart,我正在开发一个颤振应用程序,当我打开这个应用程序时,在启动屏幕出现之前,会出现一个黑屏。这真的很烦人。这是我的启动屏幕代码 class SplashScreen extends StatefulWidget { @override _SplashScreenState createState() => _SplashScreenState(); } class _SplashScreenState extends State<SplashScreen> {

我正在开发一个颤振应用程序,当我打开这个应用程序时,在启动屏幕出现之前,会出现一个黑屏。这真的很烦人。这是我的启动屏幕代码

   class SplashScreen extends StatefulWidget {
  @override
  _SplashScreenState createState() => _SplashScreenState();
}

class _SplashScreenState extends State<SplashScreen> {
  @override
  void initState() {
    super.initState();
    Future.delayed(
      Duration(seconds: 3),
      () {
        Navigator.pop(context);
        Navigator.push(
          context,
          MaterialPageRoute(
            builder: (context) => LoginPage(),
          ),
        );
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    // final double width = MediaQuery.of(context).size.width;

    return Scaffold(
      backgroundColor: Color.fromRGBO(245, 246, 250, 1),
      body: DelayedReveal(
        delay: Duration(milliseconds: 1200),
        child: Center(
          child: Image.asset(
            'assets/images/logo.png',
            width: 280,
            height: 280,
          ),
        ),
      ),
    );
  }
}
类SplashScreen扩展StatefulWidget{
@凌驾
_SplashScreenState createState()=>\u SplashScreenState();
}
类的状态扩展了状态{
@凌驾
void initState(){
super.initState();
推迟(
持续时间(秒:3),
() {
Navigator.pop(上下文);
导航器。推(
上下文
材料路线(
生成器:(上下文)=>LoginPage(),
),
);
},
);
}
@凌驾
小部件构建(构建上下文){
//final double width=MediaQuery.of(context).size.width;
返回脚手架(
背景颜色:颜色。来自RGBO(245246250,1),
正文:DelayedReveal(
延迟:持续时间(毫秒:1200),
儿童:中心(
子:Image.asset(
“assets/images/logo.png”,
宽度:280,
身高:280,
),
),
),
);
}
}
这是我的主飞镖

void main()=>runApp(MyApp());
类MyApp扩展了无状态小部件{
//此小部件是应用程序的根。
@凌驾
小部件构建(构建上下文){
返回材料PP(
debugShowCheckedModeBanner:false,
标题:"民间",,
主题:主题数据(
原始样本:颜色。橙色,
),
主页:新的SplashScreen(),
路线:{
//登录和重新注册路由
“/login”:(BuildContext上下文)=>new LoginPage(),
“/phonelogin”:(BuildContext上下文)=>new phonelogin(),
“/forgotpw”:(BuildContext上下文)=>new ForgotPassword(),
“/resetpw”:(BuildContext上下文)=>new ResetPassword(),
“/pincode”:(BuildContext上下文)=>new PincodeVerify(),
“/setupstep1”:(BuildContext上下文)=>new SetupStepOne(),
“/setupstep2”:(BuildContext上下文)=>new setupstep2(),
“/setupstep3”:(BuildContext上下文)=>new SetupStepThree(),
“/location”:(BuildContext上下文)=>new GetLocation(),
“/SettingUpScreen”:(构建上下文)=>new SettingUpScreen(),
//主页路线
“/home”:(BuildContext上下文)=>新主页(),
},
);
}
}
希望有人能帮我解决这个问题

我的颤振版本是v1.12.13+修补程序


我已经用以前版本的Flatter sdk(v1.12.13+修补程序.6)做了一个Flatter应用程序,该应用程序没有给我这个错误

你配置了本机Android和iOS启动屏幕吗?没有。。我应该吗?试试看。可能有用!你能告诉我怎么做吗?改变本机Android和iOS启动屏幕与Flitter无关。这与在任何不涉及Flatter的本机Android或iOS应用程序中更改启动屏幕一样。您是否配置了本机Android和iOS启动屏幕?不,我没有。。我应该吗?试试看。可能有用!你能告诉我怎么做吗?改变本机Android和iOS启动屏幕与Flitter无关。这与在任何不涉及flatter的原生Android或iOS应用程序中更改启动屏幕一样。
void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Folk',
      theme: ThemeData(
        primarySwatch: Colors.orange,
      ),
      home: new SplashScreen(),
      routes: <String, WidgetBuilder>{
        // login and resgistration routes
        "/login": (BuildContext context) => new LoginPage(),
        "/phonelogin": (BuildContext context) => new PhoneLogin(),
         "/forgotpw": (BuildContext context) => new ForgotPassword(),
        "/resetpw": (BuildContext context) => new ResetPassword(),
        "/pincode": (BuildContext context) => new PincodeVerify(),
        "/setupstep1": (BuildContext context) => new SetupStepOne(),
        "/setupstep2": (BuildContext context) => new SetupStepTwo(),
        "/setupstep3": (BuildContext context) => new SetupStepThree(),
        "/location": (BuildContext context) => new GetLocation(),
        "/SettingUpScreen": (BuildContext context) => new SettingUpScreen(),

        //homepage routes
        "/home": (BuildContext context) => new Homepage(),
      },
    );
  }
}