Skip to content

Commit

Permalink
dedicated setting for notification
Browse files Browse the repository at this point in the history
  • Loading branch information
iqfareez committed Dec 13, 2020
1 parent 6679140 commit fb81cf0
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 10 deletions.
10 changes: 10 additions & 0 deletions lib/utils/prayerName.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class PrayerName {
static List<String> prayerName = [
'Fajr',
'Syuruk',
'Zuhr',
'\'Asr',
'Maghrib',
'Isya\''
];
}
13 changes: 7 additions & 6 deletions lib/views/GetPrayerTime.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:waktusolatmalaysia/utils/RawPrayDataHandler.dart';
import 'package:waktusolatmalaysia/utils/cachedPrayerData.dart';
import 'package:waktusolatmalaysia/utils/isolate_handler_notification.dart';
import 'package:waktusolatmalaysia/utils/location/locationDatabase.dart';
import 'package:waktusolatmalaysia/utils/prayerName.dart';
import 'package:waktusolatmalaysia/utils/sizeconfig.dart';
import 'package:waktusolatmalaysia/views/Settings%20part/settingsProvider.dart';
import '../networking/Response.dart';
Expand Down Expand Up @@ -138,9 +139,9 @@ class _PrayTimeListState extends State<PrayTimeList> {
: Container(
height: 0,
),
solatCard(subuhTime, 'Fajr', true),
solatCard(subuhTime, PrayerName.prayerName[0], true),
showOtherPrayerTime
? solatCard(syurukTime, 'Syuruk', false)
? solatCard(syurukTime, PrayerName.prayerName[1], false)
: Container(
height: 0,
),
Expand All @@ -149,10 +150,10 @@ class _PrayTimeListState extends State<PrayTimeList> {
: Container(
height: 0,
),
solatCard(zohorTime, 'Zuhr', true),
solatCard(asarTime, 'Asr', true),
solatCard(maghribTime, 'Maghrib', true),
solatCard(isyaTime, 'Isya\'', true),
solatCard(zohorTime, PrayerName.prayerName[2], true),
solatCard(asarTime, PrayerName.prayerName[3], true),
solatCard(maghribTime, PrayerName.prayerName[4], true),
solatCard(isyaTime, PrayerName.prayerName[5], true),
],
);
},
Expand Down
77 changes: 77 additions & 0 deletions lib/views/Settings part/NotificationSettingPage.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import 'package:app_settings/app_settings.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:waktusolatmalaysia/utils/cupertinoSwitchListTile.dart';
import 'package:waktusolatmalaysia/utils/prayerName.dart';

class NotificationPageSetting extends StatefulWidget {
@override
_NotificationPageSettingState createState() =>
_NotificationPageSettingState();
}

class _NotificationPageSettingState extends State<NotificationPageSetting> {
var prayerNotification = [true, true, true, true, true, true, true];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Notification Settings'),
centerTitle: true,
),
body: ListView(
padding: EdgeInsets.all(16),
children: [
Text('Basic'),
Card(
child: Column(children: [
CupertinoSwitchListTile(
title: Text(PrayerName.prayerName[0]),
value: prayerNotification[0],
onChanged: (bool value) {
print('huhuuhu');
}),
CupertinoSwitchListTile(
title: Text(PrayerName.prayerName[1]),
value: prayerNotification[0],
onChanged: (bool value) {
print('huhuuhu');
}),
CupertinoSwitchListTile(
title: Text(PrayerName.prayerName[2]),
value: prayerNotification[0],
onChanged: (bool value) {
print('huhuuhu');
}),
CupertinoSwitchListTile(
title: Text(PrayerName.prayerName[3]),
value: prayerNotification[0],
onChanged: (bool value) {
print('huhuuhu');
}),
CupertinoSwitchListTile(
title: Text(PrayerName.prayerName[4]),
value: prayerNotification[0],
onChanged: (bool value) {
print('huhuuhu');
}),

//TODO:Sambung sini
]),
),
Text('Advanced'),
Card(
child: ListTile(
title: Text('App notification System Setting'),
subtitle:
Text('Change sound, vibration of prayer notification etc.'),
trailing: Icon(Icons.launch_rounded),
onTap: () async {
await AppSettings.openNotificationSettings();
},
))
],
),
);
}
}
11 changes: 7 additions & 4 deletions lib/views/Settings part/SettingsPage.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:app_settings/app_settings.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get_storage/get_storage.dart';
Expand All @@ -7,6 +6,7 @@ import 'package:waktusolatmalaysia/CONSTANTS.dart' as Constants;
import 'package:waktusolatmalaysia/utils/AppInformation.dart';
import 'package:waktusolatmalaysia/utils/cupertinoSwitchListTile.dart';
import 'package:waktusolatmalaysia/views/Settings%20part/AboutPage.dart';
import 'package:waktusolatmalaysia/views/Settings%20part/NotificationSettingPage.dart';
import 'package:waktusolatmalaysia/views/Settings%20part/settingsProvider.dart';

class SettingsPage extends StatefulWidget {
Expand Down Expand Up @@ -84,10 +84,13 @@ class _SettingsPageState extends State<SettingsPage> {
Card(
child: ListTile(
title: Text('Notification settings'),
subtitle: Text(
'Change sound, vibration of prayer notification via System Setting'),
subtitle: Text('App notification behavior'),
onTap: () async {
await AppSettings.openNotificationSettings();
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
NotificationPageSetting()));
},
),
),
Expand Down

0 comments on commit fb81cf0

Please sign in to comment.