Skip to content

Commit

Permalink
Mr changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-mayank committed Nov 22, 2024
1 parent 5e0f9a9 commit 86fadbd
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions data/lib/api/ball_score/ball_score_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -818,8 +818,8 @@ extension BallScoreList on List<BallScoreModel> {
.where(
(element) =>
element.wicket_type != null &&
(element.wicket_type != WicketType.retired ||
element.wicket_type != WicketType.retiredHurt ||
(element.wicket_type != WicketType.retired &&
element.wicket_type != WicketType.retiredHurt &&
element.wicket_type != WicketType.timedOut),
)
.length;
Expand Down
10 changes: 7 additions & 3 deletions khelo/lib/components/image_picker_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import '../gen/assets.gen.dart';

class ImagePickerSheet extends ConsumerWidget {
static Future<T?> show<T>(
BuildContext context,
bool allowCrop, {
BuildContext context, {
required bool allowCrop,
bool cropOriginal = false,
}) {
HapticFeedback.mediumImpact();
Expand Down Expand Up @@ -169,7 +169,11 @@ class ImagePickerSheet extends ConsumerWidget {
),
IOSUiSettings(
title: context.l10n.image_picker_crop_image_title,
aspectRatioPresets: [CropAspectRatioPreset.square],
aspectRatioPresets: [
cropOriginal
? CropAspectRatioPreset.original
: CropAspectRatioPreset.square
],
),
WebUiSettings(context: context),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ class EditProfileScreen extends ConsumerWidget {
filePath: state.filePath,
isLoading: state.isImageUploading,
onEditButtonTap: () async {
final imagePath =
await ImagePickerSheet.show<String>(context, true);
final imagePath = await ImagePickerSheet.show<String>(
context,
allowCrop: true,
);
if (imagePath != null) {
notifier.onImageChange(imagePath);
}
Expand Down
10 changes: 7 additions & 3 deletions khelo/lib/ui/flow/team/add_team/add_team_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ class _AddTeamScreenState extends ConsumerState<AddTeamScreen> {
return Stack(
children: [
ListView(
padding: context.mediaQueryPadding + const EdgeInsets.all(16) + BottomStickyOverlay.padding,
padding: context.mediaQueryPadding +
const EdgeInsets.all(16) +
BottomStickyOverlay.padding,
children: [
ProfileImageAvatar(
size: profileViewHeight,
Expand All @@ -105,8 +107,10 @@ class _AddTeamScreenState extends ConsumerState<AddTeamScreen> {
imageUrl: state.editTeam?.profile_img_url,
filePath: state.filePath,
onEditButtonTap: () async {
final imagePath =
await ImagePickerSheet.show<String>(context, true);
final imagePath = await ImagePickerSheet.show<String>(
context,
allowCrop: true,
);
if (imagePath != null) {
notifier.onImageSelect(imagePath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class _AddTournamentScreenState extends ConsumerState<AddTournamentScreen> {
void _pickImage({bool isBanner = false}) async {
final imagePath = await ImagePickerSheet.show<String>(
context,
true,
allowCrop: true,
cropOriginal: isBanner,
);
if (imagePath != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ class TeamSelectionViewNotifier extends StateNotifier<TeamSelectionViewState> {

void onTeamCellTap(TeamModel team) {
state = state.copyWith(showSelectionError: false);
final playersCount =
(team.players.where((player) => player.user.isActive).toList()).length;

final isAlreadySelected =
state.selectedTeams.map((e) => e.id).contains(team.id);
Expand All @@ -113,6 +111,8 @@ class TeamSelectionViewNotifier extends StateNotifier<TeamSelectionViewState> {
if (isAlreadySelected) {
teams.removeWhere((e) => e.id == team.id);
} else {
final playersCount = team.players.where((player) => player.user.isActive).length;

if (playersCount >= 2) {
teams.add(team);
} else {
Expand Down

0 comments on commit 86fadbd

Please sign in to comment.