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:name="flutterEmbedding"
|
||||||
android:value="2" />
|
android:value="2" />
|
||||||
</application>
|
</application>
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
||||||
import 'package:flutter_local_notifications/flutter_local_notifications.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:hive/hive.dart';
|
||||||
import 'package:pizzaplanner/entities/PizzaEvent.dart';
|
import 'package:pizzaplanner/entities/PizzaEvent.dart';
|
||||||
import 'package:pizzaplanner/entities/PizzaRecipe/RecipeStep.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:pizzaplanner/pages/RecipeStepInstructionPage.dart';
|
||||||
|
|
||||||
import 'package:timezone/timezone.dart' as tz;
|
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)!;
|
pizzaEvent = pizzaEventsBox.get(pizzaEventId)!;
|
||||||
recipeStep = pizzaEvent.recipe.recipeSteps[recipeStepId];
|
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
|
@override
|
||||||
|
@ -139,6 +152,13 @@ class PizzaEventNotificationState extends State<PizzaEventNotificationPage> {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> dispose() async {
|
||||||
|
FlutterRingtonePlayer.stop();
|
||||||
|
Vibration.cancel();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
AlertDialog buildIgnoreDialog(){
|
AlertDialog buildIgnoreDialog(){
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
|
|
|
@ -47,6 +47,9 @@ dependencies:
|
||||||
flutter_markdown: ^0.6.4
|
flutter_markdown: ^0.6.4
|
||||||
url_launcher: ^6.0.9
|
url_launcher: ^6.0.9
|
||||||
|
|
||||||
|
flutter_ringtone_player: ^3.0.0
|
||||||
|
vibration: ^1.7.4-nullsafety.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
3
todo.md
3
todo.md
|
@ -1,9 +1,8 @@
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
## Feature
|
## Feature
|
||||||
- add rumbling/sound to notifaction screen
|
|
||||||
- add settings page
|
- 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
|
- deleting scheduled pizza events
|
||||||
- archiving past pizza events
|
- archiving past pizza events
|
||||||
- foto mode for pizza event
|
- foto mode for pizza event
|
||||||
|
|
Loading…
Add table
Reference in a new issue