Skip to content

Commit

Permalink
ui fixs more
Browse files Browse the repository at this point in the history
  • Loading branch information
Chandrakant0110 committed Feb 17, 2024
1 parent d6d64bd commit 3b1c9b2
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 24 deletions.
5 changes: 4 additions & 1 deletion lib/common/loadin_page.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import 'package:flutter/material.dart';
import 'package:twitter_clone/theme/pallete.dart';

class Loader extends StatelessWidget {
const Loader({super.key});

@override
Widget build(BuildContext context) {
return const Center(
child: CircularProgressIndicator(),
child: CircularProgressIndicator(
color: Pallete.whiteColor,
),
);
}
}
Expand Down
1 change: 1 addition & 0 deletions lib/features/auth/view/landing_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class _LandingViewState extends ConsumerState<LandingView> {
'See what\'s happening in the world right now.',
style: TextStyle(
fontSize: 28,
color: Pallete.whiteColor,
fontWeight: FontWeight.bold,
),
),
Expand Down
3 changes: 2 additions & 1 deletion lib/features/auth/view/login_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class _LoginViewState extends ConsumerState<LoginView> {
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 28,
color: Pallete.whiteColor,
),
),
const SizedBox(
Expand All @@ -101,7 +102,7 @@ class _LoginViewState extends ConsumerState<LoginView> {
),
),
bottomNavigationBar: Padding(
padding: const EdgeInsets.only(left: 5.0, right: 5),
padding: const EdgeInsets.only(left: 12.0, right: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expand Down
17 changes: 12 additions & 5 deletions lib/features/auth/view/signup_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class _SignUpViewState extends ConsumerState<SignUpView> {
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 28,
color: Pallete.whiteColor,
),
),
const SizedBox(
Expand Down Expand Up @@ -123,11 +124,17 @@ class _SignUpViewState extends ConsumerState<SignUpView> {
bottomNavigationBar: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
RoundedButton(
onTap: onSignUp,
label: 'Done',
backgroundColor: Pallete.whiteColor,
textColor: Pallete.backgroundColor,
Padding(
padding: const EdgeInsets.only(
right: 16.0,
bottom: 4.0,
),
child: RoundedButton(
onTap: onSignUp,
label: 'Done',
backgroundColor: Pallete.whiteColor,
textColor: Pallete.backgroundColor,
),
),
],
),
Expand Down
2 changes: 2 additions & 0 deletions lib/features/auth/widgets/auth_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class AuthField extends StatelessWidget {
height: 60,
child: TextFormField(
controller: controller,

cursorColor: Pallete.whiteColor,
obscureText: obSecureText,
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
Expand Down
2 changes: 2 additions & 0 deletions lib/features/home/view/home_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class _HomeViewState extends State<HomeView> {
icon: Icon(
Icons.terminal_outlined,
color: Pallete.whiteColor,
size: 26,
),
),
BottomNavigationBarItem(
Expand All @@ -86,6 +87,7 @@ class _HomeViewState extends State<HomeView> {
icon: Icon(
_page == 4 ? Icons.email : Icons.email_outlined,
color: Pallete.whiteColor,
size: 26,
),
),
],
Expand Down
35 changes: 18 additions & 17 deletions lib/features/user_profile/widget/user_profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ class UserProfile extends ConsumerWidget {
context,
EditProfileView.route(),
);

print('edit profile button clicked');
} else {
print('edit follow button clicked');
ref
.read(userProfileControllerProvider
.notifier)
.read(
userProfileControllerProvider.notifier)
.followUser(
user: user,
context: context,
Expand All @@ -86,6 +86,7 @@ class UserProfile extends ConsumerWidget {
borderRadius: BorderRadius.circular(20),
side: const BorderSide(
color: Pallete.whiteColor,
width: 4,
),
),
padding: const EdgeInsets.symmetric(
Expand All @@ -98,6 +99,7 @@ class UserProfile extends ConsumerWidget {
: currUser.uid.contains(user.uid)
? 'unfollow'
: 'follow',
style: const TextStyle(color: Pallete.whiteColor),
),
),
),
Expand Down Expand Up @@ -176,34 +178,33 @@ class UserProfile extends ConsumerWidget {
return ref.watch(getLatestTweetProvider).when(
data: (data) {
final latestTweet = Tweet.fromMap(data.payload);

bool isTweetAlreadyPresent = false;

for (final tweetModel in tweets) {
if (tweetModel.id == latestTweet.id) {
isTweetAlreadyPresent = true;
break;
}
}

if (!isTweetAlreadyPresent) {
if (data.events.contains(
'databases.*.collections.${AppWriteConstants.tweetCollections}.documents.*.create')) {
// condition is above
tweets.insert(
0, Tweet.fromMap(data.payload));
tweets.insert(0, Tweet.fromMap(data.payload));
} else if (data.events.contains(
'databases.*.collections.${AppWriteConstants.tweetCollections}.documents.*.update')) {
// Steps for fetching the updates of retweeted in a App.
// 1. get id of original tweet
// 2. remove that tweet
// 3. replace with the updated tweet

// Step 1
// find index of tweet from index array
final startingPoint = data.events[0]
.lastIndexOf('documents.');
final startingPoint =
data.events[0].lastIndexOf('documents.');

final endPoint =
data.events[0].lastIndexOf('.update');
// Finding the tweetID form the data.events
Expand All @@ -214,13 +215,13 @@ class UserProfile extends ConsumerWidget {
var tweet;
try {
tweet = tweets
.where((element) =>
element.id == tweetID)
.where(
(element) => element.id == tweetID)
.first;
} catch (e) {
print(e.toString());
}

// fetching the tweetIndex before removing the tweet
final tweetIndex = tweets.indexOf(tweet);
// Step 2
Expand All @@ -229,13 +230,13 @@ class UserProfile extends ConsumerWidget {
(element) => element.id == tweetID);
// get new latest data
tweet = Tweet.fromMap(data.payload);

// Step 3
// add the latest data
tweets.insert(tweetIndex, tweet);
}
}

return ListView.builder(
itemCount: tweets.length,
itemBuilder: (context, index) {
Expand Down

0 comments on commit 3b1c9b2

Please sign in to comment.