diff --git a/khelo/assets/locales/app_en.arb b/khelo/assets/locales/app_en.arb index 2b523e03..3fd97276 100644 --- a/khelo/assets/locales/app_en.arb +++ b/khelo/assets/locales/app_en.arb @@ -237,8 +237,10 @@ "team_detail_member_tab_title": "Member", "team_detail_empty_matches_title": "No matches scheduled yet!", "team_detail_empty_matches_description_text": "Get your cricket game on! Schedule your cricket match with ease!", + "team_detail_visitor_empty_matches_description_text": "Until now, the team has not competed.", "team_detail_empty_member_title": "You haven't any member!", "team_detail_empty_member_description_text": "Invite your friends to build your dream team and start tracking matches together.", + "team_detail_visitor_empty_member_description_text": "No member has been added to the team.", "team_detail_empty_stat_title": "No stats available yet!", "team_detail_empty_stat_description_text": "The players are warming up! Stay tuned for exciting stats as the team progresses.", "team_detail_add_member_title": "Add member", diff --git a/khelo/lib/ui/flow/team/detail/components/team_detail_match_content.dart b/khelo/lib/ui/flow/team/detail/components/team_detail_match_content.dart index c8c8ae74..ac79fc9c 100644 --- a/khelo/lib/ui/flow/team/detail/components/team_detail_match_content.dart +++ b/khelo/lib/ui/flow/team/detail/components/team_detail_match_content.dart @@ -46,7 +46,10 @@ class TeamDetailMatchContent extends ConsumerWidget { } else { return EmptyScreen( title: context.l10n.team_detail_empty_matches_title, - description: context.l10n.team_detail_empty_matches_description_text, + description: (state.team?.created_by == state.currentUserId) + ? context.l10n.team_detail_empty_matches_description_text + : context.l10n.team_detail_visitor_empty_matches_description_text, + isShowButton: state.team?.created_by == state.currentUserId, buttonTitle: context.l10n.add_match_screen_title, onTap: () async { bool? isUpdated = await AppRoute.addMatch( diff --git a/khelo/lib/ui/flow/team/detail/components/team_detail_member_content.dart b/khelo/lib/ui/flow/team/detail/components/team_detail_member_content.dart index 9f49c314..b5675b7b 100644 --- a/khelo/lib/ui/flow/team/detail/components/team_detail_member_content.dart +++ b/khelo/lib/ui/flow/team/detail/components/team_detail_member_content.dart @@ -20,29 +20,38 @@ class TeamDetailMemberContent extends ConsumerWidget { if (state.team?.players != null && state.team?.players?.isNotEmpty == true) { - return ListView.separated( - padding: const EdgeInsets.all(16), - itemCount: state.team!.players!.length + 1, - itemBuilder: (context, index) { - if (index == 0) { - return _addMemberButton( + return Column( + children: [ + if (state.team!.created_by == state.currentUserId) ...[ + _addMemberButton( context, onTap: () => AppRoute.addTeamMember(team: state.team!).push(context), - ); - } - final member = state.team!.players![index - 1]; - return UserDetailCell( - user: member, - onTap: () => UserDetailSheet.show(context, member), - showPhoneNumber: false); - }, - separatorBuilder: (context, index) => const SizedBox(height: 16), + ), + ], + Expanded( + child: ListView.separated( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + itemCount: state.team!.players!.length, + itemBuilder: (context, index) { + final member = state.team!.players![index]; + return UserDetailCell( + user: member, + onTap: () => UserDetailSheet.show(context, member), + showPhoneNumber: false); + }, + separatorBuilder: (context, index) => const SizedBox(height: 16), + ), + ), + ], ); } else { return EmptyScreen( title: context.l10n.team_detail_empty_member_title, - description: context.l10n.team_detail_empty_member_description_text, + description: state.team!.created_by == state.currentUserId + ? context.l10n.team_detail_empty_member_description_text + : context.l10n.team_detail_visitor_empty_member_description_text, + isShowButton: state.team!.created_by == state.currentUserId, buttonTitle: context.l10n.team_list_add_members_title, onTap: () => AppRoute.addTeamMember(team: state.team!).push(context), ); @@ -52,24 +61,27 @@ class TeamDetailMemberContent extends ConsumerWidget { Widget _addMemberButton(BuildContext context, {required Function() onTap}) { return OnTapScale( onTap: onTap, - child: Row( - children: [ - CircleAvatar( - radius: 20, - backgroundColor: context.colorScheme.containerLow, - child: Icon( - Icons.add, - size: 24, - color: context.colorScheme.primary, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8), + child: Row( + children: [ + CircleAvatar( + radius: 20, + backgroundColor: context.colorScheme.containerLow, + child: Icon( + Icons.add, + size: 24, + color: context.colorScheme.primary, + ), ), - ), - const SizedBox(width: 10), - Text( - context.l10n.team_detail_add_member_title, - style: AppTextStyle.subtitle2 - .copyWith(color: context.colorScheme.primary), - ) - ], + const SizedBox(width: 10), + Text( + context.l10n.team_detail_add_member_title, + style: AppTextStyle.subtitle2 + .copyWith(color: context.colorScheme.primary), + ) + ], + ), ), ); } diff --git a/khelo/lib/ui/flow/team/detail/team_detail_screen.dart b/khelo/lib/ui/flow/team/detail/team_detail_screen.dart index 1389da93..1d05b971 100644 --- a/khelo/lib/ui/flow/team/detail/team_detail_screen.dart +++ b/khelo/lib/ui/flow/team/detail/team_detail_screen.dart @@ -131,7 +131,6 @@ class _TeamDetailScreenState extends ConsumerState { children: [ const SizedBox(height: 16), _tabView(context), - const SizedBox(height: 16), _content(context), ], ),