Skip to content

Commit 6c8d9d6

Browse files
committed
Splash Screen and walk through bug killed
1 parent ef25cff commit 6c8d9d6

File tree

5 files changed

+109
-78
lines changed

5 files changed

+109
-78
lines changed

final_app/assets/splash.png

46 KB
Loading

final_app/lib/Constants.dart

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,44 @@
11
import 'package:flutter/material.dart';
22
import 'package:google_fonts/google_fonts.dart';
33

4-
54
final KSplashPage = GoogleFonts.raleway(
6-
color: Colors.black,
7-
fontSize: 25,
8-
fontWeight: FontWeight.w600
9-
);
5+
color: Colors.black, fontSize: 25, fontWeight: FontWeight.w600);
106

117
final KAppBarContainerPage = GoogleFonts.raleway(
12-
color: Colors.white,
13-
fontSize: 20,
8+
color: Colors.white,
9+
fontSize: 20,
1410
);
1511

1612
final KsearchBar = GoogleFonts.raleway(
17-
color: Colors.black54,
18-
fontSize: 12,
13+
color: Colors.black54,
14+
fontSize: 12,
1915
);
2016

2117
final KCategoriessearchBar = GoogleFonts.raleway(
22-
color: Colors.grey[300],
23-
fontSize: 18,
18+
color: Colors.grey[300],
19+
fontSize: 18,
2420
);
2521

2622
final kHeadingLight = GoogleFonts.raleway(
27-
color: Colors.black,
28-
fontStyle: FontStyle.normal,
29-
fontWeight: FontWeight.w100,
30-
fontSize: 32.0,
23+
color: Colors.black,
24+
fontStyle: FontStyle.normal,
25+
fontWeight: FontWeight.w100,
26+
fontSize: 32.0,
3127
);
3228
final kHeadingHard = GoogleFonts.raleway(
33-
color: Colors.black,
34-
fontStyle: FontStyle.normal,
35-
fontWeight: FontWeight.w900,
36-
fontSize: 32.0,
29+
color: Colors.black,
30+
fontStyle: FontStyle.normal,
31+
fontWeight: FontWeight.w900,
32+
fontSize: 32.0,
3733
);
3834

3935
final kLoginStyle = GoogleFonts.raleway(
40-
color: Colors.black,
41-
fontWeight: FontWeight.w600,
42-
fontSize: 30,
36+
color: Colors.black,
37+
fontWeight: FontWeight.w600,
38+
fontSize: 30,
4339
);
4440

4541
final kButtonStyle = GoogleFonts.raleway(
46-
color: Colors.white,
47-
fontSize: 20,
42+
color: Colors.white,
43+
fontSize: 20,
4844
);

final_app/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class MyApp extends StatelessWidget {
2424
accentColor: Color(0xFFDE3C26)
2525
),
2626
debugShowCheckedModeBanner: false,
27-
title: "Chicken App",
27+
title: "Fresho Daily",
2828
home: SplashScreenPage(),
2929
);
3030
}
Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:final_app/models/user.dart';
2+
import 'package:final_app/pages/WalkThrough.dart';
23
import 'package:flutter/material.dart';
34
import 'package:flutter/widgets.dart';
45
import 'package:splashscreen/splashscreen.dart';
@@ -16,29 +17,29 @@ class _SplashScreenPageState extends State<SplashScreenPage> {
1617
@override
1718
Widget build(BuildContext context) {
1819
return SplashScreen(
19-
seconds: 6,
20+
seconds: 4,
2021
photoSize: 150,
21-
image: Image.asset('assets/freshodaily.png'),
22-
navigateAfterSeconds: check_if_already_login(context),
22+
image: Image.asset('assets/splash.png'),
23+
navigateAfterSeconds: new WalkThrough(),
2324
);
2425
}
2526
}
26-
27-
check_if_already_login(BuildContext context) async {
28-
await Preferences.getWalkThrough().then((value) {
29-
if (value == false) {
30-
Navigator.of(context).pushNamed('/WalkThrough');
31-
} else {
32-
Preferences.getUser().then((value) {
33-
User user = new User();
34-
user = value;
35-
36-
if (user.name == "--") {
37-
Navigator.of(context).pushNamed('/LoginPage');
38-
} else {
39-
Navigator.of(context).pushNamed('/MainPage');
40-
}
41-
});
42-
}
43-
});
44-
}
27+
//
28+
//check_if_already_login(BuildContext context) async {
29+
// await Preferences.getWalkThrough().then((value) {
30+
// if (value == false) {
31+
// Navigator.of(context).pushNamed('/WalkThrough');
32+
// } else {
33+
// Preferences.getUser().then((value) {
34+
// User user = new User();
35+
// user = value;
36+
//
37+
// if (user.name == "--") {
38+
// Navigator.of(context).pushNamed('/LoginPage');
39+
// } else {
40+
// Navigator.of(context).pushNamed('/MainPage');
41+
// }
42+
// });
43+
// }
44+
// });
45+
//}
Lines changed: 65 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import 'package:final_app/models/user.dart';
2+
import 'package:final_app/pages/LoginPage.dart';
3+
import 'package:final_app/pages/MainPage.dart';
14
import 'package:flutter/material.dart';
25
import 'package:sk_onboarding_screen/sk_onboarding_model.dart';
36
import 'package:sk_onboarding_screen/sk_onboarding_screen.dart';
@@ -10,6 +13,9 @@ class WalkThrough extends StatefulWidget {
1013
}
1114

1215
class _WalkThroughState extends State<WalkThrough> {
16+
User user = new User();
17+
bool walk;
18+
bool afterwalk;
1319
final pages = [
1420
SkOnboardingModel(
1521
title: 'Truely Delighful\nMeats & Seafood',
@@ -41,38 +47,66 @@ class _WalkThroughState extends State<WalkThrough> {
4147
'assets/delivery-service-with-masks-concept_23-2148535315.jpg'),
4248
];
4349

50+
@override
51+
initState() {
52+
super.initState();
53+
initPrefs();
54+
}
55+
56+
void initPrefs() async {
57+
await Preferences.getUser().then((value) {
58+
setState(() {
59+
user = value;
60+
});
61+
});
62+
await Preferences.getWalkThrough().then((value) {
63+
walk = value;
64+
});
65+
if (this.user.name == '--') {
66+
afterwalk = false;
67+
} else {
68+
afterwalk = true;
69+
}
70+
}
71+
4472
@override
4573
Widget build(BuildContext context) {
46-
return Scaffold(
47-
body: SKOnboardingScreen(
48-
bgColor: Colors.white,
49-
themeColor: const Color(0xFFf74269),
50-
pages: pages,
51-
skipClicked: (value) {
52-
Preferences.setUser(
53-
"--",
54-
"--",
55-
"--",
56-
);
57-
Preferences.setWalkThrough().then((value) {
58-
print(
59-
"========================Settting walk through=======================");
60-
});
61-
Navigator.of(context).pushReplacementNamed('/LoginPage');
62-
},
63-
getStartedClicked: (value) {
64-
Preferences.setUser(
65-
"--",
66-
"--",
67-
"--",
68-
);
69-
Preferences.setWalkThrough().then((value) {
70-
print(
71-
"========================Settting walk through=======================");
72-
});
73-
Navigator.of(context).pushReplacementNamed('/LoginPage');
74-
},
75-
),
76-
);
74+
if (walk == false) {
75+
return Scaffold(
76+
body: SKOnboardingScreen(
77+
bgColor: Colors.white,
78+
themeColor: const Color(0xFFf74269),
79+
pages: pages,
80+
skipClicked: (value) {
81+
Preferences.setUser(
82+
"--",
83+
"--",
84+
"--",
85+
);
86+
Preferences.setWalkThrough().then((value) {
87+
print(
88+
"========================Settting walk through=======================");
89+
});
90+
Navigator.of(context).pushReplacementNamed('/LoginPage');
91+
},
92+
getStartedClicked: (value) {
93+
Preferences.setUser(
94+
"--",
95+
"--",
96+
"--",
97+
);
98+
Preferences.setWalkThrough().then((value) {
99+
print(
100+
"========================Settting walk through=======================");
101+
});
102+
Navigator.of(context).pushReplacementNamed('/LoginPage');
103+
},
104+
),
105+
);
106+
}else if(afterwalk==false){
107+
return new LoginPage();
108+
}else{
109+
return new MainPage();
110+
}
77111
}
78112
}

0 commit comments

Comments
 (0)