Skip to content

Commit

Permalink
Added a gradient for alarms (#384)
Browse files Browse the repository at this point in the history
* add bottomsheet to google sign in

* feat: Add note

* Revert "feat: Add note"

This reverts commit f37b5b6.

* feat: add ascending volume tile

* add gradient functionality

* move the function to controller

* fix gradient conditions

* update the volume to its initiial value

* remove unused imports

* minor fixes

* update slider for maxiumum and minimum volume

* add languages for ascending_volume tile

* update language.dart
  • Loading branch information
its-me-abhishek authored Jan 25, 2024
1 parent 592073d commit e68b720
Show file tree
Hide file tree
Showing 17 changed files with 1,828 additions and 1,084 deletions.
3 changes: 1 addition & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion rootProject.ext.compileSdkVersion
ndkVersion flutter.ndkVersion
compileSdkVersion 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
20 changes: 18 additions & 2 deletions lib/app/data/models/alarm_model.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:convert';

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:cloud_firestore/cloud_firestore.dart' as firestore;

import 'package:isar/isar.dart';
import 'package:ultimate_alarm_clock/app/data/models/user_model.dart';
Expand Down Expand Up @@ -43,11 +43,15 @@ class AlarmModel {
late String label;
late bool isOneTime;
late int snoozeDuration;
late int gradient;
late String ringtoneName;
late String note;
late bool deleteAfterGoesOff;
late bool showMotivationalQuote;
late bool isTimer;
late double volMax;
late double volMin;

@ignore
Map? offsetDetails;

Expand Down Expand Up @@ -84,15 +88,18 @@ class AlarmModel {
required this.label,
required this.isOneTime,
required this.snoozeDuration,
required this.gradient,
required this.ringtoneName,
required this.note,
required this.deleteAfterGoesOff,
required this.showMotivationalQuote,
required this.isTimer,
required this.volMax,
required this.volMin,
});

AlarmModel.fromDocumentSnapshot({
required DocumentSnapshot documentSnapshot,
required firestore.DocumentSnapshot documentSnapshot,
required UserModel? user,
}) {
// Making sure the alarms work with the offsets
Expand All @@ -114,6 +121,7 @@ class AlarmModel {
minutesSinceMidnight = documentSnapshot['minutesSinceMidnight'];
}
snoozeDuration = documentSnapshot['snoozeDuration'];
gradient = documentSnapshot['gradient'];
label = documentSnapshot['label'];
isOneTime = documentSnapshot['isOneTime'];
firestoreId = documentSnapshot.id;
Expand Down Expand Up @@ -147,11 +155,14 @@ class AlarmModel {
deleteAfterGoesOff = documentSnapshot['deleteAfterGoesOff'];
showMotivationalQuote = documentSnapshot['showMotivationalQuote'];
isTimer = documentSnapshot['isTimer'];
volMax = documentSnapshot['volMax'];
volMin = documentSnapshot['volMin'];
}

AlarmModel.fromMap(Map<String, dynamic> alarmData) {
// Making sure the alarms work with the offsets
snoozeDuration = alarmData['snoozeDuration'];
gradient = alarmData['gradient'];
isSharedAlarmEnabled = alarmData['isSharedAlarmEnabled'];
minutesSinceMidnight = alarmData['minutesSinceMidnight'];
alarmTime = alarmData['alarmTime'];
Expand Down Expand Up @@ -190,6 +201,8 @@ class AlarmModel {
deleteAfterGoesOff = alarmData['deleteAfterGoesOff'];
showMotivationalQuote = alarmData['showMotivationalQuote'];
isTimer = alarmData['isTimer'];
volMin = alarmData['volMin'];
volMax = alarmData['volMax'];
}

AlarmModel.fromJson(String alarmData, UserModel? user) {
Expand Down Expand Up @@ -233,11 +246,14 @@ class AlarmModel {
'isPedometerEnabled': alarmRecord.isPedometerEnabled,
'numberOfSteps': alarmRecord.numberOfSteps,
'snoozeDuration': alarmRecord.snoozeDuration,
'gradient': alarmRecord.gradient,
'ringtoneName': alarmRecord.ringtoneName,
'note': alarmRecord.note,
'deleteAfterGoesOff': alarmRecord.deleteAfterGoesOff,
'showMotivationalQuote': alarmRecord.showMotivationalQuote,
'isTimer': alarmRecord.isTimer,
'volMin': alarmRecord.volMin,
'volMax': alarmRecord.volMax,
};

if (alarmRecord.isSharedAlarmEnabled) {
Expand Down
Loading

3 comments on commit e68b720

@tushar11kh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @its-me-abhishek after this commit, I am not able to run the app.
There is some problem with flutter_volume_controller.
Screenshot 2024-01-29 at 1 06 01 AM
I have tried few things but its not working. Can you please help me out in this...

@its-me-abhishek
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try running flutter pub get, or pub get, flutter packages get, it is probably an issue with the dependencies, might refer to this as well. The app is working fine on my system. Please update me if your issue gets resolved

@tushar11kh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try 1) I tried running flutter clean and remove the package in .pub-cache folder, it didn't work.

try 2)I have download this package manually from https://pub.dev/packages/flutter_volume_controller/versions and used flutter pub get for the same and then pasted it in .pub-cache/hosted/pub.dev
It didn't work either

[working] try 3)I have copied and pasted

flutter_plugin_android_lifecycle: ^2.0.17

and

plugin:
platforms:
android:
package: com.yosemiteyss.flutter_volume_controller
pluginClass: FlutterVolumeControllerPlugin
ios:
pluginClass: FlutterVolumeControllerPlugin
macos:
pluginClass: FlutterVolumeControllerPlugin
windows:
pluginClass: FlutterVolumeControllerPluginCApi
linux:
pluginClass: FlutterVolumeControllerPlugin

in pubspec.yaml and restarted my machine and now its working...

Please sign in to comment.