Score your Cricket Matches as you play them and track the statistics!
Scorecard is a mobile application that helps you record matches on a ball-by-ball basis for easier score-keeping and tracking of statistics, all while enjoying the sport with your friends and family.
As this application is programmed in Flutter, you can perform the common steps to build and run a flutter application.
-
If you don't have Flutter SDK installed, please visit official Flutter site.
-
Fetch latest source code from master branch.
git clone https://github.com/PlayPratz/Scorecard.git
- Run the app with Android Studio or VS Code. Or the command line:
flutter pub get
flutter run
A Cricket Match is represented by the following constructs or concepts:
It's a match played between two teams. What more can I say? Maybe a lot more; will expand on this later on.
An innings is one division of a cricket match where one team bats while the other team bowls and fields. Throughout this app, an "innings" refers only to a team's innings; batter innings and bowler innings are mentioned as such.
Technically speaking, an innings is essentially a list of balls played; all other information can be derived from that. (Note: It could also be a list of overs but it was simpler to skip that layer). This derived information includes (but is not limited to):
- Runs scored by the batting team
- Wickets fallen of the batting team
- Batter innings, i.e., scores of all batters
- Bowler innings, i.e., bowling figures of all bowlers
Batter innings and bowler innings form the building blocks for all player-centric statistics in cricket.
An innings comes to an end when any one of the following happens:
- The quota of overs is completed (in case of limited overs)
- The batting team loses all wickets
- The batting team has scored the required runs (while chasing)
- The batting team declares
To support dynamic teams (the most common form when cricket is played recreationally), the app does not take into account the 2nd condition. To accommodate the same, the user may choose to declare the innings once all wickets have fallen. Once support for unlimited overs is added, the process of declaring an innings will change.
A batter's innings, also called a knock, consists of a list of balls played by that batter. Using this, we can derive the following data:
- Runs scored
- Number of balls faced
Using the above data, the following statistics can be calculated:
- Strike rate
(runs scored)รท(number of balls faced)
A bowler's innings, also called a spell, consists of a list of balls delivered by that bowler. Using this, we can derive the following data:
- Number of overs (or balls) bowled
- Number of wickets taken
- Runs conceded
- Maidens bowled
Using the above data, the following statistics can be calculated:
- Strike rate
(number of balls bowled)รท(number of wickets taken)
- Average
(runs conceded)รท(number of wickets taken)
- Economy
[(runs conceded) * (number of balls per over)]รท(number of balls bowled)
A ball is the most atomic unit for scoring a cricket match. It consists of the following data:
- Bowler
- Batter
- Runs scored
- Wicket, if any
- Extra, if any
Once this data is obtained for every ball of the match, the score as well as result (if the match is completed) can be derived.
A player is needed to play any sport. Players in cricket take up the role of a batter, bowler and fielder. Since players contribute in more than one way, tying together their statistics provides a handy way of representing a player's career performance.
As it stands, you can create as many players as you like but deleting a player is not possible. This is because if a player has been part of even a single match, deleting that player is not possible, as the match cannot have a non-existent player.
TODO: This section will be expanded.
Once the above information is consolidated, statistics can be generated.
TODO: This section will be expanded
The Home Screen consists of the following tabs:
A new match can be created using the โจ button located at the center of the Bottom Navigation Bar.
This tab displays a list of all matches that are ongoing, i.e., have been created but not completed. It is a handy view of all matches that are being played at the moment. It might seem unnecessary for now, but once online syncing is added, a user will be able to see all the matches that are available to them.
Similarly, the next tab displays a list of matches that have been completed.
Every match is represented by a tile displaying the scores of both the teams participating in the match. Clicking a tile will open a new page depending on the status of the match. These pages correspond to the lifecycle of a match, which is as follows:
Needless to say, every match in the Completed Matches section will directly open its scorecard.
Long-pressing any match tile will bring up a menu where you can choose to:
- Rematch โ Quickly create a new match with the same teams. Note that this new match will be completely unrelated to the selected match.
- Delete โ Irreversibly delete the match from storage. Please understand the consequences of this action: ALL STATISTICS FROM THIS MATCH WILL BE DELETED FOREVER! Hence, it is highly recommended to never delete matches unless absolutely necessary.
A match is played between two teams. These teams are (conveniently) called Home Team and Away Team.
Clicking on either the Home Team or Away Team tile will take you to the Team Creation page. On this page, you can choose your team's name, short name, captain and squad. On tapping the Captain or Add to Squad tile, you will be taken to a list of players. Here, tap the desired player or create one if needed.
For example, if I was creating Mumbai Indians, I would have the following data:
- Name: Mumbai Indians
- Short Name: MI
- Blue
- Captain: Rohit Sharma
- Squad: Jasprit Bumrah, Suryakumar Yadav, Ishan Kishan, Cameron Green, Tim David etc.
(Note: The captain is always part of squad. No need to add them again.)
Every cricket match starts with a toss. A toss is a simple procedure where one captain wins and chooses to either Bat or Field (Bowl) in the first innings. While not necessarily crucial to statistics, the toss can play an important part in the result of the match, making it a valuable piece of information to store.
Select the winning team and their choice. It's as simple as that.
Traditionally, tosses have been conducted by flipping a coin, although recreational matches may feature "Odd or Even" or "Stone-Paper-Scissors" (also called "Rock-Paper-Scissors") between the captains. In the future, a Conduct Toss feature might be added to the app, that will flip a virtual coin.
To initialize an innings, select the opening pair from the batting team and the opening bowler from the bowling team. Don't worry if there's an error, these can be changed on the next screen.
This is where the magic happens.
On the top, you can see the Score Summary in the form of two tiles representing the Home Team and Away Team. Depending on which innings is being played, the score Runs/Wickets
is displayed for the batting team and the overs bowled Over.Ball
is displayed for the bowling team. Tapping on the Score Summary will take you to the match's scorecard.
- For the first innings shows the Current Run Rate (CRR) and the Projected Score
- For the second innings shows the Current Run Rate (CRR), Runs Required and Balls Left. Tapping on the CRR box will toggle it to display the Required Run Rate (RRR) instead.
Next, we have the Players In Action pane, which represents the two batters on the pitch and the bowler who is currently bowling. The two batters are represented as tiles laid out vertically, directly below their team's tile as in the Score Summary header. Similarly, the bowler's tile is placed vertically below the fielding team's tile. In other words, players are of the Home Team are always on the left while players of the Away Team are always on the right, regardless of which team is batting in the ongoing innings.
The Batter Tiles serve an important purpose โ selecting the player who is on strike. Usually, this is handled automatically โ strike is rotated for odd number of runs and at the end of an over. However, there are possibilities of rules being altered and a '1D' or 3D' being added, in which case the strike will have to be changed manually. The score of each batter is displayed on the tile. For more details on the score, you can always open the Scorecard.
Long pressing a Batter Tile will allow you to replace the batter only if the said batter has not lost their wicket and has not faced a single ball. This functionality exists to fix any human error while initializing an innings. To retire a batter, use the Add Wicket option.
Long pressing a Bowler Tile will allow you to replace the bowler mid-over. Please note that replacing a bowler will NOT skip or restart the over. Just like international matches, the over will continue to be bowled by a different bowler. If you want to restart the over with another bowler, use the Undo button found in the Submit Input pane.
Next in line is the Recent Balls list, where the latest balls bowled are displayed for convenience. The number of balls visible depends on the screen size of the device. Clicking on this list will take you to the Innings Timeline. The Recent Balls list follows the same scheme as the Innings Timeline, so read that for more information.
To demarcate the beginning of an over, its first ball has its index in the bowling team's colour.
The next row consists of two mostly unrelated interactions:
- The End Innings button, which can also be called the Declare button. Clicking this will, well, do nothing. You will see a small message pop-up which tells you exactly what you have to do โ press and hold this button if you really want to end (or declare) the innings. The long-press instead of a tap is to prevent an accidental declaration (oops!).
- The Wicket tile, which lets you add a wicket to the ball that is currently being entered. On tapping this tile, you will be taken to a pretty self-explanatory screen where you choose the kind of dismissal (bowled, LBW, run-out etc.) and the players involved in said dismissal. To clear a wicket that has been selected, press and hold this tile before adding the ball.
The first section toggles between Batting Extras: Bye and Leg Bye. For the uninitiated, a Bye is a run scored by the batting team without a batter getting their bat on ball. But if they manage to get their body on ball before scoring the runs, it's called a Leg Bye. Note that in either case, even though the runs scored are awarded to the batting team, they aren't awarded to the batter.
Next up, we have the Event toggle which serves a very crucial purpose โ recording an event that takes place without a ball being bowled. A very common case is the run-out by the bowler at the non-striker before bowling the ball, as sensationalized by Ravichandran Ashwin when he dismissed Jos Buttler. This also comes in handy when you want to retire a batter.
The last section deals with Bowling Extras, the infamous No Balls and Wides. Do note that while entering this data you are NOT supposed to select the runs awarded to the batting team due to a Bowling Extra. If no runs are scored by the batting team on a No Ball or a Wide, choose 0 runs on the Run Chooser.
It's a list of number from 0 to 6 that represent the number of runs scored on the ball that is being entered. Numbers '4' and '6' are treated specially, since they represent the ever-so-famous boundaries loved by fans of cricket. As it stands, there is no distinction between scoring a four or actually running four runs.
As mentioned earlier, DO NOT select the runs awarded due to a Bowling Extra such as a wide or no ball. Those penalty runs are added automatically.
These two buttons do exactly opposite actions
The first one, Undo, as the name suggests, will undo the previous ball, i.e., make it as if it was never played. It is removed completely. Discarded. Shredded. Destroyed. Obliterated. As such, you can't "Undo" an "Undo", so don't undo what you don't want to undo. Don't request for a "Redo" feature, just be more careful. (Or do request, maybe I am underestimating the requirement.)
The second button takes on various forms depending on the situation.
- In most cases, it is an Add Ball button, that submits the data entered from Run Selector, Extra Selector and Add a wicket. This will cause the ball to be added into the innings. As result of this, the scores for both the teams and all the players involved will be updated.
- When an over is completed, it is a Select Bowler button. On clicking, you will be taken to the bowling squad to choose the next bowler.
- When a wicket falls, it is a Select Batter button. On clicking, you will be taken to the batting squad to choose the next batter.
- When the quota of overs is completed, or when the target for the second innings is achieved, it is an End Innings button which will act the same as long-pressing the End Innings button.
The Scorecard screen starts with a simple view of the overall scores of both the teams across all innings played all the way at the top.
If the match is completed, you will see the result of the match right below. This is skipped for Ongoing Matches.
Next, for each team's innings, a list of batter innings is displayed. For each Batter Innings, the following information is displayed from left to right:
- The batter's photo, if any
- The batter's name
- Right below the batter's name, their wicket status
- The batter's score - Runs, balls faced
- The batter's strike rate
- The number of fours and sixes hit, displayed inside circles of the respective colour
Next, we have a list of players from the batting team who did not bat.
Next, we have a table displaying the Fall of Wickets. Every row marks the index at which a wicket fell, the score at when that wicket fail, the batter who lost their wicket and their wicket's details.
Next, the list of bowler innings is displayed. For each Bowler Innings, the following information is displayed from left to right:
- The bowler's photo, if any
- The bowler's name
- The number of overs bowled
- The number of wickets taken, displayed inside a red circle
- The number of runs conceded
- The bowler's economy
Finally, a View Timeline button takes you to the Innings Timeline
This screen displays a vertical, chronological timeline of balls bowled in the innings, with the last ball at the bottom and the first ball at the top.
The timeline is segmented into overs.
Each over's segment starts with the Over's ordinal index. Each row represents a ball displaying the following data from left to right:
- The timestamp (in local time) at which the ball was bowled
- The Ball Symbol
- The Bowler and the Batter
- Wicket, if any
I really couldn't come up with a better name, but it's the shorthand representation of the ball with the following data
- The runs scored, denoted by a number in a circle
- The
Over.Ball
index of the ball, displayed directly below the run's circle
The circle's colour and the border of this circle gives a quick look at what transpired using the same colours as seen in Colour Lookup.
The circle's colour represents the boundary or wicket that transpired on the ball. The border represents a Bowling Extra and is absent if the ball is a legal delivery.
A simple management page where you can create and edit players.
Creating a player is simple: Tap the Add a Player tile and fill in the form with basic details such as Name, Batting arm, Bowling arm and style. You can also add a picture if you like (recommended!).
Note: Currently, deleting players is not an option because. Why? Here's a detailed explanation: Deleting a player that has played a match will cause disastrous consequences like a non-existent player bowling a ball or hitting a six. That's a nightmare. To avoid this, for now, players can't be deleted once created.
This is where you will see the statistics of all your players.
Right now, the page has been disabled.
With respect to a Ball:
The colours available for assigning to a Team:
- Add screenshots to README.md
- Add online syncing
- Add statistics and filters
- Add Settings and Customizations
- Add support for Test Matches (Unlimited Overs)
- Add Tournaments and Series
- Track multiple sports
- @PlayPratz - Ideation, Documentation and App Development