added rumble/vibration to notification page
This commit is contained in:
parent
51ccf45225
commit
5d7e480376
4 changed files with 25 additions and 2 deletions
|
@ -40,4 +40,5 @@
|
|||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
</application>
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
</manifest>
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:flutter_ringtone_player/flutter_ringtone_player.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pizzaplanner/entities/PizzaEvent.dart';
|
||||
import 'package:pizzaplanner/entities/PizzaRecipe/RecipeStep.dart';
|
||||
|
@ -9,6 +11,7 @@ import 'package:pizzaplanner/main.dart';
|
|||
import 'package:pizzaplanner/pages/RecipeStepInstructionPage.dart';
|
||||
|
||||
import 'package:timezone/timezone.dart' as tz;
|
||||
import 'package:vibration/vibration.dart';
|
||||
|
||||
|
||||
|
||||
|
@ -40,6 +43,16 @@ class PizzaEventNotificationState extends State<PizzaEventNotificationPage> {
|
|||
|
||||
pizzaEvent = pizzaEventsBox.get(pizzaEventId)!;
|
||||
recipeStep = pizzaEvent.recipe.recipeSteps[recipeStepId];
|
||||
|
||||
FlutterRingtonePlayer.stop();
|
||||
Vibration.cancel();
|
||||
|
||||
FlutterRingtonePlayer.playNotification(looping: true);
|
||||
Vibration.hasVibrator().then((hasVibrator) {
|
||||
if(hasVibrator != null && hasVibrator){
|
||||
Vibration.vibrate(duration: 10000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -139,6 +152,13 @@ class PizzaEventNotificationState extends State<PizzaEventNotificationPage> {
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> dispose() async {
|
||||
FlutterRingtonePlayer.stop();
|
||||
Vibration.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
AlertDialog buildIgnoreDialog(){
|
||||
return AlertDialog(
|
||||
|
|
|
@ -47,6 +47,9 @@ dependencies:
|
|||
flutter_markdown: ^0.6.4
|
||||
url_launcher: ^6.0.9
|
||||
|
||||
flutter_ringtone_player: ^3.0.0
|
||||
vibration: ^1.7.4-nullsafety.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
|
3
todo.md
3
todo.md
|
@ -1,9 +1,8 @@
|
|||
# TODO
|
||||
|
||||
## Feature
|
||||
- add rumbling/sound to notifaction screen
|
||||
- add settings page
|
||||
- option for type of notifaction, full screen or just in the appbar
|
||||
- option for type of notification, full screen or just in the appbar
|
||||
- deleting scheduled pizza events
|
||||
- archiving past pizza events
|
||||
- foto mode for pizza event
|
||||
|
|
Loading…
Add table
Reference in a new issue