diff --git a/lib/assets/icons/chart 2.svg b/lib/assets/icons/chart 2.svg new file mode 100644 index 0000000..e9cb616 --- /dev/null +++ b/lib/assets/icons/chart 2.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/lib/assets/icons/discover.svg b/lib/assets/icons/discover.svg new file mode 100644 index 0000000..5328838 --- /dev/null +++ b/lib/assets/icons/discover.svg @@ -0,0 +1,4 @@ + + + + diff --git a/lib/assets/icons/home2.svg b/lib/assets/icons/home2.svg new file mode 100644 index 0000000..913a830 --- /dev/null +++ b/lib/assets/icons/home2.svg @@ -0,0 +1,4 @@ + + + + diff --git a/lib/views/home/categories/categories_page.dart b/lib/views/home/categories/categories_page.dart index 13480a7..c497aef 100644 --- a/lib/views/home/categories/categories_page.dart +++ b/lib/views/home/categories/categories_page.dart @@ -17,7 +17,7 @@ class CategoriesPage extends StatelessWidget { style: Theme.of(context).textTheme.titleMedium, ), const SizedBox(height: 20), - const MainCategories(), + // const MainCategories(), ], ), ), diff --git a/lib/views/home/explore/explore.dart b/lib/views/home/explore/explore.dart new file mode 100644 index 0000000..6ad2e01 --- /dev/null +++ b/lib/views/home/explore/explore.dart @@ -0,0 +1,380 @@ +import 'package:didvan/config/theme_data.dart'; +import 'package:didvan/constants/app_icons.dart'; +import 'package:didvan/main.dart'; +import 'package:didvan/models/home_page_content/home_page_list.dart'; +import 'package:didvan/models/home_page_content/swot.dart'; +import 'package:didvan/routes/routes.dart'; +import 'package:didvan/services/app_initalizer.dart'; +import 'package:didvan/views/home/main/main_page_state.dart'; +import 'package:didvan/views/home/main/widgets/banner.dart'; +import 'package:didvan/views/home/main/widgets/general_item.dart'; +import 'package:didvan/views/home/main/widgets/podcast_item.dart'; +import 'package:didvan/views/widgets/didvan/slider.dart'; +import 'package:didvan/views/widgets/didvan/text.dart'; +import 'package:didvan/views/widgets/state_handlers/state_handler.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; +import 'package:didvan/services/network/request.dart'; +import 'package:url_launcher/url_launcher_string.dart'; +import 'package:didvan/views/home/main/widgets/swot_item_card.dart'; +import 'package:flutter/foundation.dart' show kIsWeb, defaultTargetPlatform; +import 'package:universal_html/html.dart' as html; + +import 'package:didvan/views/home/main/main_page.dart'; + +bool isAnyMobile() { + if (kIsWeb) { + final userAgent = html.window.navigator.userAgent.toLowerCase(); + return userAgent.contains('mobile') || + userAgent.contains('android') || + userAgent.contains('ios'); + } + + return defaultTargetPlatform == TargetPlatform.android || + defaultTargetPlatform == TargetPlatform.iOS; +} + +class ExplorePage extends StatelessWidget { + const ExplorePage({super.key}); + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, state, child) { + return StateHandler( + onRetry: () => context.read().init(), + state: state, + builder: (context, state) { + final List pageContent = []; + if (state.content != null && state.content!.lists.isNotEmpty) { + final lists = state.content!.lists; + + for (int i = 0; i < lists.length; i++) { + final currentList = lists[i]; + + if (i == 4) { + pageContent.add( + Padding( + padding: const EdgeInsets.only(top: 32), + child: Column( + children: [ + Padding( + padding: const EdgeInsets.only( + left: 16, + right: 16, + bottom: 16, + top: 28, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + const InfoTitle(), + GestureDetector( + onTap: () => { + Navigator.of(context) + .pushNamed(Routes.infography) + }, + child: Row( + children: [ + DidvanText( + "مشاهده همه", + color: Theme.of(context).colorScheme.primary, + fontWeight: FontWeight.bold, + ), + ], + ), + ) + ], + ), + ), + const MainPageBanner( + isFirst: false, + ), + ], + ), + ), + ); + } + + pageContent.add(MainPageSection( + list: currentList, + isLast: i == lists.length - 1, + )); + + if (currentList.type == 'startup') { + pageContent.add(SwotSection(swotItems: state.swotItems)); + } + } + } + return ListView( + children: pageContent, + ); + }, + ); + }, + ); + } +} + +class SwotSection extends StatelessWidget { + final List swotItems; + const SwotSection({required this.swotItems}); + + @override + Widget build(BuildContext context) { + if (swotItems.isEmpty) { + return const SizedBox.shrink(); + } + + return Padding( + padding: const EdgeInsets.all(0.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + /// Title Row + Padding( + padding: const EdgeInsets.only(right: 20, top: 30), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + SvgPicture.asset( + "lib/assets/images/features/Saha Solid.svg", + color: Theme.of(context).colorScheme.title, + ), + const SizedBox(width: 5), + DidvanText( + "ماژول فرصت و تهدید", + style: Theme.of(context).textTheme.titleMedium, + color: Theme.of(context).colorScheme.title, + ), + ], + ), + GestureDetector( + onTap: () { + AppInitializer.openWebLink( + navigatorKey.currentContext!, + 'http://opportunity-threat.didvan.com/?accessToken=${RequestService.token}', + mode: LaunchMode.inAppWebView, + ); + }, + child: Padding( + padding: EdgeInsets.only(left: 20), + child: Row( + children: [ + DidvanText( + "مشاهده همه", + color: Theme.of(context).colorScheme.primary, + fontWeight: FontWeight.bold, + ), + ], + ), + ), + ), + ], + ), + ), + + const SizedBox(height: 16), + + /// Swot Items Slider + DidvanSlider( + height: 330, + itemCount: 7, + viewportFraction: isAnyMobile() ? 0.65 : 0.55, + itemBuilder: (context, index, realIndex) => Padding( + padding: const EdgeInsets.symmetric(horizontal: 0.0), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: SwotItemCard(item: swotItems[index]), + ), + ), + ), + ], + ), + ); + } +} + +class InfoTitle extends StatelessWidget { + const InfoTitle({super.key}); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Icon( + DidvanIcons.infography_solid, + color: Theme.of(context).colorScheme.title, + ), + const SizedBox(width: 4), + DidvanText( + "اینفوگرافی", + style: Theme.of(context).textTheme.titleMedium, + color: Theme.of(context).colorScheme.title, + ), + ], + ); + } +} + +class MainPageSection extends StatelessWidget { + final MainPageList list; + final bool isLast; + + const MainPageSection({required this.list, required this.isLast}); + + void _moreHandler(BuildContext context) { + if (list.link.startsWith('http')) { + AppInitializer.openWebLink( + context, + '${list.link}?accessToken=${RequestService.token}', + mode: LaunchMode.inAppWebView, + ); + return; + } + Navigator.of(context).pushNamed(list.link); + } + + IconData? _generateIcon() { + switch (list.type) { + case 'news': + return DidvanIcons.foolad_solid; + case 'radar': + return DidvanIcons.scanning_solid; + case 'video': + return DidvanIcons.video_solid; + case 'podcast': + return DidvanIcons.podcast_solid; + case 'trend': + return DidvanIcons.chart_solid; + case 'technology': + return DidvanIcons.technology_solid; + case 'risk': + return DidvanIcons.exclamation_triangle_solid; + case 'startup': + return DidvanIcons.startup_solid; + case 'delphi': + return DidvanIcons.saha_solid; + default: + return null; + } + } + + int _maxSublistCount() { + int max = 1; + for (var i = 0; i < list.contents.length; i++) { + if (list.contents[i].subtitles.length > max) { + max = list.contents[i].subtitles.length; + } + } + return max - 1; + } + + @override + Widget build(BuildContext context) { + final icon = _generateIcon(); + + if (list.contents.isEmpty) { + return const SizedBox(); + } + + if (list.type == 'delphi') { + return Column( + children: [ + _buildSectionHeader(context, icon), + _buildSectionSlider(context), + ], + ); + } + + return Column( + children: [ + _buildSectionHeader(context, icon), + _buildSectionSlider(context), + ], + ); + } + + Padding _buildSectionHeader(BuildContext context, IconData? icon) { + return Padding( + padding: const EdgeInsets.only( + left: 16, + right: 16, + bottom: 16, + top: 28, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + if (icon != null) + Icon( + icon, + color: Theme.of(context).colorScheme.title, + ), + const SizedBox(width: 4), + DidvanText( + list.header, + style: Theme.of(context).textTheme.titleMedium, + color: Theme.of(context).colorScheme.title, + ), + ], + ), + GestureDetector( + onTap: () => _moreHandler(context), + child: Row( + children: [ + DidvanText( + "مشاهده همه", + color: Theme.of(context).colorScheme.primary, + fontWeight: FontWeight.bold, + ), + ], + ), + ) + ], + ), + ); + } + + Widget _buildSectionSlider(BuildContext context) { + if (list.type == 'podcast') { + return Padding( + padding: const EdgeInsets.only(top: 28), + child: Column( + children: list.contents + .map( + (e) => Padding( + padding: const EdgeInsets.only( + bottom: 12, + left: 28, + right: 28, + ), + child: MainPagePodcastItem( + content: e, + ), + ), + ) + .toList(), + ), + ); + } + + return DidvanSlider( + height: 260 + (_maxSublistCount() - (list.type == 'radar' ? 1 : 0)) * 20, + itemCount: list.contents.length, + viewportFraction: isAnyMobile() ? 0.65 : 0.55, + itemBuilder: (context, index, realIndex) => Padding( + padding: const EdgeInsets.symmetric(horizontal: 4), + child: MainPageGeneralItem( + content: list.contents[index], + type: list.type, + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/views/home/home.dart b/lib/views/home/home.dart index 4abe08e..31d63e2 100644 --- a/lib/views/home/home.dart +++ b/lib/views/home/home.dart @@ -5,6 +5,7 @@ import 'package:didvan/providers/theme.dart'; import 'package:didvan/services/app_initalizer.dart'; import 'package:didvan/utils/action_sheet.dart'; import 'package:didvan/views/home/categories/categories_page.dart'; +import 'package:didvan/views/home/explore/explore.dart'; import 'package:didvan/views/home/main/main_page.dart'; import 'package:didvan/views/home/home_state.dart'; import 'package:didvan/views/home/new_statistic/new_statistic.dart'; @@ -33,18 +34,19 @@ class _HomeState extends State @override void initState() { - // Remove dialog showing logic to prevent welcome popups - // if (widget.showDialogs ?? false) { - // _showDialog(context); - // } - final state = context.read(); DesignConfig.updateSystemUiOverlayStyle(); - _tabController = TabController(length: 3, vsync: this, initialIndex: 0); + // Change length from 3 to 4 + _tabController = TabController(length: 4, vsync: this, initialIndex: 0); state.tabController = _tabController; _tabController.addListener(() { - state.currentPageIndex = _tabController.index; + // This check prevents errors if the controller is accessed after disposal. + if (_tabController.indexIsChanging) { + state.currentPageIndex = _tabController.index; + } else { + state.currentPageIndex = _tabController.index; + } }); if (!kIsWeb) { Future.delayed(Duration.zero, () { @@ -76,7 +78,6 @@ class _HomeState extends State backgroundColor: Theme.of(context).colorScheme.background, resizeToAvoidBottomInset: false, drawer: null, - // ignore: deprecated_member_use body: WillPopScope( onWillPop: () async { if (context.read().tabController.index == 0) { @@ -112,10 +113,12 @@ class _HomeState extends State child: TabBarView( physics: const NeverScrollableScrollPhysics(), controller: _tabController, + // Add ExplorePage here children: const [ MainPage(), CategoriesPage(), NewStatistic(), + ExplorePage(), ], ), ), @@ -138,4 +141,4 @@ class _HomeState extends State ), ); } -} +} \ No newline at end of file diff --git a/lib/views/home/main/main_page.dart b/lib/views/home/main/main_page.dart index 793e1a8..6541e35 100644 --- a/lib/views/home/main/main_page.dart +++ b/lib/views/home/main/main_page.dart @@ -78,10 +78,6 @@ class _MainPageState extends State { builder: (context, state) { print("DEBUG: FutureBuilder waiting"); print("DEBUG: FutureBuilder state.stories.isNotEmpty: ${state.stories.isNotEmpty}"); - print("DEBUG: FutureBuilder state.content: ${state.content!.lists}"); - print("DEBUG: FutureBuilder state.content != null: ${state.content != null}"); - print( - "DEBUG: FutureBuilder state.content!.lists.isNotEmpty: ${state.content!.lists.isNotEmpty}"); return ListView( padding: const EdgeInsets.only(top: 0, bottom: 16), children: [ @@ -150,71 +146,6 @@ class _MainPageState extends State { padding: EdgeInsets.symmetric(horizontal: 16), child: MainPageMainContent(), ), - Builder(builder: (context) { - final List pageContent = []; - if (state.content != null && state.content!.lists.isNotEmpty) { - final lists = state.content!.lists; - - for (int i = 0; i < lists.length; i++) { - final currentList = lists[i]; - - if (i == 4) { - pageContent.add( - Padding( - padding: const EdgeInsets.only(top: 32), - child: Column( - children: [ - Padding( - padding: const EdgeInsets.only( - left: 16, - right: 16, - bottom: 16, - top: 28, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const InfoTitle(), - GestureDetector( - onTap: () => { - Navigator.of(context) - .pushNamed(Routes.infography) - }, - child: Row( - children: [ - DidvanText( - "مشاهده همه", - color: Theme.of(context).colorScheme.primary, - fontWeight: FontWeight.bold, - ), - ], - ), - ) - ], - ), - ), - const MainPageBanner( - isFirst: false, - ), - ], - ), - ), - ); - } - - pageContent.add(_MainPageSection( - list: currentList, - isLast: i == lists.length - 1, - )); - - if (currentList.type == 'startup') { - pageContent.add(_SwotSection(swotItems: state.swotItems)); - } - } - } - print("DEBUG: FutureBuilder error"); - return Column(children: pageContent); - }), ], ); }, @@ -223,7 +154,7 @@ class _MainPageState extends State { Future _showFilterBottomSheet(BuildContext context) async { final state = Provider.of(context, listen: false); - + ActionSheetUtils(context).showBottomSheet( data: ActionSheetData( titleIcon: DidvanIcons.filter_regular, @@ -297,109 +228,6 @@ class _MainPageState extends State { } } -class _SwotSection extends StatelessWidget { - final List swotItems; - const _SwotSection({required this.swotItems}); - - @override - Widget build(BuildContext context) { - if (swotItems.isEmpty) { - return const SizedBox.shrink(); - } - - return Padding( - padding: const EdgeInsets.all(0.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - /// Title Row - Padding( - padding: const EdgeInsets.only(right: 20, top: 30), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - SvgPicture.asset( - "lib/assets/images/features/Saha Solid.svg", - color: Theme.of(context).colorScheme.title, - ), - const SizedBox(width: 5), - DidvanText( - "ماژول فرصت و تهدید", - style: Theme.of(context).textTheme.titleMedium, - color: Theme.of(context).colorScheme.title, - ), - ], - ), - GestureDetector( - onTap: () { - AppInitializer.openWebLink( - navigatorKey.currentContext!, - 'http://opportunity-threat.didvan.com/?accessToken=${RequestService.token}', - mode: LaunchMode.inAppWebView, - ); - }, - child: Padding( - padding: EdgeInsets.only(left: 20), - child: Row( - children: [ - DidvanText( - "مشاهده همه", - color: Theme.of(context).colorScheme.primary, - fontWeight: FontWeight.bold, - ), - ], - ), - ), - ), - ], - ), - ), - - const SizedBox(height: 16), - - /// Swot Items Slider - DidvanSlider( - height: 330, - itemCount: 7, - viewportFraction: isAnyMobile() ? 0.65 : 0.55, - itemBuilder: (context, index, realIndex) => Padding( - padding: const EdgeInsets.symmetric(horizontal: 0.0), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: SwotItemCard(item: swotItems[index]), - ), - ), - ), - ], - ), - ); - } -} - -class InfoTitle extends StatelessWidget { - const InfoTitle({super.key}); - - @override - Widget build(BuildContext context) { - return Row( - children: [ - Icon( - DidvanIcons.infography_solid, - color: Theme.of(context).colorScheme.title, - ), - const SizedBox(width: 4), - DidvanText( - "اینفوگرافی", - style: Theme.of(context).textTheme.titleMedium, - color: Theme.of(context).colorScheme.title, - ), - ], - ); - } -} - class _DidvanSignalsTitle extends StatelessWidget { const _DidvanSignalsTitle(); @@ -431,163 +259,4 @@ class _DidvanSignalsTitle extends StatelessWidget { ), ); } -} - -class _MainPageSection extends StatelessWidget { - final MainPageList list; - final bool isLast; - - const _MainPageSection({required this.list, required this.isLast}); - - void _moreHandler(BuildContext context) { - if (list.link.startsWith('http')) { - AppInitializer.openWebLink( - context, - '${list.link}?accessToken=${RequestService.token}', - mode: LaunchMode.inAppWebView, - ); - return; - } - Navigator.of(context).pushNamed(list.link); - } - - IconData? _generateIcon() { - switch (list.type) { - case 'news': - return DidvanIcons.foolad_solid; - case 'radar': - return DidvanIcons.scanning_solid; - case 'video': - return DidvanIcons.video_solid; - case 'podcast': - return DidvanIcons.podcast_solid; - case 'trend': - return DidvanIcons.chart_solid; - case 'technology': - return DidvanIcons.technology_solid; - case 'risk': - return DidvanIcons.exclamation_triangle_solid; - case 'startup': - return DidvanIcons.startup_solid; - case 'delphi': - return DidvanIcons.saha_solid; - default: - return null; - } - } - - int _maxSublistCount() { - int max = 1; - for (var i = 0; i < list.contents.length; i++) { - if (list.contents[i].subtitles.length > max) { - max = list.contents[i].subtitles.length; - } - } - return max - 1; - } - - @override - Widget build(BuildContext context) { - final icon = _generateIcon(); - - if (list.contents.isEmpty) { - return const SizedBox(); - } - - if (list.type == 'delphi') { - return Column( - children: [ - _buildSectionHeader(context, icon), - _buildSectionSlider(context), - ], - ); - } - - return Column( - children: [ - _buildSectionHeader(context, icon), - _buildSectionSlider(context), - ], - ); - } - - Padding _buildSectionHeader(BuildContext context, IconData? icon) { - return Padding( - padding: const EdgeInsets.only( - left: 16, - right: 16, - bottom: 16, - top: 28, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - if (icon != null) - Icon( - icon, - color: Theme.of(context).colorScheme.title, - ), - const SizedBox(width: 4), - DidvanText( - list.header, - style: Theme.of(context).textTheme.titleMedium, - color: Theme.of(context).colorScheme.title, - ), - ], - ), - GestureDetector( - onTap: () => _moreHandler(context), - child: Row( - children: [ - DidvanText( - "مشاهده همه", - color: Theme.of(context).colorScheme.primary, - fontWeight: FontWeight.bold, - ), - ], - ), - ) - ], - ), - ); - } - - Widget _buildSectionSlider(BuildContext context) { - if (list.type == 'podcast') { - return Padding( - padding: const EdgeInsets.only(top: 28), - child: Column( - children: list.contents - .map( - (e) => Padding( - padding: const EdgeInsets.only( - bottom: 12, - left: 28, - right: 28, - ), - child: MainPagePodcastItem( - content: e, - ), - ), - ) - .toList(), - ), - ); - } - - return DidvanSlider( - height: 260 + (_maxSublistCount() - (list.type == 'radar' ? 1 : 0)) * 20, - itemCount: list.contents.length, - viewportFraction: isAnyMobile() ? 0.65 : 0.55, - itemBuilder: (context, index, realIndex) => Padding( - padding: const EdgeInsets.symmetric(horizontal: 4), - child: MainPageGeneralItem( - content: list.contents[index], - type: list.type, - ), - ), - ); - } } \ No newline at end of file diff --git a/lib/views/home/main/widgets/main_content.dart b/lib/views/home/main/widgets/main_content.dart index d0de86a..e413a59 100644 --- a/lib/views/home/main/widgets/main_content.dart +++ b/lib/views/home/main/widgets/main_content.dart @@ -1,4 +1,4 @@ -// ignore_for_file: deprecated_member_use +// // ignore_for_file: deprecated_member_use import 'package:didvan/config/theme_data.dart'; import 'package:didvan/views/home/main/widgets/banner.dart'; @@ -8,36 +8,35 @@ import 'package:flutter/material.dart'; class MainPageMainContent extends StatelessWidget { const MainPageMainContent({super.key}); - @override Widget build(BuildContext context) { - return Column( + return const Column( children: [ - const MainPageBanner( + MainPageBanner( isFirst: true, ), - const SizedBox(height: 28), - Center( - child: Container( - padding: const EdgeInsets.symmetric(horizontal: 12), - color: Theme.of(context).colorScheme.background, - child: DidvanText( - 'دیدوان در یک نگاه', - color: Theme.of(context).colorScheme.title, - style: Theme.of(context).textTheme.titleMedium, - ), - ), - ), - // ], + // const SizedBox(height: 28), + // Center( + // child: Container( + // padding: const EdgeInsets.symmetric(horizontal: 12), + // color: Theme.of(context).colorScheme.background, + // child: DidvanText( + // 'دیدوان در یک نگاه', + // color: Theme.of(context).colorScheme.title, + // style: Theme.of(context).textTheme.titleMedium, + // ), + // ), + // ), + // // ], + // // ), + // const Padding( + // padding: EdgeInsets.only( + // left: 20, + // right: 20, + // top: 16, + // ), + // child: SizedBox(), // ), - const Padding( - padding: EdgeInsets.only( - left: 20, - right: 20, - top: 16, - ), - child: MainCategories(), - ), ], ); } diff --git a/lib/views/widgets/didvan/bnb.dart b/lib/views/widgets/didvan/bnb.dart index b4faec8..43f5e55 100644 --- a/lib/views/widgets/didvan/bnb.dart +++ b/lib/views/widgets/didvan/bnb.dart @@ -56,11 +56,10 @@ class DidvanBNB extends StatelessWidget { title: 'هوشان', selectedIcon: DidvanIcons.ai_solid, unselectedIcon: DidvanIcons.ai_regular, - onTap: () => Navigator.of(context).pushNamed(Routes.aiSection), + onTap: () => Navigator.of(context).pushNamed(Routes.aiSection), + isHomeButton: false, customLogo: SvgPicture.asset( - DesignConfig.isDark - ? 'assets/images/logos/logo-vertical-dark.svg' - : 'lib/assets/icons/bot.svg', + 'lib/assets/icons/bot.svg', width: 32, height: 32, ), @@ -71,11 +70,11 @@ class DidvanBNB extends StatelessWidget { selectedIcon: DidvanIcons.house_solid, unselectedIcon: DidvanIcons.house_light, onTap: () => onTabChanged(0), - isHomeButton: true, + isHomeButton: false, customLogo: SvgPicture.asset( DesignConfig.isDark ? 'assets/images/logos/logo-vertical-dark.svg' - : 'lib/assets/icons/New Home.svg', + : 'lib/assets/icons/home2.svg', width: 32, height: 32, ), @@ -85,21 +84,27 @@ class DidvanBNB extends StatelessWidget { title: 'آمار و داده', selectedIcon: DidvanIcons.stats__solid, unselectedIcon: DidvanIcons.stats__light, - onTap: () => onTabChanged(2), + onTap: () => onTabChanged(2), + isHomeButton: false, customLogo: SvgPicture.asset( DesignConfig.isDark - ? 'assets/images/logos/logo-vertical-dark.svg' - : 'lib/assets/icons/bot.svg', + ? 'lib/assets/icons/stats_nav_icon_dark.svg' + : 'lib/assets/icons/chart 2.svg', width: 32, height: 32, ), ), _NavBarItem( - isSelected: false, - title: 'پروفایل', - selectedIcon: DidvanIcons.profile_solid, - unselectedIcon: DidvanIcons.profile_light, - onTap: () => Navigator.of(context).pushNamed(Routes.profile), + isSelected: currentTabIndex == 3, + title: 'کاوش', + selectedIcon: DidvanIcons.profile_solid, // Placeholder + unselectedIcon: DidvanIcons.profile_light, // Placeholder + onTap: () => onTabChanged(3), + customLogo: SvgPicture.asset( + 'lib/assets/icons/discover.svg', + width: 25, + height: 25, + ), ), ], ), @@ -149,29 +154,35 @@ class _NavBarItem extends StatelessWidget { const SizedBox( height: 4, ), - if (isHomeButton && customLogo != null) ...[ + if (customLogo != null) ...[ AnimatedContainer( - padding: const EdgeInsets.all(8), + padding: EdgeInsets.all(isHomeButton ? 8 : 4), duration: DesignConfig.lowAnimationDuration, child: SizedBox( - width: 50, - height: 50, + width: isHomeButton ? 50 : (isSelected ? 50 : 32), + height: isHomeButton ? 50 : (isSelected ? 50 : 32), child: customLogo, ), ), + if (!isHomeButton && !isSelected) + DidvanText( + title, + style: Theme.of(context).textTheme.bodySmall, + color: Theme.of(context).colorScheme.title, + ), ] else ...[ AnimatedContainer( padding: const EdgeInsets.all(4), duration: DesignConfig.lowAnimationDuration, child: Icon( isSelected ? selectedIcon : unselectedIcon, - size: 32, + size: isSelected ? 40 : 32, color: DesignConfig.isDark ? Theme.of(context).colorScheme.text : Theme.of(context).colorScheme.title, ), ), - if (!isHomeButton) + if (!isHomeButton && !isSelected) DidvanText( title, style: Theme.of(context).textTheme.bodySmall,