-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #183 from guyluz11/welcome_screens
Adding welcome page
- Loading branch information
Showing
13 changed files
with
362 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,4 +43,5 @@ enum PreferenceKeys { | |
freeText, | ||
tipType, | ||
sleepPermissionGranted, | ||
finishedIntroduction, | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
|
||
class ImageAtom extends StatelessWidget { | ||
const ImageAtom( | ||
this.name, { | ||
this.fit, | ||
this.width, | ||
this.height, | ||
this.hero, | ||
}); | ||
|
||
final String name; | ||
final BoxFit? fit; | ||
final double? width; | ||
final double? height; | ||
final String? hero; | ||
|
||
Widget image() { | ||
return Image.asset( | ||
name, | ||
fit: fit, | ||
width: width, | ||
height: height, | ||
); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
if (hero != null) { | ||
return Hero( | ||
tag: hero!, | ||
child: image(), | ||
); | ||
} | ||
return image(); | ||
} | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:infinite_horizons/domain/controllers/controllers.dart'; | ||
import 'package:infinite_horizons/presentation/atoms/atoms.dart'; | ||
import 'package:infinite_horizons/presentation/core/theme_data.dart'; | ||
import 'package:infinite_horizons/presentation/molecules/molecules.dart'; | ||
import 'package:infinite_horizons/presentation/pages/home_page.dart'; | ||
|
||
class ConvincingPage extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: ColoredBox( | ||
color: AppThemeData.logoBackgroundColor, | ||
child: Column( | ||
children: [ | ||
const TopBarMolecule(topBarType: TopBarType.none, margin: false), | ||
MarginedExpandedAtom( | ||
child: Expanded( | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
const SizedBox(width: double.infinity), | ||
AnimatedTextAtom( | ||
text: 'The app will', | ||
variant: AnimatedTextVariant.flicker, | ||
onDone: () {}, | ||
textColorWhite: true, | ||
), | ||
const SeparatorAtom(), | ||
const SeparatorAtom(), | ||
TextAtom( | ||
'* Organize your breaks', | ||
style: Theme.of(context) | ||
.textTheme | ||
.titleLarge! | ||
.copyWith(color: Colors.white), | ||
), | ||
const SeparatorAtom(), | ||
TextAtom( | ||
'* Enrich you with efficiency tips', | ||
style: Theme.of(context) | ||
.textTheme | ||
.titleLarge! | ||
.copyWith(color: Colors.white), | ||
), | ||
const SeparatorAtom(), | ||
TextAtom( | ||
'* Encourage healthy habits', | ||
style: Theme.of(context) | ||
.textTheme | ||
.titleLarge! | ||
.copyWith(color: Colors.white), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
const Expanded(child: Text('')), | ||
SafeArea( | ||
child: AnimatedOpacity( | ||
opacity: 1.0, | ||
duration: const Duration(seconds: 2), | ||
child: ButtonAtom( | ||
variant: ButtonVariant.highEmphasisFilled, | ||
onPressed: () { | ||
PreferencesController.instance | ||
.setBool(PreferenceKeys.finishedIntroduction, true); | ||
|
||
Navigator.of(context).pop(); | ||
|
||
Navigator.of(context).push( | ||
MaterialPageRoute( | ||
builder: (context) => HomePage(), | ||
), | ||
); | ||
}, | ||
text: 'Home Page', | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
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,9 +1,11 @@ | ||
export 'package:infinite_horizons/presentation/pages/activity_page.dart'; | ||
export 'package:infinite_horizons/presentation/pages/convincing_page.dart'; | ||
export 'package:infinite_horizons/presentation/pages/energy_tips_page.dart'; | ||
export 'package:infinite_horizons/presentation/pages/home_page.dart'; | ||
export 'package:infinite_horizons/presentation/pages/intro_page.dart'; | ||
export 'package:infinite_horizons/presentation/pages/ready_for_session_page.dart'; | ||
export 'package:infinite_horizons/presentation/pages/settings_page.dart'; | ||
export 'package:infinite_horizons/presentation/pages/splash_screen_page.dart'; | ||
export 'package:infinite_horizons/presentation/pages/tip_information_page.dart'; | ||
export 'package:infinite_horizons/presentation/pages/tip_resources_page.dart'; | ||
export 'package:infinite_horizons/presentation/pages/youtube_player_page.dart'; |
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:infinite_horizons/domain/controllers/controllers.dart'; | ||
import 'package:infinite_horizons/presentation/atoms/atoms.dart'; | ||
import 'package:infinite_horizons/presentation/core/theme_data.dart'; | ||
import 'package:infinite_horizons/presentation/pages/pages.dart'; | ||
import 'package:infinite_horizons/presentation/pages/welcome_page.dart'; | ||
|
||
class SplashPage extends StatefulWidget { | ||
@override | ||
State<SplashPage> createState() => _SplashPageState(); | ||
} | ||
|
||
class _SplashPageState extends State<SplashPage> { | ||
@override | ||
void initState() { | ||
super.initState(); | ||
initializeApp(); | ||
} | ||
|
||
Future initializeApp() async { | ||
await PreferencesController.instance.init(); | ||
PlayerController.instance.init(); | ||
await VibrationController.instance.init(); | ||
DndController.instance.init(); | ||
NotificationsController.instance.init(); | ||
HealthController.instance.init(); | ||
final int loginCounter = | ||
PreferencesController.instance.getInt(PreferenceKeys.loginCounter) ?? 0; | ||
PreferencesController.instance | ||
.setInt(PreferenceKeys.loginCounter, loginCounter + 1); | ||
|
||
_navigate(); | ||
} | ||
|
||
Future _navigate() async { | ||
final bool finishedIntroduction = PreferencesController.instance | ||
.getBool(PreferenceKeys.finishedIntroduction) ?? | ||
false; | ||
|
||
Navigator.of(context).pop(); | ||
|
||
if (finishedIntroduction) { | ||
Navigator.of(context).push( | ||
MaterialPageRoute( | ||
builder: (context) => HomePage(), | ||
), | ||
); | ||
return; | ||
} | ||
|
||
Navigator.of(context).push( | ||
MaterialPageRoute( | ||
builder: (context) => WelcomePage(), | ||
), | ||
); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: ColoredBox( | ||
color: AppThemeData.logoBackgroundColor, | ||
child: const Center( | ||
child: ImageAtom( | ||
'assets/logo.png', | ||
hero: 'full_logo', | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.