Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev continue #16

Merged
merged 10 commits into from
Dec 27, 2023
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ app.*.map.json
/coverage/

# Pubspec.lock
pubspec.lock
pubspec.lock
doc/Functional Documentation.rar
Binary file removed doc/api.zip
Binary file not shown.
19 changes: 12 additions & 7 deletions lib/components/AppBar/appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:tweaxy/components/AppBar/tabbar.dart';
import 'package:tweaxy/constants.dart';
import 'package:tweaxy/services/temp_user.dart';
import 'package:tweaxy/shared/keys/profile_keys.dart';
import 'package:tweaxy/cubits/Tweets/tweet_cubit.dart';
import 'package:tweaxy/shared/keys/home_page_keys.dart';

class ApplicationBar extends StatelessWidget {
class ApplicationBar extends StatefulWidget {
const ApplicationBar(
{super.key, required this.isVisible, required this.tabController});
final bool isVisible;

final TabController tabController;

@override
State<ApplicationBar> createState() => _ApplicationBarState();
}

class _ApplicationBarState extends State<ApplicationBar> {
@override
Widget build(BuildContext context) {
return SliverAppBar(
Expand All @@ -26,7 +29,7 @@ class ApplicationBar extends StatelessWidget {
backgroundColor: Colors.transparent,
centerTitle: true,
title: IconButton(
key: new ValueKey(HomePageKeys.iconRefreshAppBar),
key: const ValueKey(HomePageKeys.iconRefreshAppBar),
onPressed: () {
//refresh
BlocProvider.of<TweetsUpdateCubit>(context).refresh();
Expand All @@ -46,7 +49,9 @@ class ApplicationBar extends StatelessWidget {
leading: Padding(
padding: const EdgeInsets.all(10.0),
child: GestureDetector(
onTap: () {
onTap: () async {
await TempUser.userSetData(context, refresh: false);
setState(() {});
Scaffold.of(context).openDrawer();
},
child: CircleAvatar(
Expand All @@ -57,8 +62,8 @@ class ApplicationBar extends StatelessWidget {
),
),
bottom: CustomTabBar(
isVisible: isVisible,
tabController: tabController,
isVisible: widget.isVisible,
tabController: widget.tabController,
),
);
}
Expand Down
5 changes: 0 additions & 5 deletions lib/components/BottomNavBar/icons/notification_icon.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import 'dart:async';
import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:tweaxy/constants.dart';
import 'package:tweaxy/helpers/api.dart';
import 'package:tweaxy/services/get_unseen_notification_count.dart';
import 'package:tweaxy/services/temp_user.dart';

class NotificationIcon extends StatefulWidget {
const NotificationIcon({super.key, required this.selectedIndex});
Expand Down
10 changes: 5 additions & 5 deletions lib/components/HomePage/MobileComponents/drawer_home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CustomDrawer extends StatelessWidget {
padding: EdgeInsets.only(
left: screenWidth * 0.05, bottom: screenHeight * 0.07),
child: GestureDetector(
key: new ValueKey(HomePageKeys.userInfoInDrawerClick),
key: const ValueKey(HomePageKeys.userInfoInDrawerClick),
onTap: () {
Navigator.push(
context,
Expand All @@ -55,15 +55,15 @@ class CustomDrawer extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(bottom: 10.0),
padding: const EdgeInsets.only(bottom: 10.0),
child: UserImageForTweet(
image: TempUser.image,
userid: TempUser.id,
text: '',
),
),
Padding(
padding: EdgeInsets.only(bottom: 4.5),
padding: const EdgeInsets.only(bottom: 4.5),
child: Text(
TempUser.name,
style: const TextStyle(
Expand Down Expand Up @@ -91,7 +91,7 @@ class CustomDrawer extends StatelessWidget {
),
const Divider(height: 7),
CustomDrawerListTile(
key: new ValueKey(HomePageKeys.profileNavigatorInDrawer),
key: const ValueKey(HomePageKeys.profileNavigatorInDrawer),
icon: AppIcon.profile,
title: 'Profile',
onTap: () {
Expand All @@ -111,7 +111,7 @@ class CustomDrawer extends StatelessWidget {
context,
CustomPageRoute(
direction: AxisDirection.left,
child: SettingsAndPrivacyView()));
child: const SettingsAndPrivacyView()));
},
),
],
Expand Down
20 changes: 8 additions & 12 deletions lib/components/HomePage/MobileComponents/homepage_mobile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:tweaxy/components/AppBar/appbar.dart';
import 'package:tweaxy/components/BottomNavBar/bottom_navigation_bar.dart';
import 'package:tweaxy/components/BottomNavBar/icons/home_icon.dart';
import 'package:tweaxy/components/BottomNavBar/icons/message_icon.dart';
import 'package:tweaxy/components/BottomNavBar/icons/notification_icon.dart';
import 'package:tweaxy/components/BottomNavBar/icons/search_icon.dart';
import 'package:tweaxy/components/HomePage/MobileComponents/drawer_home_screen.dart';
import 'package:tweaxy/components/HomePage/floating_action_button.dart';
import 'package:tweaxy/components/HomePage/homepage_body.dart';
import 'package:tweaxy/constants.dart';
import 'package:tweaxy/components/chat/chat_floating_button.dart';
import 'package:tweaxy/services/temp_user.dart';
import 'package:tweaxy/views/chat/get_conversations_view.dart';
import 'package:tweaxy/views/notifications/notification_screen.dart';
import 'package:tweaxy/views/trends/trending_screen.dart';
Expand Down Expand Up @@ -67,9 +64,9 @@ class _HomePage2State extends State<HomePageMobile>
controller: controller,
isVisible: _isVisible,
),
TrendingScreen(),
NotificationScreen(),
GetConversationsView(),
const TrendingScreen(),
const NotificationScreen(),
const GetConversationsView(),
];
return BlocProvider(
create: (context) => SidebarCubit(),
Expand All @@ -82,7 +79,7 @@ class _HomePage2State extends State<HomePageMobile>
if (state is SidebarInitialState || state is SidebarHomeState) {
return widgets[_selectedIndex];
} else if (state is SidebarProfileState)
return ProfileScreen(
return const ProfileScreen(
id: '',
text: '',
);
Expand All @@ -92,7 +89,7 @@ class _HomePage2State extends State<HomePageMobile>
},
),
floatingActionButton: _selectedIndex == 3
? ChatFloatingButton()
? const ChatFloatingButton()
: Offstage(offstage: !_isVisible, child: const FloatingButton()),
bottomNavigationBar: Offstage(
offstage: !_isVisible,
Expand Down Expand Up @@ -121,7 +118,7 @@ class _HomePage2State extends State<HomePageMobile>
//search icon
BottomNavigationBarItem(
icon: SearchIcon(
key: new ValueKey(HomePageKeys.navSearchIcon),
key: const ValueKey(HomePageKeys.navSearchIcon),
selectedIndex: _selectedIndex,
),
label: ''),
Expand Down Expand Up @@ -163,8 +160,7 @@ class HomeTweetsMobile extends StatelessWidget {
final bool isVisible;
@override
Widget build(BuildContext context) {
TempUser.userSetData(context);


return NestedScrollView(
physics: const BouncingScrollPhysics(),
controller: controller,
Expand All @@ -180,7 +176,7 @@ class HomeTweetsMobile extends StatelessWidget {
)
];
},
body: CustomScrollView(slivers: [
body: const CustomScrollView(slivers: [
HomePageBody(),
]));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_linkify/flutter_linkify.dart';
import 'package:intl/intl.dart';
import 'package:tweaxy/constants.dart';
import 'package:tweaxy/cubits/sidebar_cubit/sidebar_cubit.dart';
import 'package:tweaxy/cubits/sidebar_cubit/sidebar_states.dart';
import 'package:tweaxy/views/followersAndFollowing/followers.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,21 @@ class UserImageForTweet extends StatelessWidget {
//
@override
Widget build(BuildContext context) {

return GestureDetector(
onTap: () {
if (!kIsWeb) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ProfileScreen(
id: userid == TempUser.id ? '' : userid ,
id: userid == TempUser.id ? '' : userid,
text: userid == TempUser.id ? '' : 'no',
),
),
);
} else {
BlocProvider.of<SidebarCubit>(context)
.openProfile(userid == TempUser.id ? '' : 'Following', userid == TempUser.id ? '' : 'Following');
.openProfile(userid, userid == TempUser.id ? '' : 'Following');
}
},
child: ClipRRect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DeleteAlertDialog extends StatelessWidget {
'This can\'t be undone and it will be removed from your profile, the timeline of any accounts that follow you, and from search results'), // Message which will be pop up on the screen
actions: [
TextButton(
key: new ValueKey(DeleteTweetKeys.tweetCancelDeleteMobile),
key: const ValueKey(DeleteTweetKeys.tweetCancelDeleteMobile),
style: ButtonStyle(
overlayColor: MaterialStateProperty.all(Colors.transparent),
),
Expand All @@ -41,7 +41,7 @@ class DeleteAlertDialog extends StatelessWidget {
style: TextStyle(color: Colors.black, fontSize: 19)),
),
TextButton(
key: new ValueKey(DeleteTweetKeys.tweetDeleteConfirmMobile),
key: const ValueKey(DeleteTweetKeys.tweetDeleteConfirmMobile),
style: ButtonStyle(
overlayColor: MaterialStateProperty.all(Colors.transparent),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:oktoast/oktoast.dart';
import 'package:tweaxy/components/HomePage/MobileComponents/homepage_mobile.dart';
import 'package:tweaxy/components/toasts/custom_web_toast.dart';
import 'package:tweaxy/cubits/Tweets/tweet_cubit.dart';
import 'package:tweaxy/cubits/sidebar_cubit/sidebar_cubit.dart';
import 'package:tweaxy/services/tweets_services.dart';
import 'package:tweaxy/shared/keys/delete_tweet_keys.dart';
import 'package:tweaxy/views/homepage.dart';

class DeleteAlertDialogWeb extends StatefulWidget {
const DeleteAlertDialogWeb({super.key, required this.tweetId, required this.parentid});
Expand Down Expand Up @@ -47,7 +44,7 @@ class _DeleteAlertDialogWebState extends State<DeleteAlertDialogWeb> {
child: SizedBox(
width: double.infinity,
child: ElevatedButton(
key: new ValueKey(DeleteTweetKeys.tweetDeleteConfirmMobile),
key: const ValueKey(DeleteTweetKeys.tweetDeleteConfirmMobile),
style: ElevatedButton.styleFrom(
elevation: 0,

Expand All @@ -69,10 +66,11 @@ class _DeleteAlertDialogWebState extends State<DeleteAlertDialogWeb> {
),
position: ToastPosition.bottom,
duration: const Duration(seconds: 2));
print("t state" + t.toString());
if (t == "success")
print("t state$t");
if (t == "success") {
BlocProvider.of<TweetsUpdateCubit>(context)
.deleteTweet(tweetid: widget.tweetId, parentid: widget.parentid);
}

},
child: const Text('Delete',
Expand All @@ -85,7 +83,7 @@ class _DeleteAlertDialogWebState extends State<DeleteAlertDialogWeb> {
child: SizedBox(
width: double.infinity,
child: ElevatedButton(
key: new ValueKey(DeleteTweetKeys.tweetCancelDeleteMobile),
key: const ValueKey(DeleteTweetKeys.tweetCancelDeleteMobile),
style: ElevatedButton.styleFrom(
elevation: 0,
side: const BorderSide(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ class TweetSettingsProfileWeb extends StatelessWidget {
},
itemBuilder: (BuildContext bc) {
return [
PopupMenuItem(
const PopupMenuItem(
value: 'delete',
child: Wrap(
children: [
Icon(
key: new ValueKey(
key: ValueKey(
DeleteTweetKeys.tweetSettingsMenuDeleteWeb),
FontAwesomeIcons.trashCan,
size: 20,
Expand All @@ -59,8 +59,8 @@ class TweetSettingsProfileWeb extends StatelessWidget {
),
];
},
icon: Icon(
key: new ValueKey(DeleteTweetKeys.tweetSettingsClickWeb),
icon: const Icon(
key: ValueKey(DeleteTweetKeys.tweetSettingsClickWeb),
FontAwesomeIcons.ellipsis,
size: 16,
));
Expand Down
10 changes: 6 additions & 4 deletions lib/components/HomePage/Tweet/Replies/interactions.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
Expand Down Expand Up @@ -40,7 +42,7 @@ class InteractionReplyScreen extends StatelessWidget {
key: const ValueKey(TweetKeys.repostInteractionRepliesScreen),
isLiked: tweet.isUserRetweeted,
bubblesSize: 0,
bubblesColor: BubblesColor(
bubblesColor: const BubblesColor(
dotPrimaryColor: Colors.transparent,
dotSecondaryColor: Colors.transparent,
),
Expand All @@ -55,9 +57,9 @@ class InteractionReplyScreen extends StatelessWidget {
await Future(() async {
final SharedPreferences prefs =
await SharedPreferences.getInstance();
token = await prefs.getString('token')!;
token = prefs.getString('token')!;
});
print(" the like value $isLiked");
log(" the like value $isLiked");
if (isLiked) {
var res = await TweetsServices.deleteRetweet(tweetid: tweet.id);
BlocProvider.of<TweetsUpdateCubit>(context).deleteretweet(
Expand All @@ -84,7 +86,7 @@ class InteractionReplyScreen extends StatelessWidget {
await Future(() async {
final SharedPreferences prefs =
await SharedPreferences.getInstance();
token = await prefs.getString('token')!;
token = prefs.getString('token')!;
});
print(" the like value $isLiked");
if (isLiked) {
Expand Down
Loading