forked from firka/student-legacy
did lot of things in v5 settings page
This commit is contained in:
parent
4e5695a118
commit
587811778d
@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:filcnaplo/models/ad.dart';
|
||||
import 'package:filcnaplo/models/config.dart';
|
||||
@ -86,6 +87,12 @@ class FilcAPI {
|
||||
Map<String, String> headers = {
|
||||
"x-filc-id": settings.xFilcId,
|
||||
"user-agent": userAgent,
|
||||
// platform things
|
||||
"rf-platform": Platform.operatingSystem,
|
||||
"rf-platform-version": Platform.operatingSystemVersion,
|
||||
"rf-app-version":
|
||||
const String.fromEnvironment("APPVER", defaultValue: "?"),
|
||||
"rf-uinid": settings.xFilcId,
|
||||
};
|
||||
|
||||
log("[CONFIG] x-filc-id: \"${settings.xFilcId}\"");
|
||||
|
@ -13,6 +13,7 @@ class SplittedPanel extends StatelessWidget {
|
||||
this.hasShadow = true,
|
||||
this.isSeparated = false,
|
||||
this.spacing = 6.0,
|
||||
this.isTransparent = false,
|
||||
});
|
||||
|
||||
final List<Widget>? children;
|
||||
@ -22,6 +23,7 @@ class SplittedPanel extends StatelessWidget {
|
||||
final bool hasShadow;
|
||||
final bool isSeparated;
|
||||
final double spacing;
|
||||
final bool isTransparent;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -40,7 +42,9 @@ class SplittedPanel extends StatelessWidget {
|
||||
var w = Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: isTransparent
|
||||
? Colors.transparent
|
||||
: Theme.of(context).colorScheme.background,
|
||||
borderRadius: BorderRadius.vertical(
|
||||
top: Radius.circular(i == 0 ? 16.0 : 8.0),
|
||||
bottom: Radius.circular(children!.length == i + 1 ? 16.0 : 8.0),
|
||||
|
@ -10,46 +10,42 @@ import 'package:provider/provider.dart';
|
||||
import 'notifications_screen.i18n.dart';
|
||||
|
||||
class MenuNotifications extends StatelessWidget {
|
||||
const MenuNotifications({super.key, required this.settings});
|
||||
const MenuNotifications({
|
||||
super.key,
|
||||
this.borderRadius = const BorderRadius.vertical(
|
||||
top: Radius.circular(4.0), bottom: Radius.circular(4.0)),
|
||||
});
|
||||
|
||||
final SettingsProvider settings;
|
||||
final BorderRadius borderRadius;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PanelButton(
|
||||
padding: const EdgeInsets.only(left: 14.0),
|
||||
onPressed: () {
|
||||
Navigator.of(context, rootNavigator: true).push(
|
||||
onPressed: () => Navigator.of(context, rootNavigator: true).push(
|
||||
CupertinoPageRoute(builder: (context) => const NotificationsScreen()),
|
||||
);
|
||||
},
|
||||
),
|
||||
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,
|
||||
const BetaChip(
|
||||
disabled: false,
|
||||
),
|
||||
],
|
||||
),
|
||||
leading: settings.notificationsEnabled
|
||||
? const Icon(FeatherIcons.messageSquare)
|
||||
: Icon(FeatherIcons.messageSquare,
|
||||
color: AppColors.of(context).text.withOpacity(.25)),
|
||||
trailingDivider: true,
|
||||
trailing: Switch(
|
||||
onChanged: (v) async {
|
||||
settings.update(notificationsEnabled: v);
|
||||
},
|
||||
value: settings.notificationsEnabled,
|
||||
activeColor: Theme.of(context).colorScheme.secondary,
|
||||
leading: Icon(
|
||||
FeatherIcons.messageSquare,
|
||||
size: 22.0,
|
||||
color: AppColors.of(context).text.withOpacity(0.95),
|
||||
),
|
||||
trailing: Icon(
|
||||
FeatherIcons.chevronRight,
|
||||
size: 22.0,
|
||||
color: AppColors.of(context).text.withOpacity(0.95),
|
||||
),
|
||||
borderRadius: borderRadius,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ import 'package:filcnaplo_mobile_ui/common/bottom_sheet_menu/rounded_bottom_shee
|
||||
import 'package:filcnaplo_mobile_ui/common/filter_bar.dart';
|
||||
import 'package:filcnaplo_mobile_ui/common/material_action_button.dart';
|
||||
import 'package:filcnaplo/ui/widgets/grade/grade_tile.dart';
|
||||
import 'package:filcnaplo_mobile_ui/common/panel/panel_button.dart';
|
||||
import 'package:filcnaplo_mobile_ui/common/system_chrome.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -28,6 +30,9 @@ import 'package:flutter_material_color_picker/flutter_material_color_picker.dart
|
||||
import 'package:filcnaplo/models/icon_pack.dart';
|
||||
import 'package:filcnaplo/utils/format.dart';
|
||||
import 'package:filcnaplo_mobile_ui/screens/settings/theme_screen.dart';
|
||||
import 'package:refilc_plus/models/premium_scopes.dart';
|
||||
import 'package:refilc_plus/providers/premium_provider.dart';
|
||||
import 'package:refilc_plus/ui/mobile/premium/upsell.dart';
|
||||
|
||||
class SettingsHelper {
|
||||
static const Map<String, String> langMap = {
|
||||
@ -88,18 +93,18 @@ class SettingsHelper {
|
||||
);
|
||||
}
|
||||
|
||||
static void uwuMode(BuildContext context, value) {
|
||||
final settings = Provider.of<SettingsProvider>(context, listen: false);
|
||||
if (value) {
|
||||
I18n.of(context).locale = const Locale('uw', 'UW');
|
||||
} else {
|
||||
I18n.of(context).locale =
|
||||
Locale(settings.language, settings.language.toUpperCase());
|
||||
}
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
setupQuickActions();
|
||||
}
|
||||
}
|
||||
// static void uwuMode(BuildContext context, value) {
|
||||
// final settings = Provider.of<SettingsProvider>(context, listen: false);
|
||||
// if (value) {
|
||||
// I18n.of(context).locale = const Locale('uw', 'UW');
|
||||
// } else {
|
||||
// I18n.of(context).locale =
|
||||
// Locale(settings.language, settings.language.toUpperCase());
|
||||
// }
|
||||
// if (Platform.isAndroid || Platform.isIOS) {
|
||||
// setupQuickActions();
|
||||
// }
|
||||
// }
|
||||
|
||||
static void iconPack(BuildContext context) {
|
||||
final settings = Provider.of<SettingsProvider>(context, listen: false);
|
||||
@ -315,6 +320,48 @@ class SettingsHelper {
|
||||
child: const BellDelaySetting(),
|
||||
);
|
||||
}
|
||||
|
||||
// v5 user changer
|
||||
static void changeCurrentUser(
|
||||
BuildContext context, List<Widget> accountTiles, int len) {
|
||||
showBottomSheetMenu(
|
||||
context,
|
||||
items: List.generate(len, (index) {
|
||||
if (index == accountTiles.length) {
|
||||
return Center(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(top: 12.0, bottom: 4.0),
|
||||
height: 3.0,
|
||||
width: 75.0,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
color: AppColors.of(context).text.withOpacity(.25),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else if (index == accountTiles.length + 1) {
|
||||
return PanelButton(
|
||||
onPressed: () {
|
||||
if (!Provider.of<PremiumProvider>(context, listen: false)
|
||||
.hasScope(PremiumScopes.maxTwoAccounts)) {
|
||||
PremiumLockedFeatureUpsell.show(
|
||||
context: context, feature: PremiumFeature.moreAccounts);
|
||||
return;
|
||||
}
|
||||
|
||||
Navigator.of(context).pushNamed("login_back").then((value) {
|
||||
setSystemChrome(context);
|
||||
});
|
||||
},
|
||||
title: Text("add_user"),
|
||||
leading: const Icon(FeatherIcons.userPlus),
|
||||
);
|
||||
} else {
|
||||
return accountTiles[index];
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Rounding modal
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -44,7 +44,7 @@ extension SettingsLocalization on String {
|
||||
"reset": "Reset",
|
||||
"open": "Open",
|
||||
"data_collected":
|
||||
"Data collected: Platform (eg. Android), App version (eg. 3.0.0), Unique Install Identifier",
|
||||
"Data collected: Platform (eg. iOS), App version (eg. 5.0.0), Unique Install Identifier",
|
||||
"Analytics": "Analytics",
|
||||
"Anonymous Usage Analytics": "Anonymous Usage Analytics",
|
||||
"graph_class_avg": "Class average on graph",
|
||||
@ -78,6 +78,8 @@ extension SettingsLocalization on String {
|
||||
"edit_welcome_msg": "Edit welcome message",
|
||||
"shadow_effect": "Shadow Effect",
|
||||
"app_icon": "App Icon",
|
||||
"settings": "Settings",
|
||||
"personalization": "Personalization",
|
||||
},
|
||||
"hu_hu": {
|
||||
"personal_details": "Személyes információk",
|
||||
@ -120,7 +122,7 @@ extension SettingsLocalization on String {
|
||||
"reset": "Visszaállítás",
|
||||
"open": "Megnyitás",
|
||||
"data_collected":
|
||||
"Gyűjtött adat: Platform (pl. Android), App verzió (pl. 3.0.0), Egyedi telepítési azonosító",
|
||||
"Gyűjtött adat: platform (pl.: iOS), app verzió (pl.: 5.0.0), egyedi telepítési azonosító",
|
||||
"Analytics": "Analitika",
|
||||
"Anonymous Usage Analytics": "Névtelen használati analitika",
|
||||
"graph_class_avg": "Osztályátlag a grafikonon",
|
||||
@ -154,6 +156,8 @@ extension SettingsLocalization on String {
|
||||
"edit_welcome_msg": "Üdvözlő üzenet szerkesztése",
|
||||
"shadow_effect": "Árnyékhatás",
|
||||
"app_icon": "Alkalmazásikon",
|
||||
"settings": "Beállítások",
|
||||
"personalization": "Személyre szabás",
|
||||
},
|
||||
"de_de": {
|
||||
"personal_details": "Persönliche Angaben",
|
||||
@ -196,7 +200,7 @@ extension SettingsLocalization on String {
|
||||
"reset": "Zurücksetzen",
|
||||
"open": "Öffnen",
|
||||
"data_collected":
|
||||
"Erhobene Daten: Plattform (z.B. Android), App version (z.B. 3.0.0), Eindeutige Installationskennung",
|
||||
"Erhobene Daten: Plattform (z.B. iOS), App version (z.B. 5.0.0), Eindeutige Installationskennung",
|
||||
"Analytics": "Analytik",
|
||||
"Anonymous Usage Analytics": "Anonyme Nutzungsanalyse",
|
||||
"graph_class_avg": "Klassendurchschnitt in der Grafik",
|
||||
@ -230,6 +234,8 @@ extension SettingsLocalization on String {
|
||||
"edit_welcome_msg": "Begrüßungsnachricht bearbeiten",
|
||||
"shadow_effect": "Schatteneffekt",
|
||||
"app_icon": "App-Symbol",
|
||||
"settings": "Einstellungen",
|
||||
"personalization": "Personalisierung",
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,67 @@
|
||||
// import 'package:filcnaplo/models/settings.dart';
|
||||
import 'package:filcnaplo/theme/colors/colors.dart';
|
||||
import 'package:filcnaplo_mobile_ui/common/panel/panel_button.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
||||
// import 'package:provider/provider.dart';
|
||||
import 'submenu_screen.i18n.dart';
|
||||
|
||||
class MenuExtrasSettings extends StatelessWidget {
|
||||
const MenuExtrasSettings({
|
||||
super.key,
|
||||
this.borderRadius = const BorderRadius.vertical(
|
||||
top: Radius.circular(4.0), bottom: Radius.circular(4.0)),
|
||||
});
|
||||
|
||||
final BorderRadius borderRadius;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PanelButton(
|
||||
onPressed: () => Navigator.of(context, rootNavigator: true).push(
|
||||
CupertinoPageRoute(builder: (context) => const ExtrasSettingsScreen()),
|
||||
),
|
||||
title: Text("extras".i18n),
|
||||
leading: Icon(
|
||||
FeatherIcons.edit,
|
||||
size: 22.0,
|
||||
color: AppColors.of(context).text.withOpacity(0.95),
|
||||
),
|
||||
trailing: Icon(
|
||||
FeatherIcons.chevronRight,
|
||||
size: 22.0,
|
||||
color: AppColors.of(context).text.withOpacity(0.95),
|
||||
),
|
||||
borderRadius: borderRadius,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ExtrasSettingsScreen extends StatelessWidget {
|
||||
const ExtrasSettingsScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext 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(
|
||||
"extras".i18n,
|
||||
style: TextStyle(color: AppColors.of(context).text),
|
||||
),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 24.0),
|
||||
child: Column(
|
||||
children: [],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
// import 'package:filcnaplo/models/settings.dart';
|
||||
import 'package:filcnaplo/theme/colors/colors.dart';
|
||||
import 'package:filcnaplo_mobile_ui/common/panel/panel_button.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
||||
// import 'package:provider/provider.dart';
|
||||
import 'submenu_screen.i18n.dart';
|
||||
|
||||
class MenuGeneralSettings extends StatelessWidget {
|
||||
const MenuGeneralSettings({
|
||||
super.key,
|
||||
this.borderRadius = const BorderRadius.vertical(
|
||||
top: Radius.circular(4.0), bottom: Radius.circular(4.0)),
|
||||
});
|
||||
|
||||
final BorderRadius borderRadius;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PanelButton(
|
||||
onPressed: () => Navigator.of(context, rootNavigator: true).push(
|
||||
CupertinoPageRoute(builder: (context) => const GeneralSettingsScreen()),
|
||||
),
|
||||
title: Text("general".i18n),
|
||||
leading: Icon(
|
||||
FeatherIcons.settings,
|
||||
size: 22.0,
|
||||
color: AppColors.of(context).text.withOpacity(0.95),
|
||||
),
|
||||
trailing: Icon(
|
||||
FeatherIcons.chevronRight,
|
||||
size: 22.0,
|
||||
color: AppColors.of(context).text.withOpacity(0.95),
|
||||
),
|
||||
borderRadius: borderRadius,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class GeneralSettingsScreen extends StatelessWidget {
|
||||
const GeneralSettingsScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext 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(
|
||||
"general".i18n,
|
||||
style: TextStyle(color: AppColors.of(context).text),
|
||||
),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 24.0),
|
||||
child: Column(
|
||||
children: [],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
// import 'package:filcnaplo/models/settings.dart';
|
||||
import 'package:filcnaplo/theme/colors/colors.dart';
|
||||
import 'package:filcnaplo_mobile_ui/common/panel/panel_button.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
||||
// import 'package:provider/provider.dart';
|
||||
import 'submenu_screen.i18n.dart';
|
||||
|
||||
class MenuPersonalizeSettings extends StatelessWidget {
|
||||
const MenuPersonalizeSettings({
|
||||
super.key,
|
||||
this.borderRadius = const BorderRadius.vertical(
|
||||
top: Radius.circular(4.0), bottom: Radius.circular(4.0)),
|
||||
});
|
||||
|
||||
final BorderRadius borderRadius;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PanelButton(
|
||||
onPressed: () => Navigator.of(context, rootNavigator: true).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => const PersonalizeSettingsScreen()),
|
||||
),
|
||||
title: Text("personalize".i18n),
|
||||
leading: Icon(
|
||||
FeatherIcons.droplet,
|
||||
size: 22.0,
|
||||
color: AppColors.of(context).text.withOpacity(0.95),
|
||||
),
|
||||
trailing: Icon(
|
||||
FeatherIcons.chevronRight,
|
||||
size: 22.0,
|
||||
color: AppColors.of(context).text.withOpacity(0.95),
|
||||
),
|
||||
borderRadius: borderRadius,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class PersonalizeSettingsScreen extends StatelessWidget {
|
||||
const PersonalizeSettingsScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext 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(
|
||||
"personalize".i18n,
|
||||
style: TextStyle(color: AppColors.of(context).text),
|
||||
),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 24.0),
|
||||
child: Column(
|
||||
children: [],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
import 'package:i18n_extension/i18n_extension.dart';
|
||||
|
||||
extension SettingsLocalization on String {
|
||||
static final _t = Translations.byLocale("hu_hu") +
|
||||
{
|
||||
"en_en": {
|
||||
"general": "General",
|
||||
},
|
||||
"hu_hu": {
|
||||
"general": "General",
|
||||
},
|
||||
"de_de": {
|
||||
"general": "General",
|
||||
},
|
||||
};
|
||||
|
||||
String get i18n => localize(this, _t);
|
||||
String fill(List<Object> params) => localizeFill(this, params);
|
||||
String plural(int value) => localizePlural(value, this, _t);
|
||||
String version(Object modifier) => localizeVersion(modifier, this, _t);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user