Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Arun Muralidharan - <https://github.com/arun-muralidharan>
* Khushbu Bora - <https://github.com/KhushbuBora>
* Patrick Witter - <https://github.com/patrickwitter>
* Tomer Ben-Rachel - <https://github.com/tomerpacific>
* Thilina Herath - <https://github.com/ThilinaTCH>

## Translators
Expand Down
5 changes: 5 additions & 0 deletions lib/models/workouts/session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ class WorkoutSession {
required this.timeEnd,
});

WorkoutSession.now(){
timeStart = TimeOfDay.now();
timeEnd = TimeOfDay.now();
}

// Boilerplate
factory WorkoutSession.fromJson(Map<String, dynamic> json) => _$WorkoutSessionFromJson(json);
Map<String, dynamic> toJson() => _$WorkoutSessionToJson(this);
Expand Down
13 changes: 9 additions & 4 deletions lib/widgets/workouts/gym_mode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ class _SessionPageState extends State<SessionPage> {
final timeStartController = TextEditingController();
final timeEndController = TextEditingController();

final _session = WorkoutSession();
final _session = WorkoutSession.now();

/// Selected impression: bad, neutral, good
var selectedImpression = [false, true, false];
Expand Down Expand Up @@ -804,11 +804,12 @@ class _SessionPageState extends State<SessionPage> {
// Open time picker
final pickedTime = await showTimePicker(
context: context,
initialTime: widget._start,
initialTime: _session.timeStart,
);

if (pickedTime != null) {
timeStartController.text = timeToString(pickedTime)!;
_session.timeStart = pickedTime;
}
},
onSaved: (newValue) {
Expand Down Expand Up @@ -836,10 +837,14 @@ class _SessionPageState extends State<SessionPage> {
// Open time picker
final pickedTime = await showTimePicker(
context: context,
initialTime: TimeOfDay.now(),
initialTime: _session.timeEnd,
);

timeEndController.text = timeToString(pickedTime)!;
if (pickedTime != null) {
timeEndController.text = timeToString(pickedTime)!;
_session.timeEnd = pickedTime;
}

},
onSaved: (newValue) {
_session.timeEnd = stringToTime(newValue);
Expand Down