Skip to content

Commit b114b0d

Browse files
committed
Added infocard on applaunch & UI enhanced elements
1 parent cd72bf2 commit b114b0d

File tree

5 files changed

+199
-87
lines changed

5 files changed

+199
-87
lines changed

lib/features/feed/feed_screen.dart

Lines changed: 139 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import 'package:femunity/features/communities/controller/community_controller.da
66
import 'package:femunity/features/posts/controller/posts_controller.dart';
77
import 'package:flutter/material.dart';
88
import 'package:flutter_riverpod/flutter_riverpod.dart';
9+
import 'package:url_launcher/url_launcher.dart';
910

1011
class FeedScreen extends ConsumerWidget {
11-
const FeedScreen({super.key});
12+
const FeedScreen({Key? key});
1213

1314
@override
1415
Widget build(BuildContext context, WidgetRef ref) {
@@ -17,51 +18,149 @@ class FeedScreen extends ConsumerWidget {
1718

1819
if (!isGuest) {
1920
return ref.watch(userCommunitiesProvider).when(
20-
data: (communities) => ref.watch(userPostsProvider(communities)).when(
21-
data: (data) {
22-
return ListView.builder(
23-
itemCount: data.length,
24-
itemBuilder: (BuildContext context, int index) {
25-
final post = data[index];
26-
return PostCard(post: post);
27-
},
28-
);
29-
},
30-
error: (error, stackTrace) {
31-
return ErrorText(
32-
error: error.toString(),
33-
);
34-
},
35-
loading: () => const Loader(),
36-
),
21+
data: (communities) {
22+
if (communities.isEmpty) {
23+
return SingleChildScrollView(
24+
child: Column(
25+
children: [
26+
SizedBox(height: 30),
27+
Card(
28+
margin: const EdgeInsets.symmetric(horizontal: 16),
29+
shape: RoundedRectangleBorder(
30+
borderRadius: BorderRadius.circular(24),
31+
),
32+
elevation: 8,
33+
color: Theme.of(context).brightness == Brightness.dark
34+
? Colors.grey[900]
35+
: Color(0xFFffe9ec),
36+
child: Column(
37+
crossAxisAlignment: CrossAxisAlignment.stretch,
38+
children: [
39+
Padding(
40+
padding: const EdgeInsets.symmetric(
41+
horizontal: 16, vertical: 16),
42+
child: Text(
43+
'How to use this app',
44+
style: TextStyle(
45+
fontWeight: FontWeight.bold,
46+
fontSize: 24,
47+
color: Colors.purpleAccent,
48+
),
49+
),
50+
),
51+
Padding(
52+
padding:
53+
const EdgeInsets.symmetric(horizontal: 16),
54+
child: Text(
55+
'To use the Femunity app, follow these simple steps:\n',
56+
style: TextStyle(fontSize: 18),
57+
),
58+
),
59+
SizedBox(height: 8),
60+
Padding(
61+
padding:
62+
const EdgeInsets.symmetric(horizontal: 16),
63+
child: Text(
64+
'- Tap the search bar above to search and join communities.\n\n- Press the "+" button on the home screen to add posts.\n\n- Go to the community drawer to access your communities.',
65+
style: TextStyle(fontSize: 18),
66+
),
67+
),
68+
SizedBox(height: 16),
69+
],
70+
),
71+
),
72+
SizedBox(height: 16),
73+
Card(
74+
margin: const EdgeInsets.symmetric(horizontal: 16),
75+
shape: RoundedRectangleBorder(
76+
borderRadius: BorderRadius.circular(24),
77+
),
78+
elevation: 8,
79+
color: Theme.of(context).brightness == Brightness.dark
80+
? Colors.grey[900]
81+
: Color(0xFFffe9ec),
82+
child: InkWell(
83+
onTap: () => launch('https://youtube.com/'),
84+
child: Column(
85+
crossAxisAlignment: CrossAxisAlignment.stretch,
86+
children: [
87+
ClipRRect(
88+
borderRadius: BorderRadius.vertical(
89+
top: Radius.circular(24)),
90+
child: Image.network(
91+
'https://1000logos.net/wp-content/uploads/2017/05/Color-YouTube-logo.jpg',
92+
height: 200,
93+
width: double.infinity,
94+
fit: BoxFit.cover,
95+
),
96+
),
97+
SizedBox(height: 16),
98+
Padding(
99+
padding:
100+
const EdgeInsets.symmetric(horizontal: 16),
101+
child: Text(
102+
'Watch this video to learn more!',
103+
style: TextStyle(
104+
fontWeight: FontWeight.bold,
105+
fontSize: 24,
106+
color: Colors.purpleAccent,
107+
),
108+
),
109+
),
110+
SizedBox(height: 8),
111+
Padding(
112+
padding:
113+
const EdgeInsets.symmetric(horizontal: 16),
114+
),
115+
SizedBox(height: 16),
116+
],
117+
),
118+
),
119+
),
120+
],
121+
),
122+
);
123+
}
124+
return ref.watch(userPostsProvider(communities)).when(
125+
data: (data) {
126+
return ListView.builder(
127+
itemCount: data.length,
128+
itemBuilder: (BuildContext context, int index) {
129+
final post = data[index];
130+
return PostCard(post: post);
131+
},
132+
);
133+
},
134+
error: (error, stackTrace) {
135+
return ErrorText(
136+
error: error.toString(),
137+
);
138+
},
139+
loading: () => const Loader(),
140+
);
141+
},
37142
error: (error, stackTrace) => ErrorText(
38143
error: error.toString(),
39144
),
40145
loading: () => const Loader(),
41146
);
42147
}
43-
return ref.watch(userCommunitiesProvider).when(
44-
data: (communities) => ref.watch(GuestPostsProvider).when(
45-
data: (data) {
46-
return ListView.builder(
47-
itemCount: data.length,
48-
itemBuilder: (BuildContext context, int index) {
49-
final post = data[index];
50-
return PostCard(post: post);
51-
},
52-
);
53-
},
54-
error: (error, stackTrace) {
55-
return ErrorText(
56-
error: error.toString(),
57-
);
58-
},
59-
loading: () => const Loader(),
60-
),
61-
error: (error, stackTrace) => ErrorText(
62-
error: error.toString(),
63-
),
148+
return ref.watch(GuestPostsProvider).when(
149+
data: (data) {
150+
return ListView.builder(
151+
itemCount: data.length,
152+
itemBuilder: (BuildContext context, int index) {
153+
final post = data[index];
154+
return PostCard(post: post);
155+
},
156+
);
157+
},
158+
error: (error, stackTrace) {
159+
return ErrorText(
160+
error: error.toString(),
161+
);
162+
},
64163
loading: () => const Loader(),
65164
);
66165
}
67-
}
166+
}

lib/features/home/drawer/list_of_communities.dart

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,40 +31,51 @@ class CommunityListDrawer extends ConsumerWidget {
3131
child: SafeArea(
3232
child: Column(
3333
children: [
34-
isGuest? const SignInButton():
35-
ListTile(
36-
title: const Text('Create a Community'),
37-
leading: const Icon(Icons.add),
38-
onTap: () => navigateToCreateCommunity(context),
39-
),
40-
if(!isGuest)
41-
ref.watch(userCommunitiesProvider).when(
42-
data: (communities) => Expanded(
43-
child: ListView.separated(
44-
itemCount: communities.length,
45-
separatorBuilder: (BuildContext context, int index) =>
46-
const SizedBox(),
47-
itemBuilder: (BuildContext context, int index) {
48-
final community = communities[index];
49-
return DelayedDisplay(
50-
delay: Duration(milliseconds: 10 * index),
51-
child: ListTile(
52-
leading: CircleAvatar(
53-
backgroundImage: NetworkImage(community.avatar),
54-
),
55-
title: Text(community.name),
56-
onTap: () {
57-
navigateToCommunity(context, community);
58-
},
59-
),
60-
);
61-
},
34+
isGuest
35+
? const SignInButton()
36+
: ListTile(
37+
title: Text(
38+
'Create a Community',
39+
style: TextStyle(
40+
fontWeight: FontWeight.w600,
41+
fontSize: 18,
42+
),
43+
),
44+
leading: Icon(
45+
Icons.add_box,
46+
color: Colors.white,
47+
size: 30,
6248
),
49+
onTap: () => navigateToCreateCommunity(context),
6350
),
64-
error: (error, stackTrace) =>
65-
ErrorText(error: error.toString()),
66-
loading: () => const Loader(),
67-
)
51+
if (!isGuest)
52+
ref.watch(userCommunitiesProvider).when(
53+
data: (communities) => Expanded(
54+
child: ListView.separated(
55+
itemCount: communities.length,
56+
separatorBuilder: (BuildContext context, int index) =>
57+
const SizedBox(),
58+
itemBuilder: (BuildContext context, int index) {
59+
final community = communities[index];
60+
return DelayedDisplay(
61+
delay: Duration(milliseconds: 10 * index),
62+
child: ListTile(
63+
leading: CircleAvatar(
64+
backgroundImage: NetworkImage(community.avatar),
65+
),
66+
title: Text(community.name),
67+
onTap: () {
68+
navigateToCommunity(context, community);
69+
},
70+
),
71+
);
72+
},
73+
),
74+
),
75+
error: (error, stackTrace) =>
76+
ErrorText(error: error.toString()),
77+
loading: () => const Loader(),
78+
)
6879
],
6980
),
7081
),

lib/features/home/drawer/profile_drawer.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class ProfileDrawer extends ConsumerWidget {
121121
Padding(
122122
padding: const EdgeInsets.all(16),
123123
child: Text(
124-
'Version 0.90.0',
124+
'Version 0.95.0',
125125
style: Theme.of(context).textTheme.caption,
126126
),
127127
),

lib/features/home/home_screen.dart

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,21 @@ class _HomeScreenState extends ConsumerState<HomeScreen> {
8686
),
8787
body: Constants.tabWidgets[_page],
8888
drawer: const CommunityListDrawer(),
89-
endDrawer: isGuest?null:const ProfileDrawer(),
90-
bottomNavigationBar: isGuest?null:CupertinoTabBar(
91-
activeColor: currentTheme.iconTheme.color,
92-
backgroundColor: Theme.of(context).brightness == Brightness.dark
93-
? Colors.grey[900] // set color for dark mode
94-
: Color(0xFFffe9ec),
95-
items: const [
96-
BottomNavigationBarItem(icon: Icon(Icons.home), label: ''),
97-
BottomNavigationBarItem(icon: Icon(Icons.add), label: ''),
98-
],
99-
onTap: onPageChanged,
100-
currentIndex: _page,
101-
),
89+
endDrawer: isGuest ? null : const ProfileDrawer(),
90+
bottomNavigationBar: isGuest
91+
? null
92+
: CupertinoTabBar(
93+
activeColor: currentTheme.iconTheme.color,
94+
backgroundColor: Theme.of(context).brightness == Brightness.dark
95+
? Colors.grey[900] // set color for dark mode
96+
: Color(0xFFffe9ec),
97+
items: const [
98+
BottomNavigationBarItem(icon: Icon(Icons.home), label: ''),
99+
BottomNavigationBarItem(icon: Icon(Icons.add), label: ''),
100+
],
101+
onTap: onPageChanged,
102+
currentIndex: _page,
103+
),
102104
);
103105
}
104106
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
1616
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
1717
# In Windows, build-name is used as the major, minor, and patch parts
1818
# of the product and file versions while build-number is used as the build suffix.
19-
version: 0.90.0
19+
version: 0.95.0
2020

2121
environment:
2222
sdk: ">=2.19.2 <3.0.0"

0 commit comments

Comments
 (0)