Skip to content

Commit

Permalink
Add day delete option
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhil-RGB committed Nov 12, 2024
1 parent 51de6a0 commit 2fbca96
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/models/DailyInfoList.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@ class DailyInfoList {
void removeGamingSession(int index) {
gamesPlayed.removeAt(index);
}

//Clear the game list
void clear() {
gamesPlayed.clear();
}
}
22 changes: 22 additions & 0 deletions lib/pages/DailyGamesPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,28 @@ class _DailyGamePageState extends State<DailyGamePage> {
DailyInfoList gamesPlayed = DailyInfoList.fromDate(widget.referenceDay);
return SafeArea(
child: Scaffold(
extendBodyBehindAppBar: true,
appBar: (gamesPlayed.gamesPlayed.isEmpty)
? null
: AppBar(
scrolledUnderElevation: 0.0,
backgroundColor: Colors.transparent,
elevation: 0.0,
//This button will delete the entire day's game data
actions: [
IconButton(
onPressed: () {
setState(() {
gamesPlayed.clear();
gamesPlayed.updateInfo();
});
},
icon: const Icon(
Icons.delete_forever_outlined,
color: Colors.red,
))
],
),
body: Center(
child:
//add ternary operator check here for games played.
Expand Down

0 comments on commit 2fbca96

Please sign in to comment.