Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.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 你好I';我正在构建一个应用程序,我';我试图避免每次创业时都会出现我的入职屏幕。我希望每个用户只显示一次_Flutter_Dart - Fatal编程技术网

Flutter 你好I';我正在构建一个应用程序,我';我试图避免每次创业时都会出现我的入职屏幕。我希望每个用户只显示一次

Flutter 你好I';我正在构建一个应用程序,我';我试图避免每次创业时都会出现我的入职屏幕。我希望每个用户只显示一次,flutter,dart,Flutter,Dart,这是我的主.dart文件: void main() => runApp(MyApp()); class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { @override void initState() { super.initState

这是我的主.dart文件:

void main() => runApp(MyApp());

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    configOneSignal();
  }

  void configOneSignal() {
    OneSignal.shared.init(kAppID);
  }

  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider<ThemeChanger>(
      create: (_) => ThemeChanger(),
      child: Builder(builder: (context) {
        final themeChanger = Provider.of<ThemeChanger>(context);
        return MaterialApp(
          debugShowCheckedModeBanner: false,
          title: TITLE,
          themeMode: themeChanger.getTheme,
          darkTheme: Style.get(true),
          theme: Style.get(false),
          home: Directionality(
            textDirection: textDirection,
            child: OnboardingScreenOne(),
          ),
        );
      }),
    );
  }
}
void main()=>runApp(MyApp());
类MyApp扩展了StatefulWidget{
@凌驾
_MyAppState createState()=>\u MyAppState();
}
类MyAppState扩展了状态{
@凌驾
void initState(){
super.initState();
configOneSignal();
}
void configOneSignal(){
OneSignal.shared.init(kAppID);
}
@凌驾
小部件构建(构建上下文){
返回ChangeNotifierProvider(
创建:()=>Themechance(),
子:生成器(生成器:(上下文){
final themeChanger=Provider.of(上下文);
返回材料PP(
debugShowCheckedModeBanner:false,
标题:标题,,
themeMode:Themechance.getTheme,
黑暗主题:风格。获得(真实),
主题:Style.get(false),
家:方向性(
textDirection:textDirection,
子项:OnboardingScreenOne(),
),
);
}),
);
}
}
我需要帮助确保我的启动屏幕不会出现在每次启动的每个用户面前。因此,我想让它在每个设备上每个用户只显示一次。

您可以使用该包存储isFirstTime布尔变量。在开始时将其设置为true。当用户第一次完成登录时,将其设置为false。加载应用程序时,您可以检查isFirstTime是否为真;如果为真,则显示onboarding,否则跳到home。

您需要使用来记录用户行为,一旦用户导航器在onboarding页面后在本地记录,然后在打开应用程序时通过检索返回值来确定:

      home: Directionality(
        textDirection: textDirection,
        child: isRead? HomePage() : OnboardingScreenOne(),