Skip to content

Commit

Permalink
1.11.1 - Adding notes when logging a game in the past (#203)
Browse files Browse the repository at this point in the history
* progress on giving an ability to add notes when logging  a game in the past

* ironing out adding ntoes

* updating android mockups

* updating iOS related mockups

* improving performance of the historical playthroughs page

* updating bottom sheet UI

* fixing padding when no expansions on the details page
  • Loading branch information
mkieres authored Jul 2, 2023
1 parent 4073ab2 commit e028ade
Show file tree
Hide file tree
Showing 37 changed files with 1,830 additions and 805 deletions.
Binary file not shown.
6 changes: 3 additions & 3 deletions board_games_companion/lib/app.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:animations/animations.dart';
import 'package:basics/basics.dart';
import 'package:board_games_companion/models/hive/playthrough_note.dart';
import 'package:firebase_analytics/observer.dart';
import 'package:flutter/material.dart';

Expand Down Expand Up @@ -151,10 +152,9 @@ class BoardGamesCompanionAppState extends State<BoardGamesCompanionApp> {
case PlaythroughNotePage.pageRoute:
final arguments = routeSettings.arguments as PlaythroughNotePageArguments;
final viewModel = getIt<PlaythroughNoteViewModel>();
viewModel.setPlaythrough(arguments.playthrough);
viewModel.setNoteId(arguments.noteId);
viewModel.setNote(arguments.note);

return MaterialPageRoute<dynamic>(
return MaterialPageRoute<PlaythroughNote?>(
settings: routeSettings,
builder: (BuildContext context) => PlaythroughNotePage(viewModel: viewModel),
);
Expand Down
2 changes: 2 additions & 0 deletions board_games_companion/lib/common/app_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class AppText {
static const playthroughsLogDateSectionTitle = 'Date';
static const playthroughsLogDurationSectionTitle = 'Duration';
static const playthroughsLogPlayersSectionTitle = 'Players';
static const playthroughsLogNotesSectionTitle = 'Notes';
static const playthroughsLogCooperativeResultSectionTitle = 'Result';
static const playthroughsLogPlayersPlayingNowButtonText = 'Select players that are playing';
static const playthroughsLogPlayersPlayedInThePastButtonText = 'Select players that played';
Expand Down Expand Up @@ -187,6 +188,7 @@ class AppText {
static const editPlaythroughNoScoreResultLossText = 'Loss';
static const editPlaythroughNoScorePlayersHeaderTitle = 'Players';
static const editPlaythroughNotesHeaderTitle = 'Notes';
static const editPlaythroughNoNotesText = 'Add notes about your game';
static const editPlaythroughPagePlayedOnSectionTitle = 'Played on';
static const editPlaythroughPageDurationSectionTitle = 'Duration';
static const editPlaythroughPageScoreSectionTitle = 'Score';
Expand Down
23 changes: 23 additions & 0 deletions board_games_companion/lib/extensions/date_time_extensions.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import 'package:board_games_companion/extensions/string_extensions.dart';
import 'package:intl/intl.dart';
import 'package:sprintf/sprintf.dart';

import '../common/app_text.dart';
import '../common/constants.dart';

final DateFormat historicalPlaythroughDateFormat = DateFormat('d MMMM y');

extension DateTimeExtensions on DateTime? {
String toShortMonth([String? fallbackValue]) {
if (this == null) {
Expand Down Expand Up @@ -39,6 +42,26 @@ extension DateTimeExtensions on DateTime? {
return sprintf(AppText.daysAgoFormat, [daysAgo]);
}

String toHistoricalPlaythroughHeaderFormat() {
if (this == null) {
return '';
}

if (isToday) {
return AppText.today.toCapitalized();
}

if (isYesterday) {
return AppText.yesteday.toCapitalized();
}

if (isDayBeforeYesterday) {
return AppText.dayBeforeYesteday.toCapitalized();
}

return historicalPlaythroughDateFormat.format(this!);
}

int get daysAgo {
final nowUtc = DateTime.now().toUtc();
return nowUtc.difference(this!).inDays;
Expand Down
Loading

0 comments on commit e028ade

Please sign in to comment.