fixed notification minden is

This commit is contained in:
Kima
2023-08-30 01:22:41 +02:00
parent 91255182d2
commit c05b358b49
6 changed files with 499 additions and 366 deletions

View File

@@ -1,7 +1,6 @@
import 'package:filcnaplo/models/settings.dart';
import 'package:filcnaplo/theme/colors/colors.dart';
import 'package:filcnaplo/ui/widgets/grade/grade_tile.dart';
import 'package:filcnaplo_kreta_api/models/grade.dart';
import 'package:filcnaplo_mobile_ui/common/beta_chip.dart';
import 'package:filcnaplo_mobile_ui/common/panel/panel.dart';
import 'package:filcnaplo_mobile_ui/common/panel/panel_button.dart';
import 'package:flutter/cupertino.dart';
@@ -21,15 +20,23 @@ class MenuNotifications extends StatelessWidget {
padding: const EdgeInsets.only(left: 14.0),
onPressed: () {
Navigator.of(context, rootNavigator: true).push(
CupertinoPageRoute(builder: (context) => NotificationsScreen()),
CupertinoPageRoute(builder: (context) => const NotificationsScreen()),
);
},
title: Text(
"notifications_screen".i18n,
style: TextStyle(
color: AppColors.of(context)
.text
.withOpacity(settings.notificationsEnabled ? 1.0 : .5)),
title: Row(
children: [
Text(
"notifications_screen".i18n,
style: TextStyle(
color: AppColors.of(context)
.text
.withOpacity(settings.notificationsEnabled ? 1.0 : .5)),
),
const SizedBox(width: 5.0),
BetaChip(
disabled: !settings.notificationsEnabled,
),
],
),
leading: settings.notificationsEnabled
? const Icon(FeatherIcons.messageSquare)
@@ -48,128 +55,172 @@ class MenuNotifications extends StatelessWidget {
}
class NotificationsScreen extends StatelessWidget {
NotificationsScreen({super.key});
late SettingsProvider settings;
const NotificationsScreen({super.key});
@override
Widget build(BuildContext context) {
settings = Provider.of<SettingsProvider>(context);
SettingsProvider settings = Provider.of<SettingsProvider>(context);
return Scaffold(
appBar: AppBar(
surfaceTintColor: Theme.of(context).scaffoldBackgroundColor,
leading: BackButton(color: AppColors.of(context).text),
title: Text(
"notifications_screen".i18n,
style: TextStyle(color: AppColors.of(context).text),
appBar: AppBar(
surfaceTintColor: Theme.of(context).scaffoldBackgroundColor,
leading: BackButton(color: AppColors.of(context).text),
title: Text(
"notifications_screen".i18n,
style: TextStyle(color: AppColors.of(context).text),
),
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 24.0),
child: Panel(
child: Column(
children: [
Material(
type: MaterialType.transparency,
child: SwitchListTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0)),
value: settings.notificationsGradesEnabled,
onChanged: (v) =>
settings.update(notificationsGradesEnabled: v),
title: Row(
children: [
Icon(
FeatherIcons.bookmark,
color: settings.notificationsGradesEnabled
? Theme.of(context).colorScheme.secondary
: AppColors.of(context).text.withOpacity(.25),
),
const SizedBox(width: 14.0),
Expanded(
child: Text(
"grades".i18n,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16.0,
color: AppColors.of(context).text.withOpacity(
settings.notificationsGradesEnabled
? 1.0
: .5,
),
),
),
),
],
),
),
),
Material(
type: MaterialType.transparency,
child: SwitchListTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0)),
value: settings.notificationsAbsencesEnabled,
onChanged: (v) =>
settings.update(notificationsAbsencesEnabled: v),
title: Row(
children: [
Icon(
FeatherIcons.clock,
color: settings.notificationsAbsencesEnabled
? Theme.of(context).colorScheme.secondary
: AppColors.of(context).text.withOpacity(.25),
),
const SizedBox(width: 14.0),
Expanded(
child: Text(
"absences".i18n,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16.0,
color: AppColors.of(context).text.withOpacity(
settings.notificationsAbsencesEnabled
? 1.0
: .5,
),
),
),
),
],
),
),
),
Material(
type: MaterialType.transparency,
child: SwitchListTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0)),
value: settings.notificationsMessagesEnabled,
onChanged: (v) =>
settings.update(notificationsMessagesEnabled: v),
title: Row(
children: [
Icon(
FeatherIcons.messageSquare,
color: settings.notificationsMessagesEnabled
? Theme.of(context).colorScheme.secondary
: AppColors.of(context).text.withOpacity(.25),
),
const SizedBox(width: 14.0),
Expanded(
child: Text(
"messages".i18n,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16.0,
color: AppColors.of(context).text.withOpacity(
settings.notificationsMessagesEnabled
? 1.0
: .5,
),
),
),
),
],
),
),
),
Material(
type: MaterialType.transparency,
child: SwitchListTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0)),
value: settings.notificationsLessonsEnabled,
onChanged: (v) =>
settings.update(notificationsLessonsEnabled: v),
title: Row(
children: [
Icon(
FeatherIcons.calendar,
color: settings.notificationsLessonsEnabled
? Theme.of(context).colorScheme.secondary
: AppColors.of(context).text.withOpacity(.25),
),
const SizedBox(width: 14.0),
Expanded(
child: Text(
"lessons".i18n,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16.0,
color: AppColors.of(context).text.withOpacity(
settings.notificationsLessonsEnabled
? 1.0
: .5,
),
),
),
),
],
),
),
),
],
),
),
),
body: Padding(
padding:
const EdgeInsets.symmetric(vertical: 16.0, horizontal: 24.0),
child: SingleChildScrollView(
child: Panel(
child: Column(children: [
SwitchListTile(
value: settings.notificationsGradesEnabled,
onChanged: (v) => {settings.update(notificationsGradesEnabled: v)},
title: Row(
children: [
GradeValueWidget(GradeValue(5, "", "", 100), fill: true, size: 30, color: settings.gradeColors[4].withOpacity(
settings.notificationsGradesEnabled ? 1.0 : .5)),
const SizedBox(width: 14.0),
Expanded(
child: Text(
"grades".i18n,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16.0,
color: AppColors.of(context).text.withOpacity(
settings.notificationsGradesEnabled ? 1.0 : .5),
),
),
),
],
),
),
SwitchListTile(
value: settings.notificationsAbsencesEnabled,
onChanged: (v) => {settings.update(notificationsAbsencesEnabled: v)},
title: Row(
children: [
const SizedBox(width: 8),
settings.notificationsAbsencesEnabled
? const Icon(FeatherIcons.clock)
: Icon(FeatherIcons.clock,
color:
AppColors.of(context).text.withOpacity(.25)),
const SizedBox(width: 23.0),
Expanded(
child: Text(
"absences".i18n,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16.0,
color: AppColors.of(context).text.withOpacity(
settings.notificationsAbsencesEnabled ? 1.0 : .5),
),
),
),
],
),
),
SwitchListTile(
value: settings.notificationsMessagesEnabled,
onChanged: (v) => {settings.update(notificationsMessagesEnabled: v)},
title: Row(
children: [
const SizedBox(width: 8),
settings.notificationsMessagesEnabled
? const Icon(FeatherIcons.messageSquare)
: Icon(FeatherIcons.messageSquare,
color:
AppColors.of(context).text.withOpacity(.25)),
const SizedBox(width: 23.0),
Expanded(
child: Text(
"messages".i18n,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16.0,
color: AppColors.of(context).text.withOpacity(
settings.notificationsMessagesEnabled ? 1.0 : .5),
),
),
),
],
),
),
SwitchListTile(
value: settings.notificationsLessonsEnabled,
onChanged: (v) => {settings.update(notificationsLessonsEnabled: v)},
title: Row(
children: [
const SizedBox(width: 8),
settings.notificationsLessonsEnabled
? const Icon(FeatherIcons.calendar)
: Icon(FeatherIcons.calendar,
color:
AppColors.of(context).text.withOpacity(.25)),
const SizedBox(width: 23.0),
Expanded(
child: Text(
"lessons".i18n,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16.0,
color: AppColors.of(context).text.withOpacity(
settings.notificationsLessonsEnabled ? 1.0 : .5),
),
),
),
],
),
)
]),
))));
),
);
}
}

View File

@@ -15,7 +15,6 @@ import 'package:filcnaplo/models/user.dart';
import 'package:filcnaplo/theme/colors/colors.dart';
import 'package:filcnaplo_kreta_api/client/client.dart';
import 'package:filcnaplo_mobile_ui/common/action_button.dart';
import 'package:filcnaplo_mobile_ui/common/beta_chip.dart';
import 'package:filcnaplo_mobile_ui/common/bottom_sheet_menu/bottom_sheet_menu.dart';
import 'package:filcnaplo_mobile_ui/common/bottom_sheet_menu/bottom_sheet_menu_item.dart';
import 'package:filcnaplo_mobile_ui/common/panel/panel.dart';
@@ -453,9 +452,8 @@ class _SettingsScreenState extends State<SettingsScreen>
),
),
Material(
type: MaterialType.transparency,
child: MenuNotifications(settings: settings)
),
type: MaterialType.transparency,
child: MenuNotifications(settings: settings)),
],
),
),
@@ -681,7 +679,7 @@ class _SettingsScreenState extends State<SettingsScreen>
const PremiumIconPackSelector(),
// If iOS, show the iOS specific settings
if (defaultTargetPlatform == TargetPlatform.iOS)
if (defaultTargetPlatform == TargetPlatform.iOS)
PanelButton(
onPressed: () {
SettingsHelper.liveActivityColor(context);
@@ -708,7 +706,7 @@ class _SettingsScreenState extends State<SettingsScreen>
padding:
const EdgeInsets.symmetric(vertical: 12.0, horizontal: 24.0),
child: Panel(
title: Text("notifications".i18n),
title: Text("popups".i18n),
child: Material(
type: MaterialType.transparency,
child: SwitchListTile(

View File

@@ -27,6 +27,7 @@ extension SettingsLocalization on String {
"grade_colors": "Grade Colors",
"live_activity_color": "Live Activity Color",
"notifications": "Notifications",
"popups": "Pop-up Alerts",
"news": "News",
"extras": "Extras",
"about": "About",
@@ -97,6 +98,7 @@ extension SettingsLocalization on String {
"grade_colors": "Jegyek színei",
"live_activity_color": "Live Activity színe",
"notifications": "Értesítések",
"popups": "Pop-up értesítések",
"news": "Hírek",
"extras": "Extrák",
"about": "Névjegy",
@@ -167,6 +169,7 @@ extension SettingsLocalization on String {
"grade_colors": "Grad Farben",
"live_activity_color": "Live Activity Farben",
"notifications": "Mitteilung",
"popups": "Popup-Nachrichten",
"news": "Nachrichten",
"extras": "Extras",
"about": "Informationen",

View File

@@ -172,7 +172,7 @@ class _AllSumBodyState extends State<AllSumBody> {
],
);
// TODO: az orakat es a hazikat szarul keri le, de majd meg lesz csinalva
// TO-DO: az orakat es a hazikat szarul keri le, de majd meg lesz csinalva
if (firstSixTiles.length < 6) {
firstSixTiles.add(w);
} else if (lastSixTiles.length < 6) {