-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT] Implementa funcionalidade ViewCount (#58)
- Loading branch information
1 parent
e5b6742
commit d022f55
Showing
3 changed files
with
33 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,32 @@ | ||
import 'package:aranduapp/config/ThemeApp.dart'; | ||
import 'package:aranduapp/ui/login/view/LoginView.dart'; | ||
import 'package:aranduapp/ui/welcome/view/WelcomeView.dart'; | ||
import 'package:aranduapp/ui/onboarding/viewModel/onboarding_view_model.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:aranduapp/core/data/local/StorageValue.dart'; | ||
|
||
void main() { | ||
runApp(const MyApp()); | ||
void main() async { | ||
WidgetsFlutterBinding.ensureInitialized(); | ||
|
||
await OnboardingViewModel().incrementNumber(); | ||
|
||
int viewCount = await StorageValue.getInstance().getOnboardingCount() ?? 0; | ||
|
||
runApp(MyApp(viewCount: viewCount)); | ||
} | ||
|
||
class MyApp extends StatelessWidget { | ||
const MyApp({super.key}); | ||
final int viewCount; | ||
|
||
const MyApp({super.key, required this.viewCount}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
theme: ThemeApp.themeData(), | ||
darkTheme: ThemeApp.darkThemeData(), | ||
debugShowCheckedModeBanner: false, | ||
home: WelcomeView(), | ||
home: viewCount >= 3 ? const Login() : WelcomeView(), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters