From 8d078a0f3a212457166756332c57ef110df27e66 Mon Sep 17 00:00:00 2001 From: CodeDoctorDE Date: Fri, 20 Oct 2023 14:01:15 +0200 Subject: [PATCH] Fix showing wrong month in month view, closes #28 --- app/lib/pages/calendar/month.dart | 8 +-- app/lib/pages/calendar/page.dart | 4 +- app/lib/pages/dashboard/notes.dart | 2 +- app/lib/pages/dashboard/page.dart | 2 +- app/lib/pages/groups/tile.dart | 4 +- app/lib/pages/places/tile.dart | 4 +- app/lib/pages/users/tile.dart | 4 +- app/lib/visualizer/sync.dart | 63 +++++++------------ app/scripts/start.bat | 2 +- app/scripts/start.sh | 2 +- .../metadata/android/en-US/changelogs/6.txt | 1 + 11 files changed, 39 insertions(+), 57 deletions(-) diff --git a/app/lib/pages/calendar/month.dart b/app/lib/pages/calendar/month.dart index 1774df93a49..dd84c418652 100644 --- a/app/lib/pages/calendar/month.dart +++ b/app/lib/pages/calendar/month.dart @@ -57,7 +57,7 @@ class _CalendarMonthViewState extends State { _now.hour, _now.minute, _now.second, - ).nextStartOfWeek.addDays(-7 + _startOfWeek); + ).nextStartOfWeek.addDays(_startOfWeek - 7); int _getDaysInView() => 6 * 7; @@ -150,8 +150,8 @@ class _CalendarMonthViewState extends State { IconButton( icon: const PhosphorIcon(PhosphorIconsLight.calendarBlank), - isSelected: _date.year == DateTime.now().year && - _date.month == DateTime.now().month, + isSelected: _year == DateTime.now().year && + _month == DateTime.now().month, onPressed: () { setState(() { final now = DateTime.now(); @@ -163,7 +163,7 @@ class _CalendarMonthViewState extends State { ), GestureDetector( child: Text( - DateFormat.yMMMM(locale).format(_date), + DateFormat.yMMMM(locale).format(_date.addDays(7)), textAlign: TextAlign.center, ), onTap: () async { diff --git a/app/lib/pages/calendar/page.dart b/app/lib/pages/calendar/page.dart index 6563899092f..2ec2f1952bf 100644 --- a/app/lib/pages/calendar/page.dart +++ b/app/lib/pages/calendar/page.dart @@ -77,7 +77,9 @@ class _CalendarPageState extends State if (isSmall) ...[ MenuAnchor( builder: defaultMenuButton( - _calendarView.icon(PhosphorIconsStyle.light)), + icon: + PhosphorIcon(_calendarView.icon(PhosphorIconsStyle.light)), + ), menuChildren: _CalendarView.values .map((e) => MenuItemButton( leadingIcon: diff --git a/app/lib/pages/dashboard/notes.dart b/app/lib/pages/dashboard/notes.dart index 1d49e2b9ab8..60f5bb46ef2 100644 --- a/app/lib/pages/dashboard/notes.dart +++ b/app/lib/pages/dashboard/notes.dart @@ -9,7 +9,7 @@ import '../../cubits/flow.dart'; import '../../widgets/markdown_field.dart'; class DashboardNotesCard extends StatefulWidget { - const DashboardNotesCard({Key? key}) : super(key: key); + const DashboardNotesCard({super.key}); @override State createState() => _DashboardNotesCardState(); diff --git a/app/lib/pages/dashboard/page.dart b/app/lib/pages/dashboard/page.dart index b53e92a627b..0e331eb4eeb 100644 --- a/app/lib/pages/dashboard/page.dart +++ b/app/lib/pages/dashboard/page.dart @@ -6,7 +6,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'events.dart'; class DashboardPage extends StatefulWidget { - const DashboardPage({Key? key}) : super(key: key); + const DashboardPage({super.key}); @override _DashboardPageState createState() => _DashboardPageState(); diff --git a/app/lib/pages/groups/tile.dart b/app/lib/pages/groups/tile.dart index ee21ed67c48..77848852608 100644 --- a/app/lib/pages/groups/tile.dart +++ b/app/lib/pages/groups/tile.dart @@ -15,12 +15,12 @@ import 'group.dart'; class GroupTile extends StatelessWidget { const GroupTile({ - Key? key, + super.key, required this.source, required this.group, required this.flowCubit, required this.pagingController, - }) : super(key: key); + }); final FlowCubit flowCubit; final Group group; diff --git a/app/lib/pages/places/tile.dart b/app/lib/pages/places/tile.dart index 94cc814a009..c7a5173914e 100644 --- a/app/lib/pages/places/tile.dart +++ b/app/lib/pages/places/tile.dart @@ -14,12 +14,12 @@ import 'place.dart'; class PlaceTile extends StatelessWidget { const PlaceTile({ - Key? key, + super.key, required this.source, required this.place, required this.flowCubit, required this.pagingController, - }) : super(key: key); + }); final FlowCubit flowCubit; final Place place; diff --git a/app/lib/pages/users/tile.dart b/app/lib/pages/users/tile.dart index 0b57ee49e26..40c1d3e5216 100644 --- a/app/lib/pages/users/tile.dart +++ b/app/lib/pages/users/tile.dart @@ -14,12 +14,12 @@ import 'user.dart'; class UserTile extends StatelessWidget { const UserTile({ - Key? key, + super.key, required this.source, required this.user, required this.flowCubit, required this.pagingController, - }) : super(key: key); + }); final FlowCubit flowCubit; final User user; diff --git a/app/lib/visualizer/sync.dart b/app/lib/visualizer/sync.dart index 5a387ae71b0..44b5fdfbd89 100644 --- a/app/lib/visualizer/sync.dart +++ b/app/lib/visualizer/sync.dart @@ -6,51 +6,30 @@ import 'package:phosphor_flutter/phosphor_flutter.dart'; import '../cubits/settings.dart'; extension SyncStatusVisualizer on SyncStatus? { - String getLocalizedName(BuildContext context) { - switch (this) { - case SyncStatus.syncing: - return AppLocalizations.of(context).syncing; - case SyncStatus.synced: - return AppLocalizations.of(context).synced; - case SyncStatus.error: - return AppLocalizations.of(context).error; - default: - return AppLocalizations.of(context).loading; - } - } + String getLocalizedName(BuildContext context) => switch (this) { + SyncStatus.syncing => AppLocalizations.of(context).syncing, + SyncStatus.synced => AppLocalizations.of(context).synced, + SyncStatus.error => AppLocalizations.of(context).error, + _ => AppLocalizations.of(context).loading, + }; - IconGetter get icon { - switch (this) { - case SyncStatus.syncing: - return PhosphorIcons.arrowClockwise; - case SyncStatus.synced: - return PhosphorIcons.check; - default: - return PhosphorIcons.warningCircle; - } - } + IconGetter get icon => switch (this) { + SyncStatus.syncing => PhosphorIcons.arrowClockwise, + SyncStatus.synced => PhosphorIcons.check, + _ => PhosphorIcons.warningCircle, + }; } extension SyncModeVisualizer on SyncMode { - String getLocalizedName(BuildContext context) { - switch (this) { - case SyncMode.always: - return AppLocalizations.of(context).always; - case SyncMode.noMobile: - return AppLocalizations.of(context).noMobile; - case SyncMode.manual: - return AppLocalizations.of(context).manual; - } - } + String getLocalizedName(BuildContext context) => switch (this) { + SyncMode.always => AppLocalizations.of(context).always, + SyncMode.noMobile => AppLocalizations.of(context).noMobile, + SyncMode.manual => AppLocalizations.of(context).manual, + }; - IconGetter get icon { - switch (this) { - case SyncMode.always: - return PhosphorIcons.wifiHigh; - case SyncMode.noMobile: - return PhosphorIcons.deviceMobile; - case SyncMode.manual: - return PhosphorIcons.wifiX; - } - } + IconGetter get icon => switch (this) { + SyncMode.always => PhosphorIcons.wifiHigh, + SyncMode.noMobile => PhosphorIcons.deviceMobile, + SyncMode.manual => PhosphorIcons.wifiX, + }; } diff --git a/app/scripts/start.bat b/app/scripts/start.bat index 245ba2ef854..6da2c1134d4 100644 --- a/app/scripts/start.bat +++ b/app/scripts/start.bat @@ -1,2 +1,2 @@ @ECHO OFF -START "" "%~dp0flow.exe" --path "%~dp0Data" +START "" "%~dp0flow.exe" --path "%~dp0UserData" diff --git a/app/scripts/start.sh b/app/scripts/start.sh index 9763c1595ed..3fb65c80867 100644 --- a/app/scripts/start.sh +++ b/app/scripts/start.sh @@ -1,2 +1,2 @@ #!/bin/sh -./flow --path ./Data +./flow --path ./UserData diff --git a/fastlane/metadata/android/en-US/changelogs/6.txt b/fastlane/metadata/android/en-US/changelogs/6.txt index 17b29ad7558..ab63079a226 100644 --- a/fastlane/metadata/android/en-US/changelogs/6.txt +++ b/fastlane/metadata/android/en-US/changelogs/6.txt @@ -1,6 +1,7 @@ * Add macos and rpm builds * Make calendar views switcher smaller * Disable PrivilegesRequired in windows setup ([#23](https://github.com/LinwoodDev/Flow/issues/23))* Fix portable build +* Fix showing wrong month in month view ([#28](https://github.com/LinwoodDev/Flow/issues/28)) * Fix portable build * Fix file name in start.sh * Add executable permission on linux