Skip to content

Commit

Permalink
Merge pull request #127 from COS301-SE-2024/cleanup/generalFinalization
Browse files Browse the repository at this point in the history
Cleanup/general finalization
  • Loading branch information
RhevanKruger authored Sep 29, 2024
2 parents c84bb8b + 9ad0ea6 commit 685702a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions frontend/lib/pages/camera.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class _CameraPageState extends State<CameraPage> {
AudioRecorder audioRecorder = AudioRecorder();
String audioMoodWeight = '';
bool audioReady = false;
int photoCount = 0;
bool disabledButton = false;


final List<String> modes = ["Photo", "Video", "Audio"];
Expand Down Expand Up @@ -94,10 +94,13 @@ class _CameraPageState extends State<CameraPage> {
void _handleButtonPress() async {
if (mode == "Video") {
setState(() async {
innerCircleSize = innerCircleSize == 50.0 ? 60.0 : 50.0;
innerCircleColor = innerCircleSize == 50.0 ? Colors.red : Colors.white;
_audioRecord(true);
_recordRealTime(); // Toggle real-time recording
if(!disabledButton) {
innerCircleSize = innerCircleSize == 50.0 ? 60.0 : 50.0;
innerCircleColor =
innerCircleSize == 50.0 ? Colors.red : Colors.white;
_audioRecord(true);
_recordRealTime(); // Toggle real-time recording
}
});
} else if (mode == "Photo") {
setState(() {
Expand Down Expand Up @@ -158,6 +161,7 @@ class _CameraPageState extends State<CameraPage> {
if (isRecording) {
// Stop recording
setState(() async {
disabledButton = true;
isRecording = false; // Stop recording
captureTimer?.cancel(); // Stop the timer
print("Recording stopped. Moods: $returnedMoods");
Expand All @@ -176,6 +180,7 @@ class _CameraPageState extends State<CameraPage> {
await Future.delayed(Duration(milliseconds: 100)); // Check every 100ms
count += 1;
}
disabledButton = false;
await _navigateToConfirmationPage(); // Proceed to confirmation if a picture exists
}
});
Expand Down

0 comments on commit 685702a

Please sign in to comment.