Dart 颤振镖类之间的回调或侦听器

Dart 颤振镖类之间的回调或侦听器,dart,flutter,Dart,Flutter,我是一个新手,刚刚开始为一个移动应用程序编写Dart/FLUTER代码。我试图在类之间创建一个接口、回调或侦听器,但我想不出最好的方法。对,应用程序很简单,它启动,显示一个splashscreen,在计时器过期后,我必须显示另一个屏幕。我正在使用SplashScreenlib来执行此操作,但我想调用一个侦听器/回调来启动另一个屏幕。下面是我的代码,以便更好地理解该结构 main.dart import 'package:flutter/material.dart'; import 'splash

我是一个新手,刚刚开始为一个移动应用程序编写Dart/FLUTER代码。我试图在类之间创建一个接口、回调或侦听器,但我想不出最好的方法。对,应用程序很简单,它启动,显示一个splashscreen,在计时器过期后,我必须显示另一个屏幕。我正在使用
SplashScreen
lib来执行此操作,但我想调用一个侦听器/回调来启动另一个屏幕。下面是我的代码,以便更好地理解该结构

main.dart

import 'package:flutter/material.dart';
import 'splash_screen.dart';

void main(){
  runApp(new MaterialApp(
    home: new MyApp(),
  ));
}

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

class _MyAppState extends State<MyApp> {

  @override
  Widget build(BuildContext context) {
    return new MyHomeSplashScreen().myHomeSplashScreen();
  }
}
}
class MyHomeSplashScreen{
  SplashScreen myHomeSplashScreen(){
    return SplashScreen(
        seconds: 5,
        navigateAfterSeconds: null,//I want my callback there,
        title: _mySplashText(),
        imageBackground: new AssetImage("assets/images/splash_screen.png"),
        backgroundColor: Colors.transparent,
        styleTextUnderTheLoader: new TextStyle(),
        photoSize: 100.0,
        //onClick: ()=>print("Flutter Egypt"),
        loaderColor: Colors.white,
      );
  }

  Text _mySplashText(){
    return Text('MyHome', 
      style: new TextStyle(
        fontStyle: FontStyle.italic,
        fontWeight: FontWeight.bold,
        fontSize: 80.0,
        color: Colors.white
      ));
  }
}
回调/侦听器应该在
splash_screen.dart
中调用,如我的示例所示,并在
main.dart

import 'package:flutter/material.dart';
import 'splash_screen.dart';

void main(){
  runApp(new MaterialApp(
    home: new MyApp(),
  ));
}

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

class _MyAppState extends State<MyApp> {

  @override
  Widget build(BuildContext context) {
    return new MyHomeSplashScreen().myHomeSplashScreen();
  }
}
}
class MyHomeSplashScreen{
  SplashScreen myHomeSplashScreen(){
    return SplashScreen(
        seconds: 5,
        navigateAfterSeconds: null,//I want my callback there,
        title: _mySplashText(),
        imageBackground: new AssetImage("assets/images/splash_screen.png"),
        backgroundColor: Colors.transparent,
        styleTextUnderTheLoader: new TextStyle(),
        photoSize: 100.0,
        //onClick: ()=>print("Flutter Egypt"),
        loaderColor: Colors.white,
      );
  }

  Text _mySplashText(){
    return Text('MyHome', 
      style: new TextStyle(
        fontStyle: FontStyle.italic,
        fontWeight: FontWeight.bold,
        fontSize: 80.0,
        color: Colors.white
      ));
  }
}
你知道最好怎么做吗?
谢谢

您可以尝试extendsValueNotifier 和usd将侦听器添加到回调