Skip to content

Commit 7551c0d

Browse files
committed
added welcome screen
1 parent 20202da commit 7551c0d

File tree

7 files changed

+276
-77
lines changed

7 files changed

+276
-77
lines changed

lib/main.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:flutter_animate/flutter_animate.dart';
33
import 'package:help_me_design/appwrite_service/auth_service.dart';
44
import 'package:help_me_design/providers/component_tab_provider/component_tab_provider.dart';
55
import 'package:help_me_design/providers/explore_tab_provider/explore_tab_provider.dart';
6+
import 'package:help_me_design/theme/my_colors.dart';
67
import 'package:help_me_design/theme/my_theme.dart';
78
import 'package:help_me_design/views/screens/onboarding_screens/signin_signup_screen/signin_signup_screen.dart';
89
import 'package:help_me_design/views/welcome_screen.dart';
@@ -53,11 +54,12 @@ class _MyAppState extends State<MyApp> {
5354
themeMode: themeManagerProvider.getThemeMode,
5455
// home: const MyHomePage(),
5556
// home: WelcomeScreen(),
56-
home: authServiceProvider.status == AuthStatus.unauthenticated
57-
? const SignInSignUpScreen()
57+
home: authServiceProvider.status == AuthStatus.uninitialized
58+
? Container(child: const Center(child: CircularProgressIndicator(color: DesignSystemColors.secondaryColorDark)))
5859
: authServiceProvider.status == AuthStatus.authenticated
5960
? const MyHomePage()
6061
: const WelcomeScreen(),
62+
// : SignInSignUpScreen()
6163
// home: WelcomeScreen(),
6264
);
6365
}),

lib/utility/utility_helper.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:help_me_design/theme/my_colors.dart';
3-
import 'package:help_me_design/theme/my_design_system.dart';
4-
import 'package:help_me_design/views/widgets/button_tap_effect.dart';
5-
import 'package:help_me_design/views/widgets/form_widgets/buttons/simple_button.dart';
6-
import 'package:help_me_design/views/widgets/form_widgets/input_fields/email_input_field.dart';
7-
import 'package:help_me_design/views/widgets/form_widgets/input_fields/text_input_field.dart';
3+
84
import 'package:url_launcher/url_launcher.dart';
95

106
import '../constants/app_constants.dart';

lib/views/screens/home_screen/home_screen.dart

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_animate/flutter_animate.dart';
3+
import 'package:help_me_design/appwrite_service/auth_service.dart';
4+
import 'package:help_me_design/utility/utility_helper.dart';
35
import 'package:help_me_design/views/screens/tabs/components_tab/components_tab.dart';
46
import 'package:help_me_design/views/screens/tabs/inspiration_tab/inspiration_tab.dart';
57
import 'package:help_me_design/views/screens/tabs/saved_tab/saved_tab.dart';
68
import 'package:help_me_design/views/screens/tabs/settings_tab/settings_tab.dart';
9+
import 'package:provider/provider.dart';
710

811
import '../tabs/code_snippet_tab/code_snippet_tab.dart';
912
import '../tabs/explore_tab/explore_tab.dart';
1013
import 'widgets/admin_view_sidebar.dart';
14+
import 'widgets/sign_in_alert_card.dart';
1115

1216
// save youtube videos
1317
// save websites
@@ -51,20 +55,15 @@ class _MyHomePageState extends State<MyHomePage> {
5155
@override
5256
Widget build(BuildContext context) {
5357
Size size = MediaQuery.of(context).size;
58+
var authService = Provider.of<AuthService>(context, listen: false);
5459
return Scaffold(
5560
body: Center(
5661
child: Container(
57-
// width: double.maxFinite,
5862
height: size.height,
59-
// clipBehavior: Clip.antiAlias,
6063
constraints: const BoxConstraints(maxWidth: 1200, minWidth: 1200),
61-
// margin: const EdgeInsets.all(44), //web
6264
margin: const EdgeInsets.all(22), // MObile
63-
// padding: EdgeInsets.all(24),
6465
decoration: BoxDecoration(
65-
// border: Border.all(width: 1, color: Colors.black54),
6666
borderRadius: BorderRadius.circular(24),
67-
// color: Theme.of(context).colorScheme.secondary,
6867
),
6968
child: SafeArea(
7069
child: Row(
@@ -74,8 +73,23 @@ class _MyHomePageState extends State<MyHomePage> {
7473
AdminViewSideBar(
7574
activeButtonType: activeButton,
7675
onSideTabButtonChange: (SideTabType newTabChange) {
77-
activeButton = newTabChange;
78-
setState(() {});
76+
// if user is not logged in then only let him see explore and settings sections
77+
if (newTabChange == SideTabType.explore || newTabChange == SideTabType.settings) {
78+
activeButton = newTabChange;
79+
setState(() {});
80+
return;
81+
}
82+
// if user is logged in then let him see everything
83+
if (authService.status == AuthStatus.authenticated) {
84+
activeButton = newTabChange;
85+
setState(() {});
86+
return;
87+
}
88+
// else show him alert for SignIn
89+
UtilityHelper.showAlertMyDialog(
90+
context: context,
91+
bodyWidget: SignInAlertCard(),
92+
);
7993
},
8094
),
8195
Expanded(
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:help_me_design/theme/my_design_system.dart';
3+
import 'package:help_me_design/theme/my_theme.dart';
4+
import 'package:help_me_design/views/screens/onboarding_screens/signin_signup_screen/signin_signup_screen.dart';
5+
import 'package:help_me_design/views/widgets/button_tap_effect.dart';
6+
7+
class SignInAlertCard extends StatelessWidget {
8+
const SignInAlertCard({Key? key}) : super(key: key);
9+
10+
@override
11+
Widget build(BuildContext context) {
12+
var themeData = Theme.of(context);
13+
return Container(
14+
padding: EdgeInsets.all(MySpaceSystem.spaceX3),
15+
decoration: BoxDecoration(
16+
boxShadow: cardShadow,
17+
color: themeData.colorScheme.secondary,
18+
borderRadius: BorderRadius.circular(8),
19+
),
20+
// width: 300,
21+
// height: 234,
22+
child: Column(
23+
children: [
24+
Text('Sign In Alert', style: themeData.textTheme.titleMedium),
25+
SizedBox(height: MySpaceSystem.spaceX4),
26+
Text('SignIn to Access Saved Sections', style: themeData.textTheme.bodyLarge),
27+
SizedBox(height: MySpaceSystem.spaceX4),
28+
Row(
29+
mainAxisAlignment: MainAxisAlignment.center,
30+
children: [
31+
ButtonTapEffect(
32+
onTap: () {
33+
Navigator.pop(context);
34+
},
35+
child: Container(
36+
decoration: BoxDecoration(
37+
boxShadow: cardShadow,
38+
color: themeData.colorScheme.primary,
39+
borderRadius: BorderRadius.circular(4),
40+
// border: Border.all(
41+
// // color: Colors.black,
42+
// ),
43+
),
44+
width: 154,
45+
height: 48,
46+
child: Center(
47+
child: Text('Cancel', style: themeData.textTheme.bodyLarge),
48+
),
49+
),
50+
),
51+
SizedBox(width: MySpaceSystem.spaceX2),
52+
ButtonTapEffect(
53+
onTap: () {
54+
Navigator.pop(context);
55+
Navigator.push(
56+
context,
57+
MaterialPageRoute(
58+
builder: (context) {
59+
return SignInSignUpScreen();
60+
},
61+
),
62+
);
63+
},
64+
child: Container(
65+
decoration: BoxDecoration(
66+
boxShadow: cardShadow,
67+
color: themeData.colorScheme.primary,
68+
borderRadius: BorderRadius.circular(4),
69+
),
70+
width: 158,
71+
height: 48,
72+
child: Center(
73+
child: Text('SignIn', style: themeData.textTheme.bodyLarge),
74+
),
75+
),
76+
),
77+
],
78+
)
79+
],
80+
),
81+
);
82+
}
83+
}

lib/views/screens/tabs/settings_tab/settings_tab.dart

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,35 +52,38 @@ class SettingsTab extends StatelessWidget {
5252
children: [
5353
Text("Default Name", style: MyTextTypeSystem.titleMediumDark),
5454
const SizedBox(height: MySpaceSystem.spaceX),
55-
Text(authService.currentUser.email, style: MyTextTypeSystem.titleLargeDark),
55+
authService.status == AuthStatus.authenticated
56+
? Text(authService.currentUser.email, style: MyTextTypeSystem.titleLargeDark)
57+
: Text("example@gmail.com (Not Signed In)", style: MyTextTypeSystem.titleLargeDark),
5658
// Text("currentUser@gmail.com (dummy email for demo)", style: MyTextTypeSystem.titleLargeDark),
5759
],
5860
),
5961
],
6062
),
61-
ButtonTapEffect(
62-
onTap: () {
63-
authService.signOut();
64-
},
65-
child: Container(
66-
height: 64,
67-
decoration: BoxDecoration(
68-
boxShadow: cardShadow,
69-
color: DesignSystemColors.secondaryColorDark,
70-
borderRadius: BorderRadius.circular(8),
71-
),
72-
padding: EdgeInsets.symmetric(horizontal: MySpaceSystem.spaceX2),
73-
child: Row(
74-
crossAxisAlignment: CrossAxisAlignment.center,
75-
children: [
76-
SizedBox(width: MySpaceSystem.spaceX1),
77-
Text("Logout", style: MyTextTypeSystem.titleMedium),
78-
SizedBox(width: MySpaceSystem.spaceX1),
79-
const Icon(Icons.logout_rounded, color: DesignSystemColors.secondaryColor, size: 34),
80-
],
63+
if (authService.status == AuthStatus.authenticated)
64+
ButtonTapEffect(
65+
onTap: () {
66+
authService.signOut();
67+
},
68+
child: Container(
69+
height: 64,
70+
decoration: BoxDecoration(
71+
boxShadow: cardShadow,
72+
color: DesignSystemColors.secondaryColorDark,
73+
borderRadius: BorderRadius.circular(8),
74+
),
75+
padding: EdgeInsets.symmetric(horizontal: MySpaceSystem.spaceX2),
76+
child: Row(
77+
crossAxisAlignment: CrossAxisAlignment.center,
78+
children: [
79+
SizedBox(width: MySpaceSystem.spaceX1),
80+
Text("Logout", style: MyTextTypeSystem.titleMedium),
81+
SizedBox(width: MySpaceSystem.spaceX1),
82+
const Icon(Icons.logout_rounded, color: DesignSystemColors.secondaryColor, size: 34),
83+
],
84+
),
8185
),
8286
),
83-
),
8487
],
8588
),
8689
),

0 commit comments

Comments
 (0)