-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from dillonfagan/dev
v1.2 - Bug Fixes, Code Cleanup
- Loading branch information
Showing
11 changed files
with
219 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'package:audioplayers/audioplayers.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
|
||
class Alarm { | ||
static final AudioPlayer audioPlayer = AudioPlayer(playerId: '#alarm'); | ||
|
||
void play() async { | ||
if (kDebugMode) { | ||
return; | ||
} | ||
|
||
await audioPlayer.play( | ||
UrlSource('sounds/alarm.mp3'), | ||
volume: 1.0, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
|
||
final secondsProvider = StateProvider<int>((ref) => 0); | ||
|
||
final timerProvider = StateProvider<Timer>((ref) { | ||
return Timer.periodic(const Duration(seconds: 1), (timer) { | ||
timer.cancel(); | ||
}); | ||
}); | ||
|
||
Timer getTimer(Ref ref, Function() onStop) { | ||
return Timer.periodic( | ||
const Duration(seconds: 1), | ||
(timer) { | ||
if (ref.read(secondsProvider) <= 0) { | ||
onStop(); | ||
return; | ||
} | ||
|
||
ref.read(secondsProvider.notifier).state -= 1; | ||
}, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,3 @@ | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
|
||
class TurnsNotifier extends Notifier<int> { | ||
@override | ||
int build() { | ||
return 0; | ||
} | ||
|
||
void reset() { | ||
state = 0; | ||
} | ||
} | ||
|
||
final turnsProvider = NotifierProvider<TurnsNotifier, int>(TurnsNotifier.new); | ||
final turnsProvider = StateProvider<int>((ref) => 0); |
Oops, something went wrong.