Skip to content

Commit

Permalink
Merge pull request #64 from canopas/Mayank/sticky-add-member-btn
Browse files Browse the repository at this point in the history
Sticky add member btn
  • Loading branch information
cp-mayank authored Jul 1, 2024
2 parents f394015 + b8182f3 commit 1f20b76
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 35 deletions.
2 changes: 2 additions & 0 deletions khelo/assets/locales/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
Expand All @@ -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),
)
],
),
),
);
}
Expand Down
1 change: 0 additions & 1 deletion khelo/lib/ui/flow/team/detail/team_detail_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ class _TeamDetailScreenState extends ConsumerState<TeamDetailScreen> {
children: [
const SizedBox(height: 16),
_tabView(context),
const SizedBox(height: 16),
_content(context),
],
),
Expand Down

0 comments on commit 1f20b76

Please sign in to comment.