-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor and implement injured player flow * empty view in home screen running match * Fix score board state * pass value instead of state * remove force unwrap --------- Co-authored-by: cp-sneha-s <[email protected]>
- Loading branch information
1 parent
698b4d1
commit 98fa046
Showing
44 changed files
with
2,130 additions
and
1,710 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:khelo/domain/extensions/context_extensions.dart'; | ||
import 'package:style/extensions/context_extensions.dart'; | ||
import 'package:style/text/app_text_style.dart'; | ||
|
||
class WonByMessageText extends StatelessWidget { | ||
final String teamName; | ||
final int difference; | ||
final String trailingText; | ||
|
||
const WonByMessageText({ | ||
super.key, | ||
required this.teamName, | ||
required this.difference, | ||
required this.trailingText, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Text.rich(TextSpan( | ||
text: teamName, | ||
style: | ||
AppTextStyle.header4.copyWith(color: context.colorScheme.primary), | ||
children: [ | ||
TextSpan( | ||
text: context.l10n.score_board_won_by_title, | ||
style: AppTextStyle.subtitle2 | ||
.copyWith(color: context.colorScheme.textSecondary)), | ||
TextSpan( | ||
text: "$difference", | ||
), | ||
TextSpan( | ||
text: trailingText, | ||
), | ||
])); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
khelo/lib/domain/extensions/data_model_extensions/ball_score_model_extension.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:data/api/ball_score/ball_score_model.dart'; | ||
|
||
extension BallScoreModelBoolean on BallScoreModel? { | ||
bool? isLegalDelivery() { | ||
if (this == null) { | ||
return null; | ||
} | ||
return this!.extras_type != ExtrasType.penaltyRun && | ||
this!.extras_type != ExtrasType.noBall && | ||
this!.extras_type != ExtrasType.wide && | ||
this!.wicket_type != WicketType.timedOut && | ||
this!.wicket_type != WicketType.retired && | ||
this!.wicket_type != WicketType.retiredHurt; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
khelo/lib/domain/extensions/data_model_extensions/match_model_extension.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import 'package:data/api/match/match_model.dart'; | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:khelo/domain/extensions/context_extensions.dart'; | ||
|
||
extension MatchModelString on MatchModel { | ||
({String teamName, int difference, String wonByText})? getWinnerSummary( | ||
BuildContext context) { | ||
if (match_status != MatchStatus.finish) { | ||
return null; | ||
} | ||
|
||
final firstTeam = toss_decision == TossDecision.bat | ||
? teams.firstWhere((element) => element.team.id == toss_winner_id) | ||
: teams.firstWhere((element) => element.team.id != toss_winner_id); | ||
final secondTeam = | ||
teams.firstWhere((element) => element.team.id != firstTeam.team.id); | ||
|
||
if ((firstTeam.run ?? 0) > (secondTeam.run ?? 0)) { | ||
// first batting team won | ||
final teamName = firstTeam.team.name; | ||
|
||
final runDifference = (firstTeam.run ?? 0) - (secondTeam.run ?? 0); | ||
|
||
return ( | ||
teamName: teamName, | ||
difference: runDifference, | ||
wonByText: context.l10n.common_runs_dot_title, | ||
); | ||
} else { | ||
// second batting team won | ||
final teamName = secondTeam.team.name; | ||
|
||
final wicketDifference = | ||
secondTeam.squad.length - (firstTeam.wicket ?? 0); | ||
|
||
return ( | ||
teamName: teamName, | ||
difference: wicketDifference, | ||
wonByText: context.l10n.common_wickets_dot_title, | ||
); | ||
} | ||
} | ||
} |
Oops, something went wrong.