From 10ae9018b057a1bd5735e6ffb9d8b5373bc7d87c Mon Sep 17 00:00:00 2001 From: Erfan Jazeb Nikoo <erfan.jazebnikoo@gmail.com> Date: Fri, 12 May 2023 14:54:37 +0200 Subject: [PATCH] erfan/ui_2 new UI updates --- lib/screens/threads_screen.dart | 66 ++++++++++++-------- lib/utilities/helpers/feed_helper.dart | 8 ++- lib/widgets/home/feed_bottom_navigation.dart | 6 +- lib/widgets/home/save_bottom_navigation.dart | 2 +- 4 files changed, 50 insertions(+), 32 deletions(-) diff --git a/lib/screens/threads_screen.dart b/lib/screens/threads_screen.dart index 2245c8d..4c7cbc3 100644 --- a/lib/screens/threads_screen.dart +++ b/lib/screens/threads_screen.dart @@ -37,13 +37,12 @@ class _ThreadsScreenState extends State<ThreadsScreen> { body: Consumer<ThreadProvider>(builder: (context, provider, __) { var tweet = feed.selectedPost!; bool isSaved = feed.savedPosts.contains(tweet.id); - bool isLiked = tweet.get('liked') != null && tweet.get('liked') == true; - bool isRetweeted = - tweet.get('retweeted') != null && tweet.get('retweeted') == true; + // bool isLiked = tweet.get('liked') != null && tweet.get('liked') == true; + // bool isRetweeted = + // tweet.get('retweeted') != null && tweet.get('retweeted') == true; return Container( decoration: BoxDecoration( color: app.colors.scaffoldBackground, - border: Border.all(width: 1, color: app.colors.lineDivider), borderRadius: BorderRadius.vertical(top: Radius.circular(30)), ), child: Stack( @@ -64,32 +63,47 @@ class _ThreadsScreenState extends State<ThreadsScreen> { ), color: app.colors.white, ), + SizedBox(width: 8), RoundButton( onTap: () => provider.openMLFeedback(context, tweet), - icon: app.icons.edit(color: app.colors.white, height: 38), + icon: Row( + children: [ + app.icons.edit(color: app.colors.white, height: 38), + SizedBox(width: 5), + Text( + 'Edit', + style: app.styles.postBody.copyWith( + color: app.colors.white, + ), + ), + ], + ), + padding: EdgeInsets.fromLTRB( + isSaved ? 9.5 : 10, 9.5, isSaved ? 15 : 20, 9.5), color: app.colors.brandPink, ), - RoundButton( - onTap: () => provider.toggleLikeTweet(tweet), - icon: app.icons.heart( - height: 38, - color: isLiked - ? app.colors.brandOrange - : app.colors.white), - color: - isLiked ? app.colors.white : app.colors.brandOrange, - ), - RoundButton( - onTap: () => provider.toggleRetweet(tweet), - icon: app.icons.retweet( - height: 38, - color: isRetweeted - ? app.colors.brandYellow - : app.colors.white), - color: isRetweeted - ? app.colors.white - : app.colors.brandYellow, - ), + SizedBox(width: 8), + // RoundButton( + // onTap: () => provider.toggleLikeTweet(tweet), + // icon: app.icons.heart( + // height: 38, + // color: isLiked + // ? app.colors.brandOrange + // : app.colors.white), + // color: + // isLiked ? app.colors.white : app.colors.brandOrange, + // ), + // RoundButton( + // onTap: () => provider.toggleRetweet(tweet), + // icon: app.icons.retweet( + // height: 38, + // color: isRetweeted + // ? app.colors.brandYellow + // : app.colors.white), + // color: isRetweeted + // ? app.colors.white + // : app.colors.brandYellow, + // ), RoundButton( onTap: () => provider.savePost(tweet.id), icon: Row( diff --git a/lib/utilities/helpers/feed_helper.dart b/lib/utilities/helpers/feed_helper.dart index 9f9d97f..849d8f0 100644 --- a/lib/utilities/helpers/feed_helper.dart +++ b/lib/utilities/helpers/feed_helper.dart @@ -74,8 +74,12 @@ class FeedHelper { String shortenCategoryName(String categoryName) { String name = categoryName; - name = name.replaceAll('Technology', 'Tech'); - name = name.replaceAll('Business', 'Biz'); + name = name.replaceAll('Sports & Gaming', 'Sports & Gaming'); + name = name.replaceAll('Science & Technology', 'Science & Tech'); + name = name.replaceAll('News & Politics', 'Politics'); + name = name.replaceAll('Daily Life', 'Lifestyle'); + name = name.replaceAll('Business & Entrepreneurs', 'Business'); + name = name.replaceAll('Arts & Culture', 'Culture'); return name; } } diff --git a/lib/widgets/home/feed_bottom_navigation.dart b/lib/widgets/home/feed_bottom_navigation.dart index 38f2e64..0f2a7ab 100644 --- a/lib/widgets/home/feed_bottom_navigation.dart +++ b/lib/widgets/home/feed_bottom_navigation.dart @@ -136,8 +136,8 @@ class _FeedBottomNavigationState extends State<FeedBottomNavigation> feed.subcategories[index], maxLines: 1, overflow: TextOverflow.ellipsis, - style: app.styles.headline1 - .copyWith(color: app.colors.white), + style: app.styles.headline1.copyWith( + color: app.colors.white, fontSize: 24), ), ), ), @@ -185,7 +185,7 @@ class _FeedBottomNavigationState extends State<FeedBottomNavigation> ), padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10), child: Text( - categoryName, + feed.shortenCategoryName(categoryName), maxLines: 1, style: app.styles.headline1.copyWith( color: selected diff --git a/lib/widgets/home/save_bottom_navigation.dart b/lib/widgets/home/save_bottom_navigation.dart index 393a236..12110c2 100644 --- a/lib/widgets/home/save_bottom_navigation.dart +++ b/lib/widgets/home/save_bottom_navigation.dart @@ -61,7 +61,7 @@ class _SaveBottomNavigationState extends State<SaveBottomNavigation> itemBuilder: (_, index) { var categoryName = feed.savedPostsCategories.elementAt(index); // var cluster = provider.getClusterById(clusterId); - // var categoryName = cluster?.get('category') ?? 'Unassigned'; + // var categoryName = cluster?.get('category') ?? 'unassigned'; return InkWell( onTap: () => provider.selectSavedCategory(index), -- GitLab