From de34b0bd96eaa8a1aff4e1e052e58bc626c38754 Mon Sep 17 00:00:00 2001 From: TheOneWithTheBraid Date: Sun, 27 Nov 2022 11:21:45 +0100 Subject: [PATCH] feat: add p2020 color scheme Signed-off-by: TheOneWithTheBraid --- .gitlab-ci.yml | 58 ++++++++++++++++------- lib/config/app_config.dart | 2 - lib/config/themes_p2020.dart | 92 ++++++++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+), 20 deletions(-) create mode 100644 lib/config/themes_p2020.dart diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 218dd80a..e6addc9a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,7 @@ stages: code_analyze: stage: test - script: [./scripts/code_analyze.sh] + script: [ ./scripts/code_analyze.sh ] artifacts: reports: codequality: code-quality-report.json @@ -26,7 +26,7 @@ code_analyze: widget_test: stage: test - script: [flutter test] + script: [ flutter test ] tags: - docker - famedly @@ -99,9 +99,9 @@ release_mode_launches: stage: test before_script: - | - if [ "$FLAVOR" == "proprietary" ]; then - git apply ./scripts/enable-android-google-services.patch - fi + if [ "$FLAVOR" == "proprietary" ]; then + git apply ./scripts/enable-android-google-services.patch + fi script: # start AVD and keep running in background - scripts/integration-start-avd.sh & @@ -115,8 +115,8 @@ release_mode_launches: build_web: stage: build before_script: - [sudo apt update && sudo apt install curl -y, ./scripts/prepare-web.sh] - script: [./scripts/build-web.sh] + [ sudo apt update && sudo apt install curl -y, ./scripts/prepare-web.sh ] + script: [ ./scripts/build-web.sh ] artifacts: paths: - build/web/ @@ -125,8 +125,8 @@ build_windows: extends: - .shared_windows_runners stage: build - before_script: [./scripts/prepare-windows.ps1] - script: [./scripts/build-windows.ps1] + before_script: [ ./scripts/prepare-windows.ps1 ] + script: [ ./scripts/build-windows.ps1 ] artifacts: paths: - build/windows/runner/Release @@ -137,7 +137,7 @@ build_windows: build_android_debug: stage: build - script: [./scripts/build-android-debug.sh] + script: [ ./scripts/build-android-debug.sh ] tags: - docker - famedly @@ -154,7 +154,7 @@ build_android_apk: before_script: - git apply ./scripts/enable-android-google-services.patch - ./scripts/prepare-android-release.sh - script: [./scripts/build-android-apk.sh] + script: [ ./scripts/build-android-apk.sh ] tags: - docker - famedly @@ -166,12 +166,34 @@ build_android_apk: - main - tags +build_p2022_android: + extends: build_android_apk + before_script: + - git apply ./scripts/enable-android-google-services.patch + - sed -i 's/im.fluffychat.fluffychat/de.brandenburg.polizei.messenger/g' android/app/build.gradle + - sed -i 's/im.fluffychat.fluffychat/de.brandenburg.polizei.messenger/g' lib/config/app_config.dart + - sed -i 's/im.fluffychat/de.brandenburg.polizei/g' lib/config/app_config.dart + - sed -i 's/255, 135, 103, 172/255, 33, 150, 243/g' lib/config/app_config.dart + - sed -i 's/https\:\/\/push\.fluffychat\.im\/_matrix\/push\/v1\/notify\/https:\/\/janian.de\/_matrix\/push\/v1\/notify/g' lib/config/app_config.dart + - sed -i 's/\$version/\$version-ACAB/g' lib/utils/platform_infos.dart + - find assets/l10n -name "*.arb" -exec sed -i 's/FluffyChat/BB Messenger/g' {} + + - sed -i 's/FluffyChat/BB Messenger/g' lib/config/app_config.dart + - flutter gen-l10n + - cat ${P2020_BRANDING} | base64 -d > p2020_branding.tar + - tar -xf p2020_branding.tar + - rm p2020_branding.tar + - cp lib/config/themes_p2020.dart lib/config/themes.dart + - ./scripts/prepare-android-release.sh + only: + - p2022/* + - manual + deploy_playstore_internal: stage: deploy before_script: - git apply ./scripts/enable-android-google-services.patch - ./scripts/prepare-android-release.sh - script: [./scripts/release-playstore-beta.sh] + script: [ ./scripts/release-playstore-beta.sh ] tags: - docker - famedly @@ -235,7 +257,7 @@ build_linux_x86: [ sudo apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install keyboard-configuration -y && sudo apt-get install curl clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev libjsoncpp-dev cmake-data libsecret-1-dev libsecret-1-0 librhash0 -y, ] - script: [./scripts/build-linux.sh] + script: [ ./scripts/build-linux.sh ] artifacts: when: on_success paths: @@ -243,9 +265,9 @@ build_linux_x86: build_linux_arm64: stage: build - before_script: [flutter upgrade] - script: [./scripts/build-linux.sh] - tags: [docker_arm64] + before_script: [ flutter upgrade ] + script: [ ./scripts/build-linux.sh ] + tags: [ docker_arm64 ] only: - main - tags @@ -257,7 +279,7 @@ build_linux_arm64: update_dependencies: stage: build - needs: [] + needs: [ ] tags: - docker only: @@ -335,7 +357,7 @@ deploy_playstore: before_script: - git apply ./scripts/enable-android-google-services.patch - ./scripts/prepare-android-release.sh - script: [./scripts/release-playstore.sh] + script: [ ./scripts/release-playstore.sh ] resource_group: playstore_release only: - tags diff --git a/lib/config/app_config.dart b/lib/config/app_config.dart index 41683a6b..a80db441 100644 --- a/lib/config/app_config.dart +++ b/lib/config/app_config.dart @@ -17,8 +17,6 @@ abstract class AppConfig { static const bool allowOtherHomeservers = true; static const bool enableRegistration = true; static const Color primaryColor = Color.fromARGB(255, 135, 103, 172); - static const Color primaryColorLight = Color(0xFFCCBDEA); - static const Color secondaryColor = Color(0xFF41a2bc); static String _privacyUrl = 'https://gitlab.com/famedly/fluffychat/-/blob/main/PRIVACY.md'; static String get privacyUrl => _privacyUrl; diff --git a/lib/config/themes_p2020.dart b/lib/config/themes_p2020.dart new file mode 100644 index 00000000..6379741a --- /dev/null +++ b/lib/config/themes_p2020.dart @@ -0,0 +1,92 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +import 'package:vrouter/vrouter.dart'; + +import 'package:fluffychat/utils/platform_infos.dart'; +import 'app_config.dart'; + +abstract class FluffyThemes { + static const double columnWidth = 360.0; + + static bool isColumnModeByWidth(double width) => width > columnWidth * 2 + 64; + + static bool isColumnMode(BuildContext context) => + isColumnModeByWidth(MediaQuery.of(context).size.width); + + static bool getDisplayNavigationRail(BuildContext context) => + !VRouter.of(context).path.startsWith('/settings'); + + static const fallbackTextStyle = TextStyle( + fontFamily: 'Roboto', + fontFamilyFallback: ['NotoEmoji'], + ); + + static var fallbackTextTheme = const TextTheme( + bodyText1: fallbackTextStyle, + bodyText2: fallbackTextStyle, + button: fallbackTextStyle, + caption: fallbackTextStyle, + overline: fallbackTextStyle, + headline1: fallbackTextStyle, + headline2: fallbackTextStyle, + headline3: fallbackTextStyle, + headline4: fallbackTextStyle, + headline5: fallbackTextStyle, + headline6: fallbackTextStyle, + subtitle1: fallbackTextStyle, + subtitle2: fallbackTextStyle, + ); + + static ThemeData buildTheme(Brightness brightness, + [ColorScheme? colorScheme]) => + ThemeData( + visualDensity: VisualDensity.standard, + useMaterial3: true, + brightness: brightness, + colorScheme: ColorScheme.fromSeed( + brightness: brightness, + secondary: const Color.fromARGB(255, 255, 82, 82), + seedColor: const Color.fromARGB(255, 33, 150, 243), + primaryContainer: const Color.fromARGB(255, 19, 26, 59), + background: const Color.fromARGB(255, 229, 229, 229), + ), + textTheme: PlatformInfos.isDesktop + ? brightness == Brightness.light + ? Typography.material2018().black.merge(fallbackTextTheme) + : Typography.material2018().white.merge(fallbackTextTheme) + : null, + snackBarTheme: const SnackBarThemeData( + behavior: SnackBarBehavior.floating, + ), + dividerColor: brightness == Brightness.light + ? Colors.blueGrey.shade50 + : const Color.fromARGB(255, 42, 73, 111), + inputDecorationTheme: const InputDecorationTheme( + border: InputBorder.none, + filled: true, + ), + appBarTheme: AppBarTheme( + surfaceTintColor: + brightness == Brightness.light ? Colors.white : Colors.black, + backgroundColor: const Color.fromARGB(255, 42, 73, 111), + shadowColor: Colors.black.withAlpha(64), + systemOverlayStyle: SystemUiOverlayStyle( + statusBarColor: Colors.transparent, + statusBarIconBrightness: brightness.reversed, + statusBarBrightness: brightness, + ), + ), + elevatedButtonTheme: ElevatedButtonThemeData( + style: ElevatedButton.styleFrom( + padding: const EdgeInsets.all(16), + textStyle: const TextStyle(fontSize: 16), + ), + ), + ); +} + +extension on Brightness { + Brightness get reversed => + this == Brightness.dark ? Brightness.light : Brightness.dark; +}