Skip to content

Commit

Permalink
Fix showing wrong month in month view, closes #28
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Oct 20, 2023
1 parent eeff292 commit 8d078a0
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 57 deletions.
8 changes: 4 additions & 4 deletions app/lib/pages/calendar/month.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class _CalendarMonthViewState extends State<CalendarMonthView> {
_now.hour,
_now.minute,
_now.second,
).nextStartOfWeek.addDays(-7 + _startOfWeek);
).nextStartOfWeek.addDays(_startOfWeek - 7);

int _getDaysInView() => 6 * 7;

Expand Down Expand Up @@ -150,8 +150,8 @@ class _CalendarMonthViewState extends State<CalendarMonthView> {
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();
Expand All @@ -163,7 +163,7 @@ class _CalendarMonthViewState extends State<CalendarMonthView> {
),
GestureDetector(
child: Text(
DateFormat.yMMMM(locale).format(_date),
DateFormat.yMMMM(locale).format(_date.addDays(7)),
textAlign: TextAlign.center,
),
onTap: () async {
Expand Down
4 changes: 3 additions & 1 deletion app/lib/pages/calendar/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ class _CalendarPageState extends State<CalendarPage>
if (isSmall) ...[
MenuAnchor(
builder: defaultMenuButton(
_calendarView.icon(PhosphorIconsStyle.light)),
icon:
PhosphorIcon(_calendarView.icon(PhosphorIconsStyle.light)),
),
menuChildren: _CalendarView.values
.map((e) => MenuItemButton(
leadingIcon:
Expand Down
2 changes: 1 addition & 1 deletion app/lib/pages/dashboard/notes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<DashboardNotesCard> createState() => _DashboardNotesCardState();
Expand Down
2 changes: 1 addition & 1 deletion app/lib/pages/dashboard/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions app/lib/pages/groups/tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions app/lib/pages/places/tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions app/lib/pages/users/tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
63 changes: 21 additions & 42 deletions app/lib/visualizer/sync.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}
2 changes: 1 addition & 1 deletion app/scripts/start.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@ECHO OFF
START "" "%~dp0flow.exe" --path "%~dp0Data"
START "" "%~dp0flow.exe" --path "%~dp0UserData"
2 changes: 1 addition & 1 deletion app/scripts/start.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
./flow --path ./Data
./flow --path ./UserData
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/6.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 8d078a0

Please sign in to comment.