Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ android {
applicationId "gg.norisk.noriskclient"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 23
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
2 changes: 1 addition & 1 deletion lib/config/Colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ class NoRiskClientColors {
// text
static const Color text = Color.fromARGB(255, 255, 255, 255);
static const Color textLight = Color.fromARGB(200, 130, 130, 130);
}
}
48 changes: 48 additions & 0 deletions lib/config/ThemeProvider.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';

class ThemeProvider extends ChangeNotifier {
Color _blue = const Color(0xFF0066CC);
Color _background = const Color(0xFF1A1A2E);
Color _darkerBackground = const Color(0xFF0F0F1E);
Color _text = Colors.grey;

Color get blue => _blue;
Color get background => _background;
Color get darkerBackground => _darkerBackground;
Color get text => _text;

ThemeProvider() {
_loadSavedColor();
}

Future<void> _loadSavedColor() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String? savedColorHex = prefs.getString('theme_color');

if (savedColorHex != null) {
_blue = _hexToColor(savedColorHex);
notifyListeners();
}
}

Future<void> setBlue(Color color) async {
_blue = color;

SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString('theme_color', _colorToHex(color));

notifyListeners();
}

String _colorToHex(Color color) {
return '#${color.red.toRadixString(16).padLeft(2, '0')}'
'${color.green.toRadixString(16).padLeft(2, '0')}'
'${color.blue.toRadixString(16).padLeft(2, '0')}';
}

Color _hexToColor(String hex) {
hex = hex.replaceAll('#', '');
return Color(int.parse('FF$hex', radix: 16));
}
}
5 changes: 4 additions & 1 deletion lib/l10n/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"settings_privacyPolicy": "Datenschutz",
"settings_imprint": "Impressum",
"settings_support": "Support",
"settings_theme": "Theme",
"mcReal_profile_blockUserPopupTitle": "Bist du sicher?",
"mcReal_profile_blockUserPopupContent": "Möchtest du diesen Spieler blockieren?",
"mcReal_profile_unblockUserPopupTitle": "Bist du sicher?",
Expand All @@ -84,5 +85,7 @@
"chat_message_deleted": "Diese Nachricht wurde gelöscht.",
"chat_chat_empty": "Leerer Chat",
"navbar_you": "Du",
"gamescom_no_infos": "Aktuell sind keine Infos verfügbar."
"gamescom_no_infos": "Aktuell sind keine Infos verfügbar.",
"theme_apply": "Anwenden",
"theme_color_picker_title": "Farb Auswahl"
}
5 changes: 4 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"settings_privacyPolicy": "Privacy Policy",
"settings_imprint": "Imprint",
"settings_support": "Support",
"settings_theme": "Theme",
"mcReal_profile_blockUserPopupTitle": "Are you sure?",
"mcReal_profile_blockUserPopupContent": "Are you sure you want to block this player?",
"mcReal_profile_unblockUserPopupTitle": "Are you sure?",
Expand All @@ -84,5 +85,7 @@
"chat_message_deleted": "This message was deleted.",
"chat_chat_empty": "Empty Chat",
"navbar_you": "You",
"gamescom_no_infos": "There are no infos available at the moment."
"gamescom_no_infos": "There are no infos available at the moment.",
"theme_apply": "Apply",
"theme_color_picker_title": "Color Picker"
}
18 changes: 18 additions & 0 deletions lib/l10n/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,12 @@ abstract class AppLocalizations {
/// **'Support'**
String get settings_support;

/// No description provided for @settings_theme.
///
/// In en, this message translates to:
/// **'Theme'**
String get settings_theme;

/// No description provided for @mcReal_profile_blockUserPopupTitle.
///
/// In en, this message translates to:
Expand Down Expand Up @@ -610,6 +616,18 @@ abstract class AppLocalizations {
/// In en, this message translates to:
/// **'There are no infos available at the moment.'**
String get gamescom_no_infos;

/// No description provided for @theme_apply.
///
/// In en, this message translates to:
/// **'Apply'**
String get theme_apply;

/// No description provided for @theme_color_picker_title.
///
/// In en, this message translates to:
/// **'Color Picker'**
String get theme_color_picker_title;
}

class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
Expand Down
9 changes: 9 additions & 0 deletions lib/l10n/app_localizations_de.dart
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get settings_support => 'Support';

@override
String get settings_theme => 'Theme';

@override
String get mcReal_profile_blockUserPopupTitle => 'Bist du sicher?';

Expand Down Expand Up @@ -265,4 +268,10 @@ class AppLocalizationsDe extends AppLocalizations {

@override
String get gamescom_no_infos => 'Aktuell sind keine Infos verfügbar.';

@override
String get theme_apply => 'Anwenden';

@override
String get theme_color_picker_title => 'Farb Auswahl';
}
9 changes: 9 additions & 0 deletions lib/l10n/app_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get settings_support => 'Support';

@override
String get settings_theme => 'Theme';

@override
String get mcReal_profile_blockUserPopupTitle => 'Are you sure?';

Expand Down Expand Up @@ -265,4 +268,10 @@ class AppLocalizationsEn extends AppLocalizations {

@override
String get gamescom_no_infos => 'There are no infos available at the moment.';

@override
String get theme_apply => 'Apply';

@override
String get theme_color_picker_title => 'Color Picker';
}
12 changes: 9 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:noriskclient/config/Colors.dart';
import 'package:noriskclient/config/Colors.dart';
import 'package:noriskclient/config/ThemeProvider.dart';
import 'package:noriskclient/provider/localeProvider.dart';
import 'package:noriskclient/NoRiskClient.dart';
import 'package:noriskclient/screens/SignIn.dart';
Expand All @@ -17,7 +18,12 @@ import 'package:shared_preferences/shared_preferences.dart';
void main() {
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
runApp(const App());
runApp(
ChangeNotifierProvider(
create: (_) => ThemeProvider(),
child: const App(),
),
);
}

late bool isIOS;
Expand Down Expand Up @@ -77,7 +83,7 @@ class AppState extends State<App> {
}

super.initState();

loadUserData();
updateStream.stream.listen((List data) async {
String event = data[0];
Expand Down
Loading