mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Use clock package in workout_logs.dart
This is needed in order to be able to mock the current time in the tests
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:clock/clock.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:table_calendar/table_calendar.dart';
|
||||
import 'package:wger/helpers/consts.dart';
|
||||
@@ -98,7 +99,7 @@ class WorkoutLogCalendar extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _WorkoutLogCalendarState extends State<WorkoutLogCalendar> {
|
||||
DateTime _focusedDay = DateTime.now();
|
||||
DateTime _focusedDay = clock.now();
|
||||
DateTime? _selectedDay;
|
||||
late final ValueNotifier<List<WorkoutLogEvent>> _selectedEvents;
|
||||
late Map<String, List<WorkoutLogEvent>> _events;
|
||||
@@ -152,8 +153,8 @@ class _WorkoutLogCalendarState extends State<WorkoutLogCalendar> {
|
||||
children: [
|
||||
TableCalendar(
|
||||
locale: Localizations.localeOf(context).languageCode,
|
||||
firstDay: DateTime.now().subtract(const Duration(days: 1000)),
|
||||
lastDay: DateTime.now(),
|
||||
firstDay: clock.now().subtract(const Duration(days: 1000)),
|
||||
lastDay: clock.now(),
|
||||
focusedDay: _focusedDay,
|
||||
selectedDayPredicate: (day) => isSameDay(_selectedDay, day),
|
||||
calendarFormat: CalendarFormat.month,
|
||||
|
||||
Reference in New Issue
Block a user