From fad28fe92f8a739df6a282a2de184eadbd8154fd Mon Sep 17 00:00:00 2001 From: asermohamed1 <153523890+asermohamed1@users.noreply.github.com> Date: Sat, 13 Dec 2025 00:28:31 +0200 Subject: [PATCH 1/2] Revert "Merge branch 'dev' into auth-chat" This reverts commit ae78cf02d3fa2b9f43906625f5be3a57fd86f8ad, reversing changes made to 292811dc08d4ec61915ff8667d87729b68fd5824. --- .vscode/settings.json | 2 +- .../home/view/widgets/home_app_bar.dart | 1 + .../profile/models/profile_tweet_model.dart | 6 - lib/features/profile/models/shared.dart | 8 +- .../repositories/profile_repo_impl.dart | 17 +- .../edit_profile/edit_profile_header.dart | 1 + .../view/widgets/profile/profile_header.dart | 2 + .../explore_profile_screen_body.dart | 838 +++++++++++++++++- .../profile_normal_tweet_widget.dart | 10 + .../profile_normar_tweet_quot.dart | 6 + .../profile_retweet_widget.dart | 4 +- .../shared_tweet_components.dart | 8 +- .../profile/view_model/providers.dart | 1 + .../trends/models/for_you_response_model.dart | 1 + .../trends/models/trend_category.dart | 4 +- .../widgets/category_profile_trend_tab.dart | 181 ---- .../view/widgets/for_you_profile_tab.dart | 41 +- .../trends/view/widgets/trend_tile.dart | 90 +- .../view/widgets/trending_profile_tab.dart | 82 -- 19 files changed, 907 insertions(+), 396 deletions(-) delete mode 100644 lib/features/trends/view/widgets/category_profile_trend_tab.dart delete mode 100644 lib/features/trends/view/widgets/trending_profile_tab.dart diff --git a/.vscode/settings.json b/.vscode/settings.json index 1f09463..ffafe51 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { - "cmake.sourceDirectory": "D:/ThirdYear/SWE/project/Cross_Platform/linux" + "cmake.sourceDirectory": "C:/Users/kerol/Cross_Platform/linux" } \ No newline at end of file diff --git a/lib/features/home/view/widgets/home_app_bar.dart b/lib/features/home/view/widgets/home_app_bar.dart index edc264e..d33d8e3 100644 --- a/lib/features/home/view/widgets/home_app_bar.dart +++ b/lib/features/home/view/widgets/home_app_bar.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/legacy.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:lite_x/core/providers/current_user_provider.dart'; import 'package:lite_x/features/home/view/widgets/home_tab_bar.dart'; import 'package:lite_x/features/home/view/widgets/profile_avatar.dart'; diff --git a/lib/features/profile/models/profile_tweet_model.dart b/lib/features/profile/models/profile_tweet_model.dart index 59c7bb5..582a4ba 100644 --- a/lib/features/profile/models/profile_tweet_model.dart +++ b/lib/features/profile/models/profile_tweet_model.dart @@ -22,8 +22,6 @@ class ProfileTweetModel { final TweetType type; final List mediaIds; final String parentId; - final String retweeterName; - final String retweeterUserName; ProfileTweetModel({ required this.id, @@ -47,8 +45,6 @@ class ProfileTweetModel { required this.type, required this.mediaIds, required this.parentId, - required this.retweeterName, - required this.retweeterUserName, }); factory ProfileTweetModel.fromJson(Map json) { @@ -87,8 +83,6 @@ class ProfileTweetModel { protectedAccount: json["user"]?["protectedAccount"] ?? false, verified: json["user"]?["verified"] ?? false, parentId: json["parentId"] ?? "", - retweeterName: json["retweeterName"] ?? "", - retweeterUserName: json["retweeterUserName"] ?? "", // mediaIds: meidaIds, ); } diff --git a/lib/features/profile/models/shared.dart b/lib/features/profile/models/shared.dart index 0f5d8d1..bf3d42e 100644 --- a/lib/features/profile/models/shared.dart +++ b/lib/features/profile/models/shared.dart @@ -4,6 +4,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:go_router/go_router.dart'; import 'package:lite_x/core/providers/current_user_provider.dart'; +import 'package:lite_x/features/media/download_media.dart'; import 'package:lite_x/features/media/view_model/providers.dart'; import 'package:lite_x/features/profile/models/profile_model.dart'; import 'package:lite_x/features/profile/models/profile_tweet_model.dart'; @@ -948,10 +949,3 @@ List convertJsonListToTweetList(List jsonList) { } return tweets; } - -abstract class TrendsCategoriesTabs { - static String Global = "global"; - static String News = "news"; - static String Sports = "Sports"; - static String Entertainment = "entertainment"; -} diff --git a/lib/features/profile/repositories/profile_repo_impl.dart b/lib/features/profile/repositories/profile_repo_impl.dart index 2485426..18ab308 100644 --- a/lib/features/profile/repositories/profile_repo_impl.dart +++ b/lib/features/profile/repositories/profile_repo_impl.dart @@ -1,6 +1,10 @@ import 'package:dio/dio.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:lite_x/core/providers/current_user_provider.dart'; +import 'package:lite_x/features/media/download_media.dart'; import 'package:lite_x/features/profile/models/create_reply_model.dart'; import 'package:lite_x/features/profile/models/create_tweet_model.dart'; +import 'package:lite_x/features/profile/models/follower_model.dart'; import 'package:lite_x/features/profile/models/profile_model.dart'; import 'package:lite_x/features/profile/models/profile_tweet_model.dart'; import 'package:lite_x/features/profile/models/search_user_model.dart'; @@ -10,6 +14,7 @@ import 'package:lite_x/features/profile/models/tweet_reply_model.dart'; import 'package:lite_x/features/profile/models/user_model.dart'; import 'package:lite_x/features/profile/repositories/profile_repo.dart'; import 'package:lite_x/features/profile/repositories/profile_storage_service.dart'; +import 'package:lite_x/features/profile/view_model/providers.dart'; import 'package:lite_x/features/trends/models/for_you_response_model.dart'; import 'package:lite_x/features/trends/models/trend_category.dart'; import 'package:lite_x/features/trends/models/trend_model.dart'; @@ -186,6 +191,10 @@ class ProfileRepoImpl implements ProfileRepo { } } + + + + @override Future>> getProfileLikes( String username, @@ -697,13 +706,9 @@ class ProfileRepoImpl implements ProfileRepo { } return Right([]); } on DioException catch (e) { - return (Left( - Failure("cannot get trends at this time, try again later..."), - )); + return (Left(Failure(e.toString()))); } catch (e) { - return (Left( - Failure("cannot get trends at this time, try again later..."), - )); + return (Left(Failure(e.toString()))); } } } diff --git a/lib/features/profile/view/widgets/edit_profile/edit_profile_header.dart b/lib/features/profile/view/widgets/edit_profile/edit_profile_header.dart index bead338..5f27062 100644 --- a/lib/features/profile/view/widgets/edit_profile/edit_profile_header.dart +++ b/lib/features/profile/view/widgets/edit_profile/edit_profile_header.dart @@ -9,6 +9,7 @@ import 'package:lite_x/features/media/view_model/providers.dart'; import 'package:lite_x/features/profile/models/profile_model.dart'; import 'package:lite_x/features/profile/models/shared.dart'; import 'package:lite_x/features/profile/view/widgets/edit_profile/controller/edit_profile_controller.dart'; +import 'package:provider/provider.dart'; class EditProfileHeader extends ConsumerWidget { final EditProfileController controller; diff --git a/lib/features/profile/view/widgets/profile/profile_header.dart b/lib/features/profile/view/widgets/profile/profile_header.dart index ab0facd..8b40bda 100644 --- a/lib/features/profile/view/widgets/profile/profile_header.dart +++ b/lib/features/profile/view/widgets/profile/profile_header.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:go_router/go_router.dart'; +import 'package:lite_x/features/media/view_model/providers.dart'; import 'package:lite_x/features/profile/models/profile_model.dart'; import 'package:lite_x/features/profile/models/shared.dart'; import 'package:lite_x/features/profile/view/widgets/profile/block_button.dart'; @@ -11,6 +12,7 @@ import 'package:lite_x/features/profile/view_model/providers.dart'; import 'package:top_snackbar_flutter/custom_snack_bar.dart'; import 'package:top_snackbar_flutter/top_snack_bar.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'package:cached_network_image/cached_network_image.dart'; class ProfileHeader extends ConsumerStatefulWidget { const ProfileHeader({ diff --git a/lib/features/profile/view/widgets/profile_search/explore_profile_screen_body.dart b/lib/features/profile/view/widgets/profile_search/explore_profile_screen_body.dart index 4d82bb1..f606a40 100644 --- a/lib/features/profile/view/widgets/profile_search/explore_profile_screen_body.dart +++ b/lib/features/profile/view/widgets/profile_search/explore_profile_screen_body.dart @@ -2,11 +2,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:lite_x/core/providers/current_user_provider.dart'; import 'package:lite_x/features/profile/models/profile_model.dart'; -import 'package:lite_x/features/profile/models/shared.dart'; import 'package:lite_x/features/profile/view_model/providers.dart'; -import 'package:lite_x/features/trends/view/widgets/category_profile_trend_tab.dart'; import 'package:lite_x/features/trends/view/widgets/for_you_profile_tab.dart'; -import 'package:lite_x/features/trends/view/widgets/trending_profile_tab.dart'; class Exploreprofilescreenbody extends ConsumerStatefulWidget { const Exploreprofilescreenbody({super.key}); @@ -48,7 +45,7 @@ class _ExploreprofilescreenbodyState }, (pm) { return DefaultTabController( - length: 6, + length: 5, child: Scaffold( appBar: TabBar( indicatorColor: Color(0xFF1DA1F2), @@ -66,7 +63,6 @@ class _ExploreprofilescreenbodyState tabs: [ Tab(text: 'For You'), Tab(text: 'Trending'), - Tab(text: 'Global'), Tab(text: 'News'), Tab(text: 'Sports'), Tab(text: 'Entertainment'), @@ -76,7 +72,6 @@ class _ExploreprofilescreenbodyState children: [ _BuildForYouTab(pm), _BuildTrendingTab(pm), - _BuildGlobalTab(pm), _BuildNewsTab(pm), _BuildSportsTab(pm), _BuildEntertainmentTab(pm), @@ -107,11 +102,8 @@ class _ExploreprofilescreenbodyState ); }, loading: () { - return Padding( - padding: const EdgeInsets.all(20), - child: SingleChildScrollView( - child: Center(child: CircularProgressIndicator()), - ), + return SingleChildScrollView( + child: Center(child: CircularProgressIndicator()), ); }, ); @@ -126,30 +118,816 @@ Widget _BuildTrendingTab(ProfileModel pm) { return TrendingProfileTab(); } -Widget _BuildGlobalTab(ProfileModel pm) { - return CategoryProfileTrendTab( - pm: pm, - categoryName: TrendsCategoriesTabs.Global, - ); -} - Widget _BuildNewsTab(ProfileModel pm) { - return CategoryProfileTrendTab( - pm: pm, - categoryName: TrendsCategoriesTabs.News, - ); + return NewsProfileTab(); } Widget _BuildSportsTab(ProfileModel pm) { - return CategoryProfileTrendTab( - pm: pm, - categoryName: TrendsCategoriesTabs.Sports, - ); + return SportsProfileTab(); } Widget _BuildEntertainmentTab(ProfileModel pm) { - return CategoryProfileTrendTab( - pm: pm, - categoryName: TrendsCategoriesTabs.Entertainment, - ); + return EntertainmentProfileTab(); +} + +class TrendingProfileTab extends StatelessWidget { + const TrendingProfileTab({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return ListView( + padding: const EdgeInsets.all(0), + children: [ + // Trending Item 1 + _buildTrendingItem( + position: 1, + category: "Trending in Egypt", + topic: "#انزل_شارك_صوتك_امانه", + postsCount: null, + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // Trending Item 2 + _buildTrendingItem( + position: 2, + category: "Trending in Egypt", + topic: "#صوتك_مهم", + postsCount: null, + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // Trending Item 3 + _buildTrendingItem( + position: 3, + category: "Trending in Egypt", + topic: "#صوتك_لحماه_الوطن", + postsCount: null, + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // Trending Item 4 + _buildTrendingItem( + position: 4, + category: "Trending in Egypt", + topic: "#افضح_المرتزقه", + postsCount: "3,587 posts", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // Trending Item 5 + _buildTrendingItem( + position: 5, + category: "Trending in Egypt", + topic: "#في_حضوك_ياريس_انزل_وشارك", + postsCount: null, + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // Trending Item 6 + _buildTrendingItem( + position: 6, + category: "Trending in Egypt", + topic: "اليوم الاتنين", + postsCount: "5,905 posts", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // Trending Item 7 + _buildTrendingItem( + position: 7, + category: "Sports · Trending", + topic: "الونسو", + postsCount: "8,966 posts", + trendingWith: "تشابي", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // Trending Item 8 + _buildTrendingItem( + position: 8, + category: "Trending in Egypt", + topic: "رضا عبد العال", + postsCount: null, + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // Trending Item 9 + _buildTrendingItem( + position: 9, + category: "Trending in Egypt", + topic: "الاهلي والزمالك", + postsCount: "12.3K posts", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // Trending Item 10 + _buildTrendingItem( + position: 10, + category: "Sports · Trending", + topic: "محمد صلاح", + postsCount: "45.2K posts", + trendingWith: "ليفربول", + ), + + const SizedBox(height: 80), + ], + ); + } + + Widget _buildTrendingItem({ + required int position, + required String category, + required String topic, + String? postsCount, + String? trendingWith, + }) { + return Container( + color: Colors.black, + padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Position number + SizedBox( + width: 30, + child: Text( + "$position · ", + style: TextStyle( + fontSize: 14, + color: Colors.grey[600], + fontWeight: FontWeight.w500, + ), + ), + ), + + // Content + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Category + Text( + category, + style: TextStyle(fontSize: 13, color: Colors.grey[600]), + ), + const SizedBox(height: 2), + + // Topic + Text( + topic, + style: const TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + + // Posts count + if (postsCount != null) ...[ + const SizedBox(height: 2), + Text( + postsCount, + style: TextStyle(fontSize: 13, color: Colors.grey[600]), + ), + ], + + // Trending with + if (trendingWith != null) ...[ + const SizedBox(height: 4), + Text( + "Trending with $trendingWith", + style: TextStyle(fontSize: 13, color: Colors.grey[600]), + ), + ], + ], + ), + ), + + // More options icon + Icon(Icons.more_horiz, color: Colors.grey[600], size: 20), + ], + ), + ); + } +} + +class NewsProfileTab extends StatelessWidget { + const NewsProfileTab({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return ListView( + padding: const EdgeInsets.all(0), + children: [ + // News Item 1 + _buildNewsItem( + category: "Trending in Politics", + topic: "Ivanka Trump", + postsCount: "2,421 posts", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // News Item 2 + _buildNewsItem( + category: "Trending in Business & finance", + topic: "Substack", + postsCount: "31.1K posts", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // News Item 3 + _buildNewsItem( + category: "Trending in Politics", + topic: "Taiwan to China", + postsCount: "11.9K posts", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // News Item 4 + _buildNewsItem( + category: "Trending in Technology", + topic: "Grok 4.1 Fast", + postsCount: "2,217 posts", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // News Item 5 + _buildNewsItem( + category: "Trending in Business & finance", + topic: "Grayscale", + postsCount: "15.7K posts", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // News Item 6 + _buildNewsItem( + category: "Trending in Business & finance", + topic: "Dogecoin ETF", + postsCount: "2,773 posts", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // News Item 7 + _buildNewsItem( + category: "Trending in Business & finance", + topic: "DOGE ETF", + postsCount: "2,898 posts", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // News Item 8 + _buildNewsItem( + category: "Trending in Politics", + topic: "Senate Republicans", + postsCount: "8,542 posts", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // News Item 9 + _buildNewsItem( + category: "Trending in Technology", + topic: "ChatGPT Plus", + postsCount: "4,156 posts", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // News Item 10 + _buildNewsItem( + category: "Trending in Business & finance", + topic: "Federal Reserve", + postsCount: "18.3K posts", + ), + + const SizedBox(height: 80), + ], + ); + } + + Widget _buildNewsItem({ + required String category, + required String topic, + required String postsCount, + }) { + return Container( + color: Colors.black, + padding: const EdgeInsets.all(16.0), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Category + Text( + category, + style: TextStyle(fontSize: 13, color: Colors.grey[600]), + ), + const SizedBox(height: 4), + + // Topic + Text( + topic, + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + const SizedBox(height: 4), + + // Posts count + Text( + postsCount, + style: TextStyle(fontSize: 13, color: Colors.grey[600]), + ), + ], + ), + ), + + // More options icon + Icon(Icons.more_horiz, color: Colors.grey[600], size: 20), + ], + ), + ); + } +} + +class SportsProfileTab extends StatelessWidget { + const SportsProfileTab({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return ListView( + padding: const EdgeInsets.all(0), + children: [ + // News Card 1 + _buildNewsCard( + title: "Ronaldo's Stunning Bicycle Kick Seals Al Nassr Win at 40", + timeAgo: "21 hours ago", + category: "Sports", + postsCount: "303K posts", + avatars: 3, + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // News Card 2 + _buildNewsCard( + title: "Ronaldo's Stunning Bicycle Kick Powers Al Nassr to 4-1 Win", + timeAgo: "13 hours ago", + category: "Sports", + postsCount: "66K posts", + avatars: 3, + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // News Card 3 + _buildNewsCard( + title: + "Messi's Masterclass Sends Inter Miami to Eastern Conference Final", + timeAgo: "17 hours ago", + category: "Sports", + postsCount: "97K posts", + avatars: 3, + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // News Card 4 + _buildNewsCard( + title: "Eze's Historic Hat-Trick Powers Arsenal to 4-1 Derby Rout", + timeAgo: "Trending now", + category: "Sports", + postsCount: "4.7K posts", + avatars: 3, + isTrending: true, + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // News Card 5 + _buildNewsCard( + title: "Real Madrid Draw at Elche Fuels Dressing Room Tension Rumors", + timeAgo: "4 hours ago", + category: "Other", + postsCount: "5.5K posts", + avatars: 3, + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // Trending Section 1 + _buildTrendingSection( + title: "Trending in Sports", + topic: "#IndianCricket", + postsCount: "5,789 posts", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // Trending Section 2 + _buildTrendingSection( + title: "Trending in Sports", + topic: "#Champions League", + postsCount: "12.4K posts", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // Trending Section 3 + _buildTrendingSection( + title: "Trending in Sports", + topic: "Lakers", + postsCount: "8.2K posts", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // Trending Section 4 + _buildTrendingSection( + title: "Trending in Sports", + topic: "NBA Playoffs", + postsCount: "15.6K posts", + ), + + const SizedBox(height: 80), + ], + ); + } + + Widget _buildNewsCard({ + required String title, + required String timeAgo, + required String category, + required String postsCount, + required int avatars, + bool isTrending = false, + }) { + return Container( + color: Colors.black, + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Title + Text( + title, + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + color: Colors.white, + height: 1.3, + ), + ), + const SizedBox(height: 12), + + // Bottom row with avatars and info + Row( + children: [ + // Avatar Stack + SizedBox( + width: avatars * 20.0 + 10, + height: 24, + child: Stack( + children: List.generate( + avatars, + (index) => Positioned( + left: index * 20.0, + child: Container( + width: 24, + height: 24, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: _getAvatarColor(index), + border: Border.all(color: Colors.black, width: 1.5), + ), + child: Center( + child: Icon( + Icons.person, + size: 14, + color: Colors.grey[300], + ), + ), + ), + ), + ), + ), + ), + const SizedBox(width: 12), + + // Time and category info + Expanded( + child: Text( + "$timeAgo · $category · $postsCount", + style: TextStyle(fontSize: 13, color: Colors.grey[600]), + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + ], + ), + ); + } + + Widget _buildTrendingSection({ + required String title, + required String topic, + required String postsCount, + }) { + return Container( + color: Colors.black, + padding: const EdgeInsets.all(16.0), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle(fontSize: 13, color: Colors.grey[600]), + ), + const SizedBox(height: 4), + Text( + topic, + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + const SizedBox(height: 4), + Text( + postsCount, + style: TextStyle(fontSize: 13, color: Colors.grey[600]), + ), + ], + ), + ), + Icon(Icons.more_horiz, color: Colors.grey[600], size: 20), + ], + ), + ); + } + + Color _getAvatarColor(int index) { + final colors = [ + Colors.blue[800]!, + Colors.red[800]!, + Colors.yellow[700]!, + Colors.green[800]!, + ]; + return colors[index % colors.length]; + } +} + +class EntertainmentProfileTab extends StatelessWidget { + const EntertainmentProfileTab({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return ListView( + padding: const EdgeInsets.all(0), + children: [ + // News Card 1 + _buildNewsCard( + title: "New Season of Stranger Things Breaks Netflix Records", + timeAgo: "5 hours ago", + category: "Entertainment", + postsCount: "156K posts", + avatars: 3, + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // News Card 2 + _buildNewsCard( + title: "Taylor Swift Announces Surprise Album Drop at Midnight", + timeAgo: "2 hours ago", + category: "Music", + postsCount: "412K posts", + avatars: 3, + isTrending: true, + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // News Card 3 + _buildNewsCard( + title: "Marvel Studios Reveals Phase 6 Movie Lineup", + timeAgo: "8 hours ago", + category: "Movies", + postsCount: "89K posts", + avatars: 3, + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // News Card 4 + _buildNewsCard( + title: "Grammy Awards 2025: Complete Winners List", + timeAgo: "Trending now", + category: "Music", + postsCount: "287K posts", + avatars: 3, + isTrending: true, + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // News Card 5 + _buildNewsCard( + title: "HBO's New Drama Series Gets Renewed for Season 2", + timeAgo: "12 hours ago", + category: "TV Shows", + postsCount: "34K posts", + avatars: 3, + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // Trending Section 1 + _buildTrendingSection( + title: "Trending in Entertainment", + topic: "#Oscars2025", + postsCount: "178K posts", + ), + + const Divider(height: 1, color: Color(0xFF2F336)), + + // Trending Section 2 + _buildTrendingSection( + title: "Trending in Music", + topic: "Beyoncé", + postsCount: "94.3K posts", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // Trending Section 3 + _buildTrendingSection( + title: "Trending in Entertainment", + topic: "#TheLastOfUs", + postsCount: "67.8K posts", + ), + + const Divider(height: 1, color: Color(0xFF2F3336)), + + // Trending Section 4 + _buildTrendingSection( + title: "Trending in Movies", + topic: "Dune Part 3", + postsCount: "45.2K posts", + ), + + const SizedBox(height: 80), + ], + ); + } + + Widget _buildNewsCard({ + required String title, + required String timeAgo, + required String category, + required String postsCount, + required int avatars, + bool isTrending = false, + }) { + return Container( + color: Colors.black, + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Title + Text( + title, + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + color: Colors.white, + height: 1.3, + ), + ), + const SizedBox(height: 12), + + // Bottom row with avatars and info + Row( + children: [ + // Avatar Stack + SizedBox( + width: avatars * 20.0 + 10, + height: 24, + child: Stack( + children: List.generate( + avatars, + (index) => Positioned( + left: index * 20.0, + child: Container( + width: 24, + height: 24, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: _getAvatarColor(index), + border: Border.all(color: Colors.black, width: 1.5), + ), + child: Center( + child: Icon( + Icons.person, + size: 14, + color: Colors.grey[300], + ), + ), + ), + ), + ), + ), + ), + const SizedBox(width: 12), + + // Time and category info + Expanded( + child: Text( + "$timeAgo · $category · $postsCount", + style: TextStyle(fontSize: 13, color: Colors.grey[600]), + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + ], + ), + ); + } + + Widget _buildTrendingSection({ + required String title, + required String topic, + required String postsCount, + }) { + return Container( + color: Colors.black, + padding: const EdgeInsets.all(16.0), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle(fontSize: 13, color: Colors.grey[600]), + ), + const SizedBox(height: 4), + Text( + topic, + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + const SizedBox(height: 4), + Text( + postsCount, + style: TextStyle(fontSize: 13, color: Colors.grey[600]), + ), + ], + ), + ), + Icon(Icons.more_horiz, color: Colors.grey[600], size: 20), + ], + ), + ); + } + + Color _getAvatarColor(int index) { + final colors = [ + Colors.purple[800]!, + Colors.pink[800]!, + Colors.orange[700]!, + Colors.teal[800]!, + ]; + return colors[index % colors.length]; + } } diff --git a/lib/features/profile/view/widgets/profile_tweets/profile_normal_tweet_widget.dart b/lib/features/profile/view/widgets/profile_tweets/profile_normal_tweet_widget.dart index 075af71..ef1b1b7 100644 --- a/lib/features/profile/view/widgets/profile_tweets/profile_normal_tweet_widget.dart +++ b/lib/features/profile/view/widgets/profile_tweets/profile_normal_tweet_widget.dart @@ -1,9 +1,19 @@ +import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:go_router/go_router.dart'; +import 'package:lite_x/core/providers/current_user_provider.dart'; +import 'package:lite_x/features/media/view_model/providers.dart'; import 'package:lite_x/features/profile/models/profile_model.dart'; import 'package:lite_x/features/profile/models/profile_tweet_model.dart'; import 'package:lite_x/features/profile/models/shared.dart'; import 'package:lite_x/features/profile/view/widgets/profile_tweets/shared_tweet_components.dart'; +import 'package:lite_x/features/profile/view_model/providers.dart'; +import 'package:readmore/readmore.dart'; +import 'package:flutter/gestures.dart'; +import 'package:video_player/video_player.dart'; +import 'package:visibility_detector/visibility_detector.dart'; class ProfileNormalTweetWidget extends ConsumerWidget implements ProfileTweet { const ProfileNormalTweetWidget({ diff --git a/lib/features/profile/view/widgets/profile_tweets/profile_normar_tweet_quot.dart b/lib/features/profile/view/widgets/profile_tweets/profile_normar_tweet_quot.dart index 0fde829..b6ac860 100644 --- a/lib/features/profile/view/widgets/profile_tweets/profile_normar_tweet_quot.dart +++ b/lib/features/profile/view/widgets/profile_tweets/profile_normar_tweet_quot.dart @@ -1,9 +1,15 @@ +import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:go_router/go_router.dart'; +import 'package:lite_x/core/providers/current_user_provider.dart'; import 'package:lite_x/features/profile/models/profile_model.dart'; import 'package:lite_x/features/profile/models/profile_tweet_model.dart'; import 'package:lite_x/features/profile/models/shared.dart'; import 'package:lite_x/features/profile/view/widgets/profile_tweets/shared_tweet_components.dart'; +import 'package:lite_x/features/profile/view_model/providers.dart'; +import 'package:readmore/readmore.dart'; class ProfileNormarTweetQuot extends ConsumerWidget implements ProfileTweet { const ProfileNormarTweetQuot({ diff --git a/lib/features/profile/view/widgets/profile_tweets/profile_retweet_widget.dart b/lib/features/profile/view/widgets/profile_tweets/profile_retweet_widget.dart index 0974117..7cb336e 100644 --- a/lib/features/profile/view/widgets/profile_tweets/profile_retweet_widget.dart +++ b/lib/features/profile/view/widgets/profile_tweets/profile_retweet_widget.dart @@ -1,3 +1,5 @@ + + import 'package:flutter/material.dart'; import 'package:lite_x/features/profile/models/profile_model.dart'; import 'package:lite_x/features/profile/models/profile_tweet_model.dart'; @@ -32,7 +34,7 @@ class ProfileRetweetWidget extends StatelessWidget implements ProfileTweet { ), SizedBox(width: 5), Text( - "${this.tweetModel.retweeterName} reposted", + "You reposted", style: TextStyle( color: Colors.grey, fontSize: 14, diff --git a/lib/features/profile/view/widgets/profile_tweets/shared_tweet_components.dart b/lib/features/profile/view/widgets/profile_tweets/shared_tweet_components.dart index e398ef1..8e1badf 100644 --- a/lib/features/profile/view/widgets/profile_tweets/shared_tweet_components.dart +++ b/lib/features/profile/view/widgets/profile_tweets/shared_tweet_components.dart @@ -241,8 +241,10 @@ class _VideoPlayerWidgetState extends State { @override void dispose() { try { - _controller.dispose(); - } catch (e) { + if (_controller != null) { + _controller.dispose(); + } + } catch (e) { debugPrint('Error disposing video controller: $e'); } super.dispose(); @@ -463,7 +465,7 @@ class _TweetMediaGridState extends ConsumerState { return mediaUrl.when( data: (url) { - if (url.isEmpty) { + if (url == null || url.isEmpty) { return _errorContainer(height); } if (_isVideo(url)) { diff --git a/lib/features/profile/view_model/providers.dart b/lib/features/profile/view_model/providers.dart index 5768a01..89f60e7 100644 --- a/lib/features/profile/view_model/providers.dart +++ b/lib/features/profile/view_model/providers.dart @@ -1,4 +1,5 @@ import 'package:dartz/dartz.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:lite_x/core/providers/current_user_provider.dart'; import 'package:lite_x/core/providers/dio_interceptor.dart'; diff --git a/lib/features/trends/models/for_you_response_model.dart b/lib/features/trends/models/for_you_response_model.dart index c9bd903..a867bcf 100644 --- a/lib/features/trends/models/for_you_response_model.dart +++ b/lib/features/trends/models/for_you_response_model.dart @@ -1,3 +1,4 @@ +import 'package:lite_x/features/profile/models/follower_model.dart'; import 'package:lite_x/features/profile/models/user_model.dart'; import 'package:lite_x/features/trends/models/trend_category.dart'; diff --git a/lib/features/trends/models/trend_category.dart b/lib/features/trends/models/trend_category.dart index e7764af..db3220a 100644 --- a/lib/features/trends/models/trend_category.dart +++ b/lib/features/trends/models/trend_category.dart @@ -1,7 +1,7 @@ +import 'package:lite_x/features/explore/models/trend_model.dart'; +import 'package:lite_x/features/profile/models/follower_model.dart'; import 'package:lite_x/features/profile/models/profile_tweet_model.dart'; import 'package:lite_x/features/profile/models/shared.dart'; -import 'package:lite_x/features/trends/models/trend_model.dart'; - class TrendCategory { final String categoryName; diff --git a/lib/features/trends/view/widgets/category_profile_trend_tab.dart b/lib/features/trends/view/widgets/category_profile_trend_tab.dart deleted file mode 100644 index dad4de4..0000000 --- a/lib/features/trends/view/widgets/category_profile_trend_tab.dart +++ /dev/null @@ -1,181 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:lite_x/features/profile/models/profile_model.dart'; -import 'package:lite_x/features/profile/models/profile_tweet_model.dart'; -import 'package:lite_x/features/profile/models/shared.dart'; -import 'package:lite_x/features/profile/models/user_model.dart'; -import 'package:lite_x/features/profile/view/widgets/following_followers/follower_card.dart'; -import 'package:lite_x/features/profile/view/widgets/profile_tweets/profile_normal_tweet_widget.dart' - hide Padding; -import 'package:lite_x/features/profile/view/widgets/profile_tweets/profile_quote_widget.dart'; -import 'package:lite_x/features/profile/view/widgets/profile_tweets/profile_retweet_widget.dart'; -import 'package:lite_x/features/profile/view_model/providers.dart'; -import 'package:lite_x/features/trends/models/trend_category.dart'; -import 'package:lite_x/features/trends/models/trend_model.dart'; -import 'package:lite_x/features/trends/view/widgets/trend_tile.dart'; - -class CategoryProfileTrendTab extends ConsumerWidget { - const CategoryProfileTrendTab({ - Key? key, - required this.pm, - required this.categoryName, - }) : super(key: key); - final ProfileModel pm; - final String categoryName; - - @override - Widget build(BuildContext context, WidgetRef ref) { - final asyncData = ref.watch(trendCategoryProvider(this.categoryName)); - return asyncData.when( - data: (res) { - return res.fold( - (l) { - return ListView( - padding: EdgeInsets.only(top: 50), - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - children: [ - Center(child: Text(l.message)), - Center( - child: IconButton( - onPressed: () async { - // ignore: unused_result - ref.refresh(trendCategoryProvider(this.categoryName)); - }, - icon: Icon(Icons.refresh), - ), - ), - ], - ); - }, - (data) { - return RefreshIndicator( - onRefresh: () async { - // ignore: unused_result - await ref.refresh(trendCategoryProvider(this.categoryName)); - }, - child: ListView( - children: data.trends.isEmpty && data.viralTweets.isEmpty - ? [ - Padding( - padding: const EdgeInsets.all(24), - child: Text( - "Nothing to see here -- yet.", - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 35, - ), - ), - ), - ] - : [ - SizedBox(height: 20), - _buildTweetsSection(data.viralTweets, pm), - Container( - width: double.infinity, - height: 0.5, - color: Colors.grey, - ), - SizedBox(height: 20), - _buildTredsSection(data, 30), - ], - ), - ); - }, - ); - }, - error: (err, _) { - return ListView( - padding: EdgeInsets.only(top: 50), - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - children: [ - Center( - child: Text("Can't get Trends at this time, Try again Later..."), - ), - Center( - child: IconButton( - onPressed: () async { - // ignore: unused_result - ref.refresh(trendCategoryProvider(this.categoryName)); - }, - icon: Icon(Icons.refresh), - ), - ), - ], - ); - }, - loading: () { - return SingleChildScrollView( - padding: EdgeInsets.all(20), - child: Center(child: CircularProgressIndicator()), - ); - }, - ); - } - - Widget _buildTredsSection(TrendCategory category, int limit) { - return ListView.builder( - padding: EdgeInsets.only(left: 16), - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemBuilder: (context, index) { - return TrendTile( - trend: category.trends[index], - trendCategory: category.categoryName.length >= 2 - ? "${category.categoryName[0].toUpperCase()}${category.categoryName.substring(1)}" - : "", - showRank: false, - ); - }, - itemCount: category.trends.length <= limit - ? category.trends.length - : limit, - ); - } - - Widget _buildTweetsSection(List tweets, ProfileModel pm) { - if (tweets.isEmpty) { - return SizedBox.shrink(); - } - return Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ListView.separated( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, index) { - TweetType type = tweets[index].type; - if (type == TweetType.ReTweet) - return ProfileRetweetWidget( - profileModel: pm, - tweetModel: tweets[index], - ); - - if (type == TweetType.Quote) - return ProfileQuoteWidget( - tweetModel: tweets[index], - profileModel: pm, - ); - - return ProfileNormalTweetWidget( - profileModel: pm, - profilePostModel: tweets[index], - ); - }, - itemCount: tweets.length <= 5 ? tweets.length : 5, - separatorBuilder: (context, index) { - return Container( - width: double.infinity, - height: 0.5, - color: Colors.grey, - ); - }, - ), - ], - ); - } -} diff --git a/lib/features/trends/view/widgets/for_you_profile_tab.dart b/lib/features/trends/view/widgets/for_you_profile_tab.dart index eeb4a2a..26d69b3 100644 --- a/lib/features/trends/view/widgets/for_you_profile_tab.dart +++ b/lib/features/trends/view/widgets/for_you_profile_tab.dart @@ -1,13 +1,13 @@ +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:go_router/go_router.dart'; import 'package:lite_x/features/profile/models/profile_model.dart'; import 'package:lite_x/features/profile/models/profile_tweet_model.dart'; import 'package:lite_x/features/profile/models/shared.dart'; import 'package:lite_x/features/profile/models/user_model.dart'; import 'package:lite_x/features/profile/view/widgets/following_followers/follower_card.dart'; -import 'package:lite_x/features/profile/view/widgets/profile_tweets/profile_normal_tweet_widget.dart' - hide Padding; +import 'package:lite_x/features/profile/view/widgets/profile_tweets/profile_normal_tweet_widget.dart' hide Padding; +import 'package:lite_x/features/profile/view/widgets/profile_tweets/profile_posts_list.dart'; import 'package:lite_x/features/profile/view/widgets/profile_tweets/profile_quote_widget.dart'; import 'package:lite_x/features/profile/view/widgets/profile_tweets/profile_retweet_widget.dart'; import 'package:lite_x/features/profile/view_model/providers.dart'; @@ -63,7 +63,7 @@ class ForYouProfileTab extends ConsumerWidget { error: (err, _) => SizedBox.shrink(), loading: () => SizedBox.shrink(), ), - _buildWhoToFollowSection(data.suggestedUsers, context), + _buildWhoToFollowSection(data.suggestedUsers), ListView.builder( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), @@ -100,7 +100,6 @@ class ForYouProfileTab extends ConsumerWidget { }, loading: () { return SingleChildScrollView( - padding: EdgeInsets.all(20), child: Center(child: CircularProgressIndicator()), ); }, @@ -123,7 +122,7 @@ class ForYouProfileTab extends ConsumerWidget { ); } - Widget _buildWhoToFollowSection(List users, BuildContext context) { + Widget _buildWhoToFollowSection(List users) { return Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, @@ -137,27 +136,12 @@ class ForYouProfileTab extends ConsumerWidget { style: TextStyle(fontSize: 22, fontWeight: FontWeight.w900), ), ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ListView.builder( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, index) => - FollowerCard(user: users[index], isMe: true), - itemCount: users.length <= 5 ? users.length : 5, - ), - Padding( - padding: const EdgeInsets.only(left: 16, bottom: 16), - child: GestureDetector( - onTap: () { - // TODO: go to who to follow screen - // context.push(); - }, - child: Text("Show more", style: TextStyle(color: Colors.blue)), - ), - ), - ], + ListView.builder( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, index) => + FollowerCard(user: users[index], isMe: true), + itemCount: users.length <= 5 ? users.length : 5, ), ], ); @@ -174,9 +158,8 @@ class ForYouProfileTab extends ConsumerWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container(width: double.infinity, height: 0.25, color: Colors.grey), Padding( - padding: const EdgeInsets.only(left: 16), + padding: const EdgeInsets.only(left: 16, top: 16), child: Text( category.categoryName.length >= 2 ? "${category.categoryName[0].toUpperCase()}${category.categoryName.substring(1)} Trends" diff --git a/lib/features/trends/view/widgets/trend_tile.dart b/lib/features/trends/view/widgets/trend_tile.dart index 48c9852..9792545 100644 --- a/lib/features/trends/view/widgets/trend_tile.dart +++ b/lib/features/trends/view/widgets/trend_tile.dart @@ -18,59 +18,53 @@ class TrendTile extends StatelessWidget { final textTheme = Theme.of(context).textTheme; final colorScheme = Theme.of(context).colorScheme; - return InkWell( - onTap: () { - // TODO: go to trend tweets screen - }, - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 12.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Context label (e.g., Trending in Egypt) - Text( - "${showRank ? trend.rank : ""}${showRank ? "." : ""}Trending in ${this.trendCategory}", - style: textTheme.labelSmall?.copyWith( - color: const Color.fromARGB(255, 95, 101, 104), - fontWeight: FontWeight.w900, - fontSize: 14, - ), + return Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Context label (e.g., Trending in Egypt) + Text( + "${showRank ? trend.rank : ""}${showRank ? "." : ""}Trending in ${this.trendCategory}", + style: textTheme.labelSmall?.copyWith( + color: const Color.fromARGB(255, 95, 101, 104), + fontWeight: FontWeight.w900, + fontSize: 14, + ), + ), + const SizedBox(height: 4), + // Title + Text( + trend.title, + style: textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.w600, ), - const SizedBox(height: 4), - // Title + ), + const SizedBox(height: 4), + // Posts count + if (trend.postCount != 0) Text( - "#" + trend.title, - style: textTheme.titleMedium?.copyWith( - fontWeight: FontWeight.w700, - fontSize: 18, + "${Shared.formatCount(trend.postCount.toInt())} posts", + style: textTheme.labelSmall?.copyWith( + color: colorScheme.onSurface.withOpacity(0.7), + fontSize: 13, ), ), - const SizedBox(height: 4), - // Posts count - if (trend.postCount != 0) - Text( - "${Shared.formatCount(trend.postCount.toInt())} posts", - style: textTheme.labelSmall?.copyWith( - color: colorScheme.onSurface.withOpacity(0.7), - fontSize: 13, - ), - ), - ], - ), - ), - // Kebab menu icon - IconButton( - icon: const Icon(Icons.more_vert), - color: colorScheme.onSurface.withOpacity(0.7), - iconSize: 18, - onPressed: () {}, + ], ), - ], - ), + ), + // Kebab menu icon + IconButton( + icon: const Icon(Icons.more_vert), + color: colorScheme.onSurface.withOpacity(0.7), + iconSize: 18, + onPressed: () {}, + ), + ], ), ); } diff --git a/lib/features/trends/view/widgets/trending_profile_tab.dart b/lib/features/trends/view/widgets/trending_profile_tab.dart deleted file mode 100644 index e52be42..0000000 --- a/lib/features/trends/view/widgets/trending_profile_tab.dart +++ /dev/null @@ -1,82 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:lite_x/features/profile/view_model/providers.dart'; -import 'package:lite_x/features/trends/view/widgets/trend_tile.dart'; - -class TrendingProfileTab extends ConsumerWidget { - const TrendingProfileTab({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context, WidgetRef ref) { - final asyncTrends = ref.watch(profileTrendsProvider); - return asyncTrends.when( - data: (res) { - return res.fold( - (l) { - return ListView( - padding: EdgeInsets.only(top: 50), - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - children: [ - Center(child: Text(l.message)), - Center( - child: IconButton( - onPressed: () async { - // ignore: unused_result - ref.refresh(profileTrendsProvider); - }, - icon: Icon(Icons.refresh), - ), - ), - ], - ); - }, - (data) { - return RefreshIndicator( - onRefresh: () async { - // ignore: unused_result - await ref.refresh(profileTrendsProvider); - }, - child: ListView.builder( - padding: EdgeInsets.only(left: 16), - itemBuilder: (context, index) => TrendTile( - trend: data[index], - trendCategory: "Egypt", - showRank: true, - ), - itemCount: data.length, - ), - ); - }, - ); - }, - error: (err, _) { - return ListView( - padding: EdgeInsets.only(top: 50), - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - children: [ - Center( - child: Text("Can't get Trends at this time, Try again Later..."), - ), - Center( - child: IconButton( - onPressed: () async { - // ignore: unused_result - ref.refresh(profileTrendsProvider); - }, - icon: Icon(Icons.refresh), - ), - ), - ], - ); - }, - loading: () { - return SingleChildScrollView( - padding: EdgeInsets.all(20), - child: Center(child: CircularProgressIndicator()), - ); - }, - ); - } -} From 7beddbb24ea14e8312dea5ed9c15e3914006c507 Mon Sep 17 00:00:00 2001 From: asermohamed1 <153523890+asermohamed1@users.noreply.github.com> Date: Sat, 13 Dec 2025 00:45:19 +0200 Subject: [PATCH 2/2] fixed --- .env | 4 ++- android/app/build.gradle.kts | 49 ++++++++++++++++++++++++-------- android/app/google-services.json | 21 +++++--------- 3 files changed, 47 insertions(+), 27 deletions(-) diff --git a/.env b/.env index 9a56f2d..32046db 100644 --- a/.env +++ b/.env @@ -1,4 +1,6 @@ -API_URL=https://avah-pollinical-randal.ngrok-free.dev/ +# API_URL=https://app-dbef67eb-9a2e-44fa-abff-3e8b83204d9c.cleverapps.io/ +# API_URL=https://node.shoy.publicvm.com/ +API_URL=https://node.shoy.publicvm.com/ # API_test_URL=https://example.com/ # API_URL=https://wanita-hypernormal-cherise.ngrok-free.dev/ # API_URL=https://avah-pollinical-randal.ngrok-free.dev/ diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index e792664..aedeb3f 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -1,9 +1,11 @@ +import java.util.Properties +import java.io.FileInputStream + plugins { id("com.android.application") id("kotlin-android") id("dev.flutter.flutter-gradle-plugin") id("com.google.gms.google-services") - } android { @@ -11,6 +13,28 @@ android { compileSdk = flutter.compileSdkVersion ndkVersion = flutter.ndkVersion + signingConfigs { + getByName("debug") { + storeFile = file("debug.keystore") + storePassword = "android" + keyAlias = "androiddebugkey" + keyPassword = "android" + } + + create("release") { + val keystoreProperties = Properties() + val keystorePropertiesFile = rootProject.file("key.properties") + if (keystorePropertiesFile.exists()) { + keystoreProperties.load(FileInputStream(keystorePropertiesFile)) + } + + storeFile = file(keystoreProperties["storeFile"] as String) + storePassword = keystoreProperties["storePassword"] as String + keyAlias = keystoreProperties["keyAlias"] as String + keyPassword = keystoreProperties["keyPassword"] as String + } + } + compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 @@ -21,32 +45,33 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId = "com.Artemsia.lite_x" - // You can update the following values to match your application needs. - // For more information, see: https://flutter.dev/to/review-gradle-config. minSdk = flutter.minSdkVersion targetSdk = flutter.targetSdkVersion versionCode = flutter.versionCode versionName = flutter.versionName } - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.getByName("debug") - } +buildTypes { + getByName("debug") { + signingConfig = signingConfigs.getByName("debug") + } + getByName("release") { + signingConfig = signingConfigs.getByName("release") + isMinifyEnabled = false + isShrinkResources = false } } + +} + dependencies { implementation("com.squareup.okhttp3:okhttp:4.12.0") implementation(platform("com.google.firebase:firebase-bom:33.5.1")) implementation("com.google.firebase:firebase-messaging") } - flutter { source = "../.." -} +} \ No newline at end of file diff --git a/android/app/google-services.json b/android/app/google-services.json index 82e92bf..926b671 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -1,41 +1,34 @@ { "project_info": { - "project_number": "123824690535", - "project_id": "litex-3c6f1", - "storage_bucket": "litex-3c6f1.firebasestorage.app" + "project_number": "112144721859", + "project_id": "psychic-fin-474008-h8", + "storage_bucket": "psychic-fin-474008-h8.firebasestorage.app" }, "client": [ { "client_info": { - "mobilesdk_app_id": "1:123824690535:android:f0760abf0029e802960bc2", + "mobilesdk_app_id": "1:112144721859:android:227c69fccfe2ec4c813f76", "android_client_info": { "package_name": "com.Artemsia.lite_x" } }, "oauth_client": [ { - "client_id": "123824690535-52cesp7okt1d8j63pn7su9rtmi0asq0b.apps.googleusercontent.com", + "client_id": "112144721859-3i16bpjr6jd704h3imdsp4ojodv7t64l.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { - "current_key": "AIzaSyDYiU34-5-Rr2nP_SHphvLSIiOyr4RuC8I" + "current_key": "AIzaSyAPqcctNBpWkQ-BKvYsHUEjvc_iwPBwsZ0" } ], "services": { "appinvite_service": { "other_platform_oauth_client": [ { - "client_id": "123824690535-52cesp7okt1d8j63pn7su9rtmi0asq0b.apps.googleusercontent.com", + "client_id": "112144721859-3i16bpjr6jd704h3imdsp4ojodv7t64l.apps.googleusercontent.com", "client_type": 3 - }, - { - "client_id": "123824690535-5pta8j3mu07g0bb21n43n8q2vuulrstr.apps.googleusercontent.com", - "client_type": 2, - "ios_info": { - "bundle_id": "com.example.litex" - } } ] }