diff --git a/lib/main.dart b/lib/main.dart index 64557091..3c3f27bd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -25,7 +25,7 @@ import 'dart:io' show Platform, exit; import 'themes/opaque.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -var globalSettings = Settings(Locale("en", ''), OpaqueDark()); +var globalSettings = Settings(Locale("en", ''), CwtchDark()); var globalErrorHandler = ErrorHandler(); var globalTorStatus = TorStatus(); var globalAppState = AppState(); diff --git a/lib/settings.dart b/lib/settings.dart index a9579723..30c6a59d 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -37,15 +37,9 @@ class Settings extends ChangeNotifier { bool blockUnknownConnections = false; bool streamerMode = false; - /// Set the dark theme. - void setDark() { - theme = OpaqueDark(); - notifyListeners(); - } - /// Set the Light theme. - void setLight() { - theme = OpaqueLight(); + void setTheme(String themeId, String mode) { + theme = getTheme(themeId, mode); notifyListeners(); } @@ -70,11 +64,12 @@ class Settings extends ChangeNotifier { /// be sent to the function and new settings will be instantiated based on the contents. handleUpdate(dynamic settings) { // Set Theme and notify listeners - if (settings["Theme"] == "light") { + this.setTheme(settings["Theme"], settings["ThemeMode"] ?? mode_dark); + /*if (settings["Theme"] == "light") { this.setLight(); } else { this.setDark(); - } + }*/ // Set Locale and notify listeners switchLocale(Locale(settings["Locale"])); @@ -230,11 +225,11 @@ class Settings extends ChangeNotifier { /// Convert this Settings object to a JSON representation for serialization on the /// event bus. dynamic asJson() { - var themeString = theme.identifier(); return { "Locale": this.locale.languageCode, - "Theme": themeString, + "Theme": theme.theme, + "ThemeMode": theme.mode, "PreviousPid": -1, "BlockUnknownConnections": blockUnknownConnections, "StreamerMode": streamerMode, diff --git a/lib/themes/cwtch.dart b/lib/themes/cwtch.dart index 6c66a8f4..8d904c36 100644 --- a/lib/themes/cwtch.dart +++ b/lib/themes/cwtch.dart @@ -5,6 +5,9 @@ import 'package:flutter/material.dart'; import 'opaque.dart'; +final cwtch_name = "Cwtch"; // todo translate +final cwtch_theme = "cwtch"; + final Color darkGreyPurple = Color(0xFF281831); final Color deepPurple = Color(0xFF422850); final Color mauvePurple = Color(0xFF8E64A5); @@ -25,7 +28,15 @@ final Color softGrey = Color(0xFFB3B6B3); // not in new theme: blocked //static final Color softGreen = Color(0xFFA0FFB0); //static final Color softRed = Color(0xFFFFA0B0); -class OpaqueDark extends OpaqueThemeType { +OpaqueThemeType GetCwtchTheme(String mode) { + if (mode == mode_dark) { + return CwtchDark(); + } else { + return CwtchLight(); + } +} + +class CwtchDark extends OpaqueThemeType { static final Color background = darkGreyPurple; static final Color header = darkGreyPurple; static final Color userBubble = mauvePurple; @@ -34,136 +45,44 @@ class OpaqueDark extends OpaqueThemeType { static final Color settings = whiteishPurple; static final Color accent = hotPink; - String identifier() { - return mode_dark; - } + get name => cwtch_name; + get theme => cwtch_theme; + get mode => mode_dark; - Color backgroundMainColor() { - return background; // darkGreyPurple; - } - - Color backgroundPaneColor() { - return header; //darkGreyPurple; - } - - Color backgroundHilightElementColor() { - return deepPurple; - } - - Color mainTextColor() { - return font; //whiteishPurple; - } - - Color sendHintTextColor() { - return mauvePurple; - } - - Color hilightElementColor() { - return purple; - } - - Color defaultButtonColor() { - return accent; //hotPink; - } - - Color defaultButtonActiveColor() { - return pink; - } - - Color defaultButtonTextColor() { - return whiteishPurple; - } - - Color defaultButtonDisabledColor() { - return lightGrey; - } - - Color defaultButtonDisabledTextColor() { - return darkGreyPurple; - } - - Color textfieldBackgroundColor() { - return deepPurple; - } - - Color textfieldBorderColor() { - return deepPurple; - } - - Color textfieldHintColor() { - return mainTextColor(); //TODO pick - } - - Color textfieldErrorColor() { - return hotPink; - } - - Color scrollbarDefaultColor() { - return purple; - } - - Color portraitBackgroundColor() { - return deepPurple; - } - - Color portraitOnlineBorderColor() { - return whiteishPurple; - } - - Color portraitOfflineBorderColor() { - return purple; - } - - Color portraitBlockedBorderColor() { - return lightGrey; - } - - Color portraitBlockedTextColor() { - return lightGrey; - } - - Color portraitContactBadgeColor() { - return hotPink; - } - - Color portraitContactBadgeTextColor() { - return whiteishPurple; - } - - Color portraitProfileBadgeColor() { - return mauvePurple; - } - - Color portraitProfileBadgeTextColor() { - return darkGreyPurple; - } - - Color dropShadowColor() { - return mauvePurple; - } - - Color toolbarIconColor() { - return settings; //whiteishPurple; - } - - Color messageFromMeBackgroundColor() { - return userBubble; // mauvePurple; - } - - Color messageFromMeTextColor() { - return font; //whiteishPurple; - } - - Color messageFromOtherBackgroundColor() { - return peerBubble; //deepPurple; - } - - Color messageFromOtherTextColor() { - return font; //whiteishPurple; - } + get backgroundMainColor => background; // darkGreyPurple; + get backgroundPaneColor => header; //darkGreyPurple; + get backgroundHilightElementColor => deepPurple; + get mainTextColor => font; //whiteishPurple; + get sendHintTextColor => mauvePurple; + get hilightElementColor => purple; + get defaultButtonColor => accent; //hotPink; + get defaultButtonActiveColor => pink; + get defaultButtonTextColor => whiteishPurple; + get defaultButtonDisabledColor => lightGrey; + get defaultButtonDisabledTextColor => darkGreyPurple; + get textfieldBackgroundColor => deepPurple; + get textfieldBorderColor => deepPurple; + get textfieldHintColor => mainTextColor; //TODO pick + get textfieldErrorColor => hotPink; + get scrollbarDefaultColor => purple; + get portraitBackgroundColor => deepPurple; + get portraitOnlineBorderColor => whiteishPurple; + get portraitOfflineBorderColor => purple; + get portraitBlockedBorderColor => lightGrey; + get portraitBlockedTextColor => lightGrey; + get portraitContactBadgeColor => hotPink; + get portraitContactBadgeTextColor => whiteishPurple; + get portraitProfileBadgeColor => mauvePurple; + get portraitProfileBadgeTextColor => darkGreyPurple; + get dropShadowColor => mauvePurple; + get toolbarIconColor => settings; //whiteishPurple; + get messageFromMeBackgroundColor => userBubble; // mauvePurple; + get messageFromMeTextColor => font; //whiteishPurple; + get messageFromOtherBackgroundColor => peerBubble; //deepPurple; + get messageFromOtherTextColor => font; //whiteishPurple; } -class OpaqueLight extends OpaqueThemeType { +class CwtchLight extends OpaqueThemeType { static final Color background = whitePurple; static final Color header = softPurple; static final Color userBubble = purple; @@ -172,139 +91,38 @@ class OpaqueLight extends OpaqueThemeType { static final Color settings = darkPurple; static final Color accent = hotPink; + get name => cwtch_name; + get theme => cwtch_theme; + get mode => mode_light; - String identifier() { - return mode_light; - } - - // Main screen background color (message pane, item rows) - Color backgroundMainColor() { - return background; //whitePurple; - } - - // Top pane ane pane colors (settings) - Color backgroundPaneColor() { - return header; //softPurple; - } - - // Selected row color - Color backgroundHilightElementColor() { - // Todo: lighten? cant - // hm... in light its the top pane color. but in dark its unique - return softPurple; - } - - // Main text color - Color mainTextColor() { - return settings; - } - - // Faded text color for suggestions in textfields - Color sendHintTextColor() { - return purple; - } - - // pressed row, offline heart - Color hilightElementColor() { - return purple; //darkPurple; // todo shouldn't be this, too dark, makes font unreadable - } - - Color defaultButtonColor() { - return accent; // hotPink; - } - - Color defaultButtonActiveColor() { - return pink; // todo: lighten in light, darken in dark - } - - Color defaultButtonTextColor() { - return whitePurple; // ? - } - - Color defaultButtonDisabledColor() { - return softGrey; - } - - Color textfieldBackgroundColor() { - return purple; - } - - Color textfieldBorderColor() { - return purple; - } - - Color textfieldHintColor() { - return font; //TODO pick - } - - Color textfieldErrorColor() { - return hotPink; - } - - // todo button - Color scrollbarDefaultColor() { - return accent; - } - - Color portraitBackgroundColor() { - return softPurple; - } - - Color portraitOnlineBorderColor() { - return greyPurple; - } - - Color portraitOfflineBorderColor() { - return greyPurple; - } - - Color portraitBlockedBorderColor() { - return softGrey; - } - - Color portraitBlockedTextColor() { - return softGrey; - } - - Color portraitContactBadgeColor() { - return accent; - } - - Color portraitContactBadgeTextColor() { - return whitePurple; // todo button color - } - - // TODO del - Color portraitProfileBadgeColor() { - return brightPurple; - } - - // TODO del - Color portraitProfileBadgeTextColor() { - return whitePurple; - } - - Color dropShadowColor() { - return purple; - } - - Color toolbarIconColor() { - return settings; //darkPurple; - } - - Color messageFromMeBackgroundColor() { - return userBubble; //brightPurple; - } - - Color messageFromMeTextColor() { - return font; //mainTextColor(); - } - - Color messageFromOtherBackgroundColor() { - return peerBubble; //purple; - } - - Color messageFromOtherTextColor() { - return font; //darkPurple; - } + get backgroundMainColor => background; //whitePurple; + get backgroundPaneColor => header; //softPurple; + get backgroundHilightElementColor => softPurple; + get mainTextColor => settings; + get sendHintTextColor => purple; + get hilightElementColor => purple; //darkPurple; // todo shouldn't be this, too dark, makes font unreadable + get defaultButtonColor => accent; // hotPink; + get defaultButtonActiveColor => pink; // todo: lighten in light, darken in dark + get defaultButtonTextColor => whitePurple; // ? + get defaultButtonDisabledColor => softGrey; + get textfieldBackgroundColor => purple; + get textfieldBorderColor => purple; + get textfieldHintColor => font; //TODO pick + get textfieldErrorColor => hotPink; + get scrollbarDefaultColor => accent; + get portraitBackgroundColor => softPurple; + get portraitOnlineBorderColor => greyPurple; + get portraitOfflineBorderColor => greyPurple; + get portraitBlockedBorderColor => softGrey; + get portraitBlockedTextColor => softGrey; + get portraitContactBadgeColor => accent; + get portraitContactBadgeTextColor => whitePurple; + get portraitProfileBadgeColor => brightPurple; + get portraitProfileBadgeTextColor => whitePurple; + get dropShadowColor => purple; + get toolbarIconColor => settings; //darkPurple; + get messageFromMeBackgroundColor => userBubble; //brightPurple; + get messageFromMeTextColor => font; //mainTextColor; + get messageFromOtherBackgroundColor => peerBubble; //purple; + get messageFromOtherTextColor => font; //darkPurple; } \ No newline at end of file diff --git a/lib/themes/neon1.dart b/lib/themes/neon1.dart new file mode 100644 index 00000000..f3b2a505 --- /dev/null +++ b/lib/themes/neon1.dart @@ -0,0 +1,126 @@ +import 'dart:ui'; +import 'dart:core'; + +import 'package:flutter/material.dart'; + +import 'opaque.dart'; + +final neon1_theme = "neon1"; +final neon1_name = "Neon1"; //Todo translate + +final Color darkGreyPurple = Color(0xFF281831); +final Color deepPurple = Color(0xFF422850); +final Color mauvePurple = Color(0xFF8E64A5); +final Color whiteishPurple = Color(0xFFE3DFE4); +final Color lightGrey = Color(0xFF9E9E9E); + +final Color whitePurple = Color(0xFFFFFDFF); +final Color softPurple = Color(0xFFFDF3FC); +final Color purple = Color(0xFFDFB9DE); +final Color brightPurple = Color(0xFFD1B0E0); // not in new: portrait badge color +final Color darkPurple = Color(0xFF350052); +final Color greyPurple = Color(0xFF775F84); // not in new: portrait borders +final Color pink = Color(0xFFE85DA1); // not in new: active button color +final Color hotPink = Color(0xFFD20070); // Color(0xFFD01972); +final Color softGrey = Color(0xFFB3B6B3); // not in new theme: blocked +//static final Color softGreen = Color(0xFFA0FFB0); +//static final Color softRed = Color(0xFFFFA0B0); + +OpaqueThemeType GetNeon1Theme(String mode) { + if (mode == mode_dark) { + return Neon1Dark(); + } else { + return Neon1Light(); + } +} + +class Neon1Dark extends OpaqueThemeType { + static final Color background = Color(0xFF290826); + static final Color header = Color(0xFF290826); + static final Color userBubble = Color(0xFFD20070); + static final Color peerBubble = Color(0xFF26A9A4); + static final Color font = Color(0xFFFFFFFF); + static final Color settings = Color(0xFFFFFDFF); + static final Color accent = Color(0xFFA604FE); + + get name => neon1_name; + get theme => neon1_theme; + get mode => mode_dark; + + get backgroundMainColor => background; // darkGreyPurple; + get backgroundPaneColor => header; //darkGreyPurple; + get backgroundHilightElementColor => deepPurple; + get mainTextColor => font; //whiteishPurple; + get sendHintTextColor => mauvePurple; + get hilightElementColor => purple; + get defaultButtonColor => accent; //hotPink; + get defaultButtonActiveColor => pink; + get defaultButtonTextColor => whiteishPurple; + get defaultButtonDisabledColor => lightGrey; + get defaultButtonDisabledTextColor => darkGreyPurple; + get textfieldBackgroundColor => deepPurple; + get textfieldBorderColor => deepPurple; + get textfieldHintColor => mainTextColor; //TODO pick + get textfieldErrorColor => hotPink; + get scrollbarDefaultColor => purple; + get portraitBackgroundColor => deepPurple; + get portraitOnlineBorderColor => whiteishPurple; + get portraitOfflineBorderColor => purple; + get portraitBlockedBorderColor => lightGrey; + get portraitBlockedTextColor => lightGrey; + get portraitContactBadgeColor => hotPink; + get portraitContactBadgeTextColor => whiteishPurple; + get portraitProfileBadgeColor => mauvePurple; + get portraitProfileBadgeTextColor => darkGreyPurple; + get dropShadowColor => mauvePurple; + get toolbarIconColor => settings; //whiteishPurple; + get messageFromMeBackgroundColor => userBubble; // mauvePurple; + get messageFromMeTextColor => font; //whiteishPurple; + get messageFromOtherBackgroundColor => peerBubble; //deepPurple; + get messageFromOtherTextColor => font; //whiteishPurple; +} + +class Neon1Light extends OpaqueThemeType { + static final Color background = Color(0xFFFFFDFF); + static final Color header = Color(0xFFFF94C2); + static final Color userBubble = Color(0xFFFF94C2); + static final Color peerBubble = Color(0xFFE7F6F6); + static final Color font = Color(0xFF290826); + static final Color settings = Color(0xFF290826); + static final Color accent = Color(0xFFA604FE); + + get name => neon1_name; + get theme => neon1_theme; + get mode => mode_light; + + get backgroundMainColor => background; //whitePurple; + get backgroundPaneColor => header; //softPurple; + get backgroundHilightElementColor => softPurple; + get mainTextColor => settings; + get sendHintTextColor => purple; + get hilightElementColor => purple; //darkPurple; // todo shouldn't be this, too dark, makes font unreadable + get defaultButtonColor => accent; // hotPink; + get defaultButtonActiveColor => pink; // todo: lighten in light, darken in dark + get defaultButtonTextColor => whitePurple; // ? + get defaultButtonDisabledColor => softGrey; + get textfieldBackgroundColor => purple; + get textfieldBorderColor => purple; + get textfieldHintColor => font; //TODO pick + get textfieldErrorColor => hotPink; + get scrollbarDefaultColor => accent; + get portraitBackgroundColor => softPurple; + get portraitOnlineBorderColor => greyPurple; + get portraitOfflineBorderColor => greyPurple; + get portraitBlockedBorderColor => softGrey; + get portraitBlockedTextColor => softGrey; + get portraitContactBadgeColor => accent; + get portraitContactBadgeTextColor => whitePurple; + get portraitProfileBadgeColor => brightPurple; + get portraitProfileBadgeTextColor => whitePurple; + get dropShadowColor => purple; + get toolbarIconColor => settings; //darkPurple; + get messageFromMeBackgroundColor => userBubble; //brightPurple; + get messageFromMeTextColor => font; //mainTextColor; + get messageFromOtherBackgroundColor => peerBubble; //purple; + get messageFromOtherTextColor => font; //darkPurple; +} \ No newline at end of file diff --git a/lib/themes/opaque.dart b/lib/themes/opaque.dart index 40058392..bd037c08 100644 --- a/lib/themes/opaque.dart +++ b/lib/themes/opaque.dart @@ -1,148 +1,100 @@ import 'dart:ui'; import 'dart:core'; +import 'package:cwtch/themes/cwtch.dart'; +import 'package:cwtch/themes/neon1.dart'; import 'package:flutter/material.dart'; import 'package:cwtch/settings.dart'; const mode_light = "light"; const mode_dark = "dark"; +final themes = { cwtch_theme: {mode_light: CwtchLight(), mode_dark: CwtchDark()}, + neon1_theme: {mode_light: Neon1Light(), mode_dark: Neon1Dark()}, +}; + +OpaqueThemeType getTheme(String themeId, String mode) { + if (themeId == "") { + themeId = cwtch_theme; + } + if (themeId == mode_light) { + themeId = cwtch_theme; + mode = mode_light; + } + if (themeId == mode_dark) { + themeId = cwtch_theme; + mode = mode_dark; + } + + var theme = themes[themeId]?[mode]; + return theme ?? CwtchDark(); +} + +Color lighten(Color color, [double amount = 0.15]) { + final hsl = HSLColor.fromColor(color); + final hslLight = hsl.withLightness((hsl.lightness + amount).clamp(0.0, 1.0)); + + return hslLight.toColor(); +} + +Color darken(Color color, [double amount = 0.15]) { + final hsl = HSLColor.fromColor(color); + final hslDarken = hsl.withLightness((hsl.lightness - amount).clamp(0.0, 1.0)); + + return hslDarken.toColor(); +} + abstract class OpaqueThemeType { static final Color red = Color(0xFFFF0000); - String identifier() { - return "dummy"; - } + get name => "Dummy"; + get theme => "dummy"; + get mode => mode_light; // Main screen background color (message pane, item rows) - Color backgroundMainColor() { - return red; - } + get backgroundMainColor => red; // Top pane ane pane colors (settings) - Color backgroundPaneColor() { - return red; - } + get backgroundPaneColor => red; - // Selected Row - Color backgroundHilightElementColor() { - return red; - } - - Color mainTextColor() { - return red; - } - - // Faded text color for suggestions in textfields - // Todo: implement way more places - Color sendHintTextColor() { - return red; - } + get mainTextColor => red; // pressed row, offline heart - Color hilightElementColor() { - return red; - } + get hilightElementColor => red; + // Selected Row + get backgroundHilightElementColor => red; + // Faded text color for suggestions in textfields + // Todo: implement way more places + get sendHintTextColor => red; - Color defaultButtonColor() { - return red; - } - - Color defaultButtonActiveColor() { - return red; - } - - Color defaultButtonTextColor() { - return red; - } - - Color defaultButtonDisabledColor() { - return red; - } - - Color textfieldBackgroundColor() { - return red; - } - - Color textfieldBorderColor() { - return red; - } - - Color textfieldHintColor() { - return red; - } - - Color textfieldErrorColor() { - return red; - } - - Color scrollbarDefaultColor() { - return red; - } - - Color portraitBackgroundColor() { - return red; - } - - Color portraitOnlineBorderColor() { - return red; - } - - Color portraitOfflineBorderColor() { - return red; - } - - Color portraitBlockedBorderColor() { - return red; - } - - Color portraitBlockedTextColor() { - return red; - } - - Color portraitContactBadgeColor() { - return red; - } - - Color portraitContactBadgeTextColor() { - return red; - } - - Color portraitProfileBadgeColor() { - return red; - } - - Color portraitProfileBadgeTextColor() { - return red; - } + get defaultButtonColor => red; + get defaultButtonActiveColor => mode == mode_light ? lighten(defaultButtonColor) : darken(defaultButtonColor); + get defaultButtonTextColor => red; + get defaultButtonDisabledColor => red; + get textfieldBackgroundColor => red; + get textfieldBorderColor => red; + get textfieldHintColor => red; + get textfieldErrorColor => red; + get scrollbarDefaultColor => red; + get portraitBackgroundColor => red; + get portraitOnlineBorderColor => red; + get portraitOfflineBorderColor => red; + get portraitBlockedBorderColor => red; + get portraitBlockedTextColor => red; + get portraitContactBadgeColor => red; + get portraitContactBadgeTextColor => red; + get portraitProfileBadgeColor => red; + get portraitProfileBadgeTextColor => red; // dropshaddpow // todo: probably should not be reply icon color in messagerow - Color dropShadowColor() { - return red; - } + get dropShadowColor => red; - Color toolbarIconColor() { - return red; - } - - Color messageFromMeBackgroundColor() { - return red; - } - - Color messageFromMeTextColor() { - return red; - } - - Color messageFromOtherBackgroundColor() { - return red; - } - - Color messageFromOtherTextColor() { - return red; - } - - // ... more to come + get toolbarIconColor => red; + get messageFromMeBackgroundColor => red; + get messageFromMeTextColor => red; + get messageFromOtherBackgroundColor => red; + get messageFromOtherTextColor => red; // Sizes @@ -151,51 +103,49 @@ abstract class OpaqueThemeType { } } - - ThemeData mkThemeData(Settings opaque) { return ThemeData( visualDensity: VisualDensity.adaptivePlatformDensity, primarySwatch: Colors.red, primaryIconTheme: IconThemeData( - color: opaque.current().mainTextColor(), + color: opaque.current().mainTextColor, ), - primaryColor: opaque.current().backgroundMainColor(), - canvasColor: opaque.current().backgroundPaneColor(), - backgroundColor: opaque.current().backgroundMainColor(), - highlightColor: opaque.current().hilightElementColor(), + primaryColor: opaque.current().backgroundMainColor, + canvasColor: opaque.current().backgroundPaneColor, + backgroundColor: opaque.current().backgroundMainColor, + highlightColor: opaque.current().hilightElementColor, iconTheme: IconThemeData( - color: opaque.current().toolbarIconColor(), + color: opaque.current().toolbarIconColor, ), - cardColor: opaque.current().backgroundMainColor(), + cardColor: opaque.current().backgroundMainColor, appBarTheme: AppBarTheme( - backgroundColor: opaque.current().backgroundPaneColor(), + backgroundColor: opaque.current().backgroundPaneColor, iconTheme: IconThemeData( - color: opaque.current().mainTextColor(), + color: opaque.current().mainTextColor, ), titleTextStyle: TextStyle( - color: opaque.current().mainTextColor(), + color: opaque.current().mainTextColor, ), actionsIconTheme: IconThemeData( - color: opaque.current().mainTextColor(), + color: opaque.current().mainTextColor, )), //bottomNavigationBarTheme: BottomNavigationBarThemeData(type: BottomNavigationBarType.fixed, backgroundColor: opaque.current().backgroundHilightElementColor()), // Can't determine current use textButtonTheme: TextButtonThemeData( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(opaque.current().defaultButtonColor()), - foregroundColor: MaterialStateProperty.all(opaque.current().defaultButtonTextColor()), - overlayColor: MaterialStateProperty.all(opaque.current().defaultButtonActiveColor()), + backgroundColor: MaterialStateProperty.all(opaque.current().defaultButtonColor), + foregroundColor: MaterialStateProperty.all(opaque.current().defaultButtonTextColor), + overlayColor: MaterialStateProperty.all(opaque.current().defaultButtonActiveColor), padding: MaterialStateProperty.all(EdgeInsets.all(20))), ), - hintColor: opaque.current().textfieldHintColor(), + hintColor: opaque.current().textfieldHintColor, elevatedButtonTheme: ElevatedButtonThemeData( style: ButtonStyle( - backgroundColor: MaterialStateProperty.resolveWith((states) => states.contains(MaterialState.disabled) ? opaque.current().defaultButtonDisabledColor() : opaque.current().defaultButtonColor()), - foregroundColor: MaterialStateProperty.all(opaque.current().defaultButtonTextColor()), + backgroundColor: MaterialStateProperty.resolveWith((states) => states.contains(MaterialState.disabled) ? opaque.current().defaultButtonDisabledColor : opaque.current().defaultButtonColor), + foregroundColor: MaterialStateProperty.all(opaque.current().defaultButtonTextColor), overlayColor: MaterialStateProperty.resolveWith((states) => (states.contains(MaterialState.pressed) && states.contains(MaterialState.hovered)) - ? opaque.current().defaultButtonActiveColor() + ? opaque.current().defaultButtonActiveColor : states.contains(MaterialState.disabled) - ? opaque.current().defaultButtonDisabledColor() + ? opaque.current().defaultButtonDisabledColor : null), enableFeedback: true, splashFactory: InkRipple.splashFactory, @@ -206,37 +156,37 @@ ThemeData mkThemeData(Settings opaque) { ), ), scrollbarTheme: ScrollbarThemeData( - isAlwaysShown: false, thumbColor: MaterialStateProperty.all(opaque.current().scrollbarDefaultColor())), - tabBarTheme: TabBarTheme(indicator: UnderlineTabIndicator(borderSide: BorderSide(color: opaque.current().defaultButtonActiveColor()))), + isAlwaysShown: false, thumbColor: MaterialStateProperty.all(opaque.current().scrollbarDefaultColor)), + tabBarTheme: TabBarTheme(indicator: UnderlineTabIndicator(borderSide: BorderSide(color: opaque.current().defaultButtonActiveColor))), dialogTheme: DialogTheme( - backgroundColor: opaque.current().backgroundPaneColor(), - titleTextStyle: TextStyle(color: opaque.current().mainTextColor()), - contentTextStyle: TextStyle(color: opaque.current().mainTextColor())), + backgroundColor: opaque.current().backgroundPaneColor, + titleTextStyle: TextStyle(color: opaque.current().mainTextColor), + contentTextStyle: TextStyle(color: opaque.current().mainTextColor)), textTheme: TextTheme( - headline1: TextStyle(color: opaque.current().mainTextColor()), - headline2: TextStyle(color: opaque.current().mainTextColor()), - headline3: TextStyle(color: opaque.current().mainTextColor()), - headline4: TextStyle(color: opaque.current().mainTextColor()), - headline5: TextStyle(color: opaque.current().mainTextColor()), - headline6: TextStyle(color: opaque.current().mainTextColor()), - bodyText1: TextStyle(color: opaque.current().mainTextColor()), - bodyText2: TextStyle(color: opaque.current().mainTextColor()), - subtitle1: TextStyle(color: opaque.current().mainTextColor()), - subtitle2: TextStyle(color: opaque.current().mainTextColor()), - caption: TextStyle(color: opaque.current().mainTextColor()), - button: TextStyle(color: opaque.current().mainTextColor()), - overline: TextStyle(color: opaque.current().mainTextColor())), + headline1: TextStyle(color: opaque.current().mainTextColor), + headline2: TextStyle(color: opaque.current().mainTextColor), + headline3: TextStyle(color: opaque.current().mainTextColor), + headline4: TextStyle(color: opaque.current().mainTextColor), + headline5: TextStyle(color: opaque.current().mainTextColor), + headline6: TextStyle(color: opaque.current().mainTextColor), + bodyText1: TextStyle(color: opaque.current().mainTextColor), + bodyText2: TextStyle(color: opaque.current().mainTextColor), + subtitle1: TextStyle(color: opaque.current().mainTextColor), + subtitle2: TextStyle(color: opaque.current().mainTextColor), + caption: TextStyle(color: opaque.current().mainTextColor), + button: TextStyle(color: opaque.current().mainTextColor), + overline: TextStyle(color: opaque.current().mainTextColor)), switchTheme: SwitchThemeData( - overlayColor: MaterialStateProperty.all(opaque.current().defaultButtonActiveColor()), - thumbColor: MaterialStateProperty.all(opaque.current().mainTextColor()), - trackColor: MaterialStateProperty.all(opaque.current().dropShadowColor()), + overlayColor: MaterialStateProperty.all(opaque.current().defaultButtonActiveColor), + thumbColor: MaterialStateProperty.all(opaque.current().mainTextColor), + trackColor: MaterialStateProperty.all(opaque.current().dropShadowColor), ), floatingActionButtonTheme: FloatingActionButtonThemeData( - backgroundColor: opaque.current().defaultButtonColor(), - hoverColor: opaque.current().defaultButtonActiveColor(), + backgroundColor: opaque.current().defaultButtonColor, + hoverColor: opaque.current().defaultButtonActiveColor, enableFeedback: true, - splashColor: opaque.current().defaultButtonActiveColor()), + splashColor: opaque.current().defaultButtonActiveColor), textSelectionTheme: TextSelectionThemeData( - cursorColor: opaque.current().defaultButtonActiveColor(), selectionColor: opaque.current().defaultButtonActiveColor(), selectionHandleColor: opaque.current().defaultButtonActiveColor()), + cursorColor: opaque.current().defaultButtonActiveColor, selectionColor: opaque.current().defaultButtonActiveColor, selectionHandleColor: opaque.current().defaultButtonActiveColor), ); } diff --git a/lib/views/addeditprofileview.dart b/lib/views/addeditprofileview.dart index e92b9c7e..f3dc72dc 100644 --- a/lib/views/addeditprofileview.dart +++ b/lib/views/addeditprofileview.dart @@ -91,7 +91,7 @@ class _AddEditProfileViewState extends State { imagePath: Provider.of(context).imagePath, diameter: 120, maskOut: false, - border: theme.theme.portraitOnlineBorderColor(), + border: theme.theme.portraitOnlineBorderColor, badgeTextColor: Colors.red, badgeColor: Colors.red, ) @@ -145,13 +145,13 @@ class _AddEditProfileViewState extends State { child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [ Checkbox( value: usePassword, - fillColor: MaterialStateProperty.all(theme.current().defaultButtonColor()), - activeColor: theme.current().defaultButtonActiveColor(), + fillColor: MaterialStateProperty.all(theme.current().defaultButtonColor), + activeColor: theme.current().defaultButtonActiveColor, onChanged: _handleSwitchPassword, ), Text( AppLocalizations.of(context)!.radioUsePassword, - style: TextStyle(color: theme.current().mainTextColor()), + style: TextStyle(color: theme.current().mainTextColor), ), SizedBox( height: 20, diff --git a/lib/views/addeditservers.dart b/lib/views/addeditservers.dart index 011903c5..415866b7 100644 --- a/lib/views/addeditservers.dart +++ b/lib/views/addeditservers.dart @@ -33,6 +33,7 @@ class _AddEditServerViewState extends State { final ctrlrOnion = TextEditingController(text: ""); late bool usePassword; + //late bool deleted; @override diff --git a/lib/views/contactsview.dart b/lib/views/contactsview.dart index 87c6cee6..0c59122e 100644 --- a/lib/views/contactsview.dart +++ b/lib/views/contactsview.dart @@ -78,7 +78,7 @@ class _ContactsViewState extends State { ProfileImage( imagePath: Provider.of(context).imagePath, diameter: 42, - border: Provider.of(context).current().portraitOnlineBorderColor(), + border: Provider.of(context).current().portraitOnlineBorderColor, badgeTextColor: Colors.red, badgeColor: Colors.red, ), @@ -87,7 +87,7 @@ class _ContactsViewState extends State { ), Expanded( child: Text("%1 ยป %2".replaceAll("%1", Provider.of(context).nickname).replaceAll("%2", AppLocalizations.of(context)!.titleManageContacts), - overflow: TextOverflow.ellipsis, style: TextStyle(color: Provider.of(context).current().mainTextColor()))), + overflow: TextOverflow.ellipsis, style: TextStyle(color: Provider.of(context).current().mainTextColor))), ])), actions: getActions(context), ), diff --git a/lib/views/globalsettingsview.dart b/lib/views/globalsettingsview.dart index 22d02dfc..66b14ec2 100644 --- a/lib/views/globalsettingsview.dart +++ b/lib/views/globalsettingsview.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'dart:io'; import 'package:cwtch/cwtch_icons_icons.dart'; import 'package:cwtch/models/servers.dart'; +import 'package:cwtch/themes/opaque.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:flutter/material.dart'; import 'package:cwtch/settings.dart'; @@ -36,7 +37,7 @@ class _GlobalSettingsViewState extends State { Widget _buildSettingsList() { return Consumer(builder: (context, settings, child) { return LayoutBuilder(builder: (BuildContext context, BoxConstraints viewportConstraints) { - var appIcon = Icon(Icons.info, color: settings.current().mainTextColor()); + var appIcon = Icon(Icons.info, color: settings.current().mainTextColor); return Scrollbar( isAlwaysShown: true, child: SingleChildScrollView( @@ -47,8 +48,8 @@ class _GlobalSettingsViewState extends State { ), child: Column(children: [ ListTile( - title: Text(AppLocalizations.of(context)!.settingLanguage, style: TextStyle(color: settings.current().mainTextColor())), - leading: Icon(CwtchIcons.change_language, color: settings.current().mainTextColor()), + title: Text(AppLocalizations.of(context)!.settingLanguage, style: TextStyle(color: settings.current().mainTextColor)), + leading: Icon(CwtchIcons.change_language, color: settings.current().mainTextColor), trailing: DropdownButton( value: Provider.of(context).locale.languageCode, onChanged: (String? newValue) { @@ -64,25 +65,42 @@ class _GlobalSettingsViewState extends State { ); }).toList())), SwitchListTile( - title: Text(AppLocalizations.of(context)!.settingTheme, style: TextStyle(color: settings.current().mainTextColor())), - value: settings.current().identifier() == "light", + title: Text(AppLocalizations.of(context)!.settingTheme, style: TextStyle(color: settings.current().mainTextColor)), + value: settings.current().mode == mode_light, onChanged: (bool value) { if (value) { - settings.setLight(); + settings.setTheme(settings.theme.theme, mode_light); } else { - settings.setDark(); + settings.setTheme(settings.theme.theme, mode_dark); } // Save Settings... saveSettings(context); }, - activeTrackColor: settings.theme.defaultButtonActiveColor(), - inactiveTrackColor: settings.theme.defaultButtonDisabledColor(), - secondary: Icon(CwtchIcons.change_theme, color: settings.current().mainTextColor()), + activeTrackColor: settings.theme.defaultButtonActiveColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(CwtchIcons.change_theme, color: settings.current().mainTextColor), ), ListTile( - title: Text(AppLocalizations.of(context)!.settingUIColumnPortrait, style: TextStyle(color: settings.current().mainTextColor())), - leading: Icon(Icons.table_chart, color: settings.current().mainTextColor()), + title: Text("Colour Theme"), + //AppLocalizations.of(context)!.settingTheme)), + trailing: DropdownButton( + value: Provider.of(context).theme.theme, + onChanged: (String? newValue) { + setState(() { + settings.setTheme(newValue!, settings.theme.mode); + saveSettings(context); + }); + }, + items: themes.keys.map>((String themeId) { + return DropdownMenuItem( + value: themeId, + child: Text(themes[themeId]?[mode_light]?.name ?? "Unknown"), //todo translate + ); + }).toList())), + ListTile( + title: Text(AppLocalizations.of(context)!.settingUIColumnPortrait, style: TextStyle(color: settings.current().mainTextColor)), + leading: Icon(Icons.table_chart, color: settings.current().mainTextColor), trailing: DropdownButton( value: settings.uiColumnModePortrait.toString(), onChanged: (String? newValue) { @@ -100,9 +118,9 @@ class _GlobalSettingsViewState extends State { AppLocalizations.of(context)!.settingUIColumnLandscape, textWidthBasis: TextWidthBasis.longestLine, softWrap: true, - style: TextStyle(color: settings.current().mainTextColor()), + style: TextStyle(color: settings.current().mainTextColor), ), - leading: Icon(Icons.table_chart, color: settings.current().mainTextColor()), + leading: Icon(Icons.table_chart, color: settings.current().mainTextColor), trailing: Container( width: 200.0, child: DropdownButton( @@ -122,7 +140,7 @@ class _GlobalSettingsViewState extends State { ); }).toList()))), SwitchListTile( - title: Text(AppLocalizations.of(context)!.blockUnknownLabel, style: TextStyle(color: settings.current().mainTextColor())), + title: Text(AppLocalizations.of(context)!.blockUnknownLabel, style: TextStyle(color: settings.current().mainTextColor)), subtitle: Text(AppLocalizations.of(context)!.descriptionBlockUnknownConnections), value: settings.blockUnknownConnections, onChanged: (bool value) { @@ -135,12 +153,12 @@ class _GlobalSettingsViewState extends State { // Save Settings... saveSettings(context); }, - activeTrackColor: settings.theme.defaultButtonActiveColor(), - inactiveTrackColor: settings.theme.defaultButtonDisabledColor(), - secondary: Icon(CwtchIcons.block_unknown, color: settings.current().mainTextColor()), + activeTrackColor: settings.theme.defaultButtonActiveColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(CwtchIcons.block_unknown, color: settings.current().mainTextColor), ), SwitchListTile( - title: Text(AppLocalizations.of(context)!.streamerModeLabel, style: TextStyle(color: settings.current().mainTextColor())), + title: Text(AppLocalizations.of(context)!.streamerModeLabel, style: TextStyle(color: settings.current().mainTextColor)), subtitle: Text(AppLocalizations.of(context)!.descriptionStreamerMode), value: settings.streamerMode, onChanged: (bool value) { @@ -148,12 +166,12 @@ class _GlobalSettingsViewState extends State { // Save Settings... saveSettings(context); }, - activeTrackColor: settings.theme.defaultButtonActiveColor(), - inactiveTrackColor: settings.theme.defaultButtonDisabledColor(), - secondary: Icon(CwtchIcons.streamer_bunnymask, color: settings.current().mainTextColor()), + activeTrackColor: settings.theme.defaultButtonActiveColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(CwtchIcons.streamer_bunnymask, color: settings.current().mainTextColor), ), SwitchListTile( - title: Text(AppLocalizations.of(context)!.experimentsEnabled, style: TextStyle(color: settings.current().mainTextColor())), + title: Text(AppLocalizations.of(context)!.experimentsEnabled, style: TextStyle(color: settings.current().mainTextColor)), subtitle: Text(AppLocalizations.of(context)!.descriptionExperiments), value: settings.experimentsEnabled, onChanged: (bool value) { @@ -165,16 +183,16 @@ class _GlobalSettingsViewState extends State { // Save Settings... saveSettings(context); }, - activeTrackColor: settings.theme.defaultButtonActiveColor(), - inactiveTrackColor: settings.theme.defaultButtonDisabledColor(), - secondary: Icon(CwtchIcons.enable_experiments, color: settings.current().mainTextColor()), + activeTrackColor: settings.theme.defaultButtonActiveColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(CwtchIcons.enable_experiments, color: settings.current().mainTextColor), ), Visibility( visible: settings.experimentsEnabled, child: Column( children: [ SwitchListTile( - title: Text(AppLocalizations.of(context)!.enableGroups, style: TextStyle(color: settings.current().mainTextColor())), + title: Text(AppLocalizations.of(context)!.enableGroups, style: TextStyle(color: settings.current().mainTextColor)), subtitle: Text(AppLocalizations.of(context)!.descriptionExperimentsGroups), value: settings.isExperimentEnabled(TapirGroupsExperiment), onChanged: (bool value) { @@ -186,14 +204,14 @@ class _GlobalSettingsViewState extends State { // Save Settings... saveSettings(context); }, - activeTrackColor: settings.theme.defaultButtonActiveColor(), - inactiveTrackColor: settings.theme.defaultButtonDisabledColor(), - secondary: Icon(CwtchIcons.enable_groups, color: settings.current().mainTextColor()), + activeTrackColor: settings.theme.defaultButtonActiveColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(CwtchIcons.enable_groups, color: settings.current().mainTextColor), ), Visibility( visible: !Platform.isAndroid && !Platform.isIOS, child: SwitchListTile( - title: Text(AppLocalizations.of(context)!.settingServers, style: TextStyle(color: settings.current().mainTextColor())), + title: Text(AppLocalizations.of(context)!.settingServers, style: TextStyle(color: settings.current().mainTextColor)), subtitle: Text(AppLocalizations.of(context)!.settingServersDescription), value: settings.isExperimentEnabled(ServerManagementExperiment), onChanged: (bool value) { @@ -206,12 +224,12 @@ class _GlobalSettingsViewState extends State { // Save Settings... saveSettings(context); }, - activeTrackColor: settings.theme.defaultButtonActiveColor(), - inactiveTrackColor: settings.theme.defaultButtonDisabledColor(), - secondary: Icon(CwtchIcons.dns_24px, color: settings.current().mainTextColor()), + activeTrackColor: settings.theme.defaultButtonActiveColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(CwtchIcons.dns_24px, color: settings.current().mainTextColor), )), SwitchListTile( - title: Text(AppLocalizations.of(context)!.settingFileSharing, style: TextStyle(color: settings.current().mainTextColor())), + title: Text(AppLocalizations.of(context)!.settingFileSharing, style: TextStyle(color: settings.current().mainTextColor)), subtitle: Text(AppLocalizations.of(context)!.descriptionFileSharing), value: settings.isExperimentEnabled(FileSharingExperiment), onChanged: (bool value) { @@ -222,9 +240,9 @@ class _GlobalSettingsViewState extends State { } saveSettings(context); }, - activeTrackColor: settings.theme.defaultButtonActiveColor(), - inactiveTrackColor: settings.theme.defaultButtonDisabledColor(), - secondary: Icon(Icons.attach_file, color: settings.current().mainTextColor()), + activeTrackColor: settings.theme.defaultButtonActiveColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(Icons.attach_file, color: settings.current().mainTextColor), ), SwitchListTile( title: Text(AppLocalizations.of(context)!.enableExperimentClickableLinks, style: TextStyle(color: settings.current().mainTextColor())), @@ -238,9 +256,9 @@ class _GlobalSettingsViewState extends State { } saveSettings(context); }, - activeTrackColor: settings.theme.defaultButtonActiveColor(), - inactiveTrackColor: settings.theme.defaultButtonDisabledColor(), - secondary: Icon(Icons.link, color: settings.current().mainTextColor()), + activeTrackColor: settings.theme.defaultButtonActiveColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(Icons.link, color: settings.current().mainTextColor), ), ], )), @@ -251,8 +269,8 @@ class _GlobalSettingsViewState extends State { applicationLegalese: '\u{a9} 2021 Open Privacy Research Society', aboutBoxChildren: [ Padding( - padding: EdgeInsets.fromLTRB( - 24.0 + 10.0 + (appIcon.size ?? 24.0), 16.0, 0.0, 0.0), // About has 24 padding (ln 389) and there appears to be another 10 of padding in the widget + padding: EdgeInsets.fromLTRB(24.0 + 10.0 + (appIcon.size ?? 24.0), 16.0, 0.0, 0.0), + // About has 24 padding (ln 389) and there appears to be another 10 of padding in the widget child: SelectableText(AppLocalizations.of(context)!.versionBuilddate.replaceAll("%1", EnvironmentConfig.BUILD_VER).replaceAll("%2", EnvironmentConfig.BUILD_DATE)), ) ]), diff --git a/lib/views/messageview.dart b/lib/views/messageview.dart index 231170fe..516aadd3 100644 --- a/lib/views/messageview.dart +++ b/lib/views/messageview.dart @@ -104,7 +104,7 @@ class _MessageViewState extends State { return WillPopScope( onWillPop: _onWillPop, child: Scaffold( - backgroundColor: Provider.of(context).theme.backgroundMainColor(), + backgroundColor: Provider.of(context).theme.backgroundMainColor, floatingActionButton: appState.unreadMessagesBelow ? FloatingActionButton( child: Icon(Icons.arrow_downward), @@ -121,7 +121,7 @@ class _MessageViewState extends State { ProfileImage( imagePath: Provider.of(context).imagePath, diameter: 42, - border: Provider.of(context).current().portraitOnlineBorderColor(), + border: Provider.of(context).current().portraitOnlineBorderColor, badgeTextColor: Colors.red, badgeColor: Colors.red, ), @@ -226,7 +226,7 @@ class _MessageViewState extends State { bool isOffline = Provider.of(context).isOnline() == false; var composeBox = Container( - color: Provider.of(context).theme.backgroundMainColor(), + color: Provider.of(context).theme.backgroundMainColor, padding: EdgeInsets.all(2), margin: EdgeInsets.all(2), height: 100, @@ -234,7 +234,7 @@ class _MessageViewState extends State { children: [ Expanded( child: Container( - decoration: BoxDecoration(border: Border(top: BorderSide(color: Provider.of(context).theme.defaultButtonActiveColor()))), + decoration: BoxDecoration(border: Border(top: BorderSide(color: Provider.of(context).theme.defaultButtonActiveColor))), child: RawKeyboardListener( focusNode: FocusNode(), onKey: handleKeyPress, @@ -254,12 +254,12 @@ class _MessageViewState extends State { enabled: !isOffline, decoration: InputDecoration( hintText: isOffline ? "" : AppLocalizations.of(context)!.placeholderEnterMessage, - hintStyle: TextStyle(color: Provider.of(context).theme.sendHintTextColor()), + hintStyle: TextStyle(color: Provider.of(context).theme.sendHintTextColor), enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, enabled: true, suffixIcon: ElevatedButton( - child: Icon(CwtchIcons.send_24px, size: 24, color: Provider.of(context).theme.defaultButtonTextColor()), + child: Icon(CwtchIcons.send_24px, size: 24, color: Provider.of(context).theme.defaultButtonTextColor), onPressed: isOffline ? null : _sendMessage, ))), )))), @@ -279,8 +279,8 @@ class _MessageViewState extends State { margin: EdgeInsets.all(5), padding: EdgeInsets.all(5), color: message.getMetadata().senderHandle != Provider.of(context).selectedProfile - ? Provider.of(context).theme.messageFromOtherBackgroundColor() - : Provider.of(context).theme.messageFromMeBackgroundColor(), + ? Provider.of(context).theme.messageFromOtherBackgroundColor + : Provider.of(context).theme.messageFromMeBackgroundColor, child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ Stack(children: [ Align( @@ -315,7 +315,7 @@ class _MessageViewState extends State { } return Container( - color: Provider.of(context).theme.backgroundMainColor(), child: Column(mainAxisSize: MainAxisSize.min, children: children)); + color: Provider.of(context).theme.backgroundMainColor, child: Column(mainAxisSize: MainAxisSize.min, children: children)); } // Send the message if enter is pressed without the shift key... diff --git a/lib/views/peersettingsview.dart b/lib/views/peersettingsview.dart index 506c1706..0e02df17 100644 --- a/lib/views/peersettingsview.dart +++ b/lib/views/peersettingsview.dart @@ -105,7 +105,7 @@ class _PeerSettingsViewState extends State { height: 20, ), SwitchListTile( - title: Text(AppLocalizations.of(context)!.blockBtn, style: TextStyle(color: settings.current().mainTextColor())), + title: Text(AppLocalizations.of(context)!.blockBtn, style: TextStyle(color: settings.current().mainTextColor)), value: Provider.of(context).isBlocked, onChanged: (bool blocked) { // Save local blocked status @@ -137,14 +137,14 @@ class _PeerSettingsViewState extends State { Provider.of(context, listen: false).cwtch.SendProfileEvent(profileOnion, setPeerAttributeJson); } }, - activeTrackColor: settings.theme.defaultButtonActiveColor(), - inactiveTrackColor: settings.theme.defaultButtonDisabledColor(), - secondary: Icon(CwtchIcons.block_peer, color: settings.current().mainTextColor()), + activeTrackColor: settings.theme.defaultButtonActiveColor, + inactiveTrackColor: settings.theme.defaultButtonDisabledColor, + secondary: Icon(CwtchIcons.block_peer, color: settings.current().mainTextColor), ), ListTile( - title: Text(AppLocalizations.of(context)!.savePeerHistory, style: TextStyle(color: settings.current().mainTextColor())), + title: Text(AppLocalizations.of(context)!.savePeerHistory, style: TextStyle(color: settings.current().mainTextColor)), subtitle: Text(AppLocalizations.of(context)!.savePeerHistoryDescription), - leading: Icon(CwtchIcons.peer_history, color: settings.current().mainTextColor()), + leading: Icon(CwtchIcons.peer_history, color: settings.current().mainTextColor), trailing: DropdownButton( value: Provider.of(context).savePeerHistory == "DefaultDeleteHistory" ? AppLocalizations.of(context)!.dontSavePeerHistory diff --git a/lib/views/profilemgrview.dart b/lib/views/profilemgrview.dart index e4a6eba0..da72472c 100644 --- a/lib/views/profilemgrview.dart +++ b/lib/views/profilemgrview.dart @@ -46,20 +46,20 @@ class _ProfileMgrViewState extends State { return Provider.of(context, listen: false).cwtchIsClosing; }, child: Scaffold( - backgroundColor: settings.theme.backgroundMainColor(), + backgroundColor: settings.theme.backgroundMainColor, appBar: AppBar( title: Row(children: [ Icon( CwtchIcons.cwtch_knott, size: 36, - color: settings.theme.mainTextColor(), + color: settings.theme.mainTextColor, ), SizedBox( width: 10, ), Expanded( child: Text(MediaQuery.of(context).size.width > 600 ? AppLocalizations.of(context)!.titleManageProfiles : AppLocalizations.of(context)!.titleManageProfilesShort, - style: TextStyle(color: settings.current().mainTextColor()))) + style: TextStyle(color: settings.current().mainTextColor))) ]), actions: getActions(), ), @@ -93,7 +93,7 @@ class _ProfileMgrViewState extends State { // Unlock Profiles actions.add(IconButton( icon: Icon(CwtchIcons.lock_open_24px), - color: Provider.of(context).profiles.isEmpty ? Provider.of(context).theme.defaultButtonColor() : Provider.of(context).theme.mainTextColor(), + color: Provider.of(context).profiles.isEmpty ? Provider.of(context).theme.defaultButtonColor : Provider.of(context).theme.mainTextColor, tooltip: AppLocalizations.of(context)!.tooltipUnlockProfiles, onPressed: _modalUnlockProfiles, )); diff --git a/lib/views/serversview.dart b/lib/views/serversview.dart index 148d1daf..5e943b43 100644 --- a/lib/views/serversview.dart +++ b/lib/views/serversview.dart @@ -77,7 +77,7 @@ class _ServersView extends State { // Unlock Profiles actions.add(IconButton( icon: Icon(CwtchIcons.lock_open_24px), - color: Provider.of(context).servers.isEmpty ? Provider.of(context).theme.defaultButtonColor() : Provider.of(context).theme.mainTextColor(), + color: Provider.of(context).servers.isEmpty ? Provider.of(context).theme.defaultButtonColor : Provider.of(context).theme.mainTextColor, tooltip: AppLocalizations.of(context)!.tooltipUnlockProfiles, onPressed: _modalUnlockServers, )); diff --git a/lib/views/splashView.dart b/lib/views/splashView.dart index a5642f2d..4f495066 100644 --- a/lib/views/splashView.dart +++ b/lib/views/splashView.dart @@ -28,7 +28,7 @@ class SplashView extends StatelessWidget { padding: const EdgeInsets.all(20.0), child: Text(appState.appError == "" ? "Loading Cwtch..." : appState.appError, style: TextStyle( - fontSize: 16.0, color: appState.appError == "" ? Provider.of(context).theme.mainTextColor() : Provider.of(context).theme.textfieldErrorColor())), + fontSize: 16.0, color: appState.appError == "" ? Provider.of(context).theme.mainTextColor : Provider.of(context).theme.textfieldErrorColor)), ), Image(image: AssetImage("assets/Open_Privacy_Logo_lightoutline.png")), ])), diff --git a/lib/widgets/buttontextfield.dart b/lib/widgets/buttontextfield.dart index cd1cdb09..4c3ad2d2 100644 --- a/lib/widgets/buttontextfield.dart +++ b/lib/widgets/buttontextfield.dart @@ -48,23 +48,23 @@ class _CwtchButtonTextFieldState extends State { padding: EdgeInsets.fromLTRB(0.0, 4.0, 2.0, 2.0), tooltip: widget.tooltip, enableFeedback: true, - color: theme.current().mainTextColor(), - highlightColor: theme.current().defaultButtonColor(), - focusColor: theme.current().defaultButtonActiveColor(), - splashColor: theme.current().defaultButtonActiveColor(), + color: theme.current().mainTextColor, + highlightColor: theme.current().defaultButtonColor, + focusColor: theme.current().defaultButtonActiveColor, + splashColor: theme.current().defaultButtonActiveColor, ), floatingLabelBehavior: FloatingLabelBehavior.never, filled: true, - fillColor: theme.current().textfieldBackgroundColor(), - focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor(), width: 3.0)), - focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor(), width: 3.0)), - errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor(), width: 3.0)), + fillColor: theme.current().textfieldBackgroundColor, + focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 3.0)), + focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 3.0)), + errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 3.0)), errorStyle: TextStyle( - color: theme.current().textfieldErrorColor(), + color: theme.current().textfieldErrorColor, fontWeight: FontWeight.bold, ), contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), - enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor(), width: 3.0))), + enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 3.0))), ); }); } diff --git a/lib/widgets/contactrow.dart b/lib/widgets/contactrow.dart index 93bbb655..ff1e963f 100644 --- a/lib/widgets/contactrow.dart +++ b/lib/widgets/contactrow.dart @@ -23,7 +23,7 @@ class _ContactRowState extends State { var contact = Provider.of(context); return Card( clipBehavior: Clip.antiAlias, - color: Provider.of(context).selectedConversation == contact.onion ? Provider.of(context).theme.backgroundHilightElementColor() : null, + color: Provider.of(context).selectedConversation == contact.onion ? Provider.of(context).theme.backgroundHilightElementColor : null, borderOnForeground: false, margin: EdgeInsets.all(0.0), child: InkWell( @@ -32,16 +32,16 @@ class _ContactRowState extends State { padding: const EdgeInsets.all(6.0), //border size child: ProfileImage( badgeCount: contact.unreadMessages, - badgeColor: Provider.of(context).theme.portraitContactBadgeColor(), - badgeTextColor: Provider.of(context).theme.portraitContactBadgeTextColor(), + badgeColor: Provider.of(context).theme.portraitContactBadgeColor, + badgeTextColor: Provider.of(context).theme.portraitContactBadgeTextColor, diameter: 64.0, imagePath: contact.imagePath, maskOut: !contact.isOnline(), border: contact.isOnline() - ? Provider.of(context).theme.portraitOnlineBorderColor() + ? Provider.of(context).theme.portraitOnlineBorderColor : contact.isBlocked - ? Provider.of(context).theme.portraitBlockedBorderColor() - : Provider.of(context).theme.portraitOfflineBorderColor()), + ? Provider.of(context).theme.portraitBlockedBorderColor + : Provider.of(context).theme.portraitOfflineBorderColor), ), Expanded( child: Padding( @@ -55,20 +55,20 @@ class _ContactRowState extends State { style: TextStyle( fontSize: Provider.of(context).theme.contactOnionTextSize(), color: contact.isBlocked - ? Provider.of(context).theme.portraitBlockedTextColor() - : Provider.of(context).theme.mainTextColor()), //Provider.of(context).biggerFont, + ? Provider.of(context).theme.portraitBlockedTextColor + : Provider.of(context).theme.mainTextColor), //Provider.of(context).biggerFont, softWrap: true, overflow: TextOverflow.visible, ), Visibility( visible: contact.isGroup && contact.status == "Authenticated", child: LinearProgressIndicator( - color: Provider.of(context).theme.defaultButtonActiveColor(), + color: Provider.of(context).theme.defaultButtonActiveColor, )), Visibility( visible: !Provider.of(context).streamerMode, child: Text(contact.onion, - style: TextStyle(color: contact.isBlocked ? Provider.of(context).theme.portraitBlockedTextColor() : Provider.of(context).theme.mainTextColor())), + style: TextStyle(color: contact.isBlocked ? Provider.of(context).theme.portraitBlockedTextColor : Provider.of(context).theme.mainTextColor)), ) ], ))), @@ -81,7 +81,7 @@ class _ContactRowState extends State { iconSize: 16, icon: Icon( Icons.favorite, - color: Provider.of(context).theme.mainTextColor(), + color: Provider.of(context).theme.mainTextColor, ), tooltip: AppLocalizations.of(context)!.tooltipAcceptContactRequest, onPressed: _btnApprove, @@ -89,7 +89,7 @@ class _ContactRowState extends State { IconButton( padding: EdgeInsets.zero, iconSize: 16, - icon: Icon(Icons.delete, color: Provider.of(context).theme.mainTextColor()), + icon: Icon(Icons.delete, color: Provider.of(context).theme.mainTextColor), tooltip: AppLocalizations.of(context)!.tooltipRejectContactRequest, onPressed: _btnReject, ) @@ -98,7 +98,7 @@ class _ContactRowState extends State { ? IconButton( padding: EdgeInsets.zero, iconSize: 16, - icon: Icon(Icons.block, color: Provider.of(context).theme.mainTextColor()), + icon: Icon(Icons.block, color: Provider.of(context).theme.mainTextColor), onPressed: () {}, ) : Text(dateToNiceString(contact.lastMessageTime))), diff --git a/lib/widgets/cwtchlabel.dart b/lib/widgets/cwtchlabel.dart index b354c778..07ac3874 100644 --- a/lib/widgets/cwtchlabel.dart +++ b/lib/widgets/cwtchlabel.dart @@ -18,7 +18,7 @@ class _CwtchLabelState extends State { return Consumer(builder: (context, theme, child) { return Text( widget.label, - style: TextStyle(fontSize: 20, color: theme.current().mainTextColor()), + style: TextStyle(fontSize: 20, color: theme.current().mainTextColor), ); }); } diff --git a/lib/widgets/filebubble.dart b/lib/widgets/filebubble.dart index ea26052a..d9e0a44e 100644 --- a/lib/widgets/filebubble.dart +++ b/lib/widgets/filebubble.dart @@ -61,7 +61,7 @@ class FileBubbleState extends State { var wdgSender = Center( widthFactor: 1, child: SelectableText(senderDisplayStr + '\u202F', - style: TextStyle(fontSize: 9.0, color: fromMe ? Provider.of(context).theme.messageFromMeTextColor() : Provider.of(context).theme.messageFromOtherTextColor()))); + style: TextStyle(fontSize: 9.0, color: fromMe ? Provider.of(context).theme.messageFromMeTextColor : Provider.of(context).theme.messageFromOtherTextColor))); var wdgMessage = !showFileSharing ? Text(AppLocalizations.of(context)!.messageEnableFileSharing) @@ -84,7 +84,7 @@ class FileBubbleState extends State { } else { wdgDecorations = LinearProgressIndicator( value: Provider.of(context).downloadProgress(widget.fileKey()), - color: Provider.of(context).theme.defaultButtonActiveColor(), + color: Provider.of(context).theme.defaultButtonActiveColor, ); } } else if (flagStarted) { @@ -114,9 +114,9 @@ class FileBubbleState extends State { widthFactor: 1.0, child: Container( decoration: BoxDecoration( - color: fromMe ? Provider.of(context).theme.messageFromMeBackgroundColor() : Provider.of(context).theme.messageFromOtherBackgroundColor(), + color: fromMe ? Provider.of(context).theme.messageFromMeBackgroundColor : Provider.of(context).theme.messageFromOtherBackgroundColor, border: - Border.all(color: fromMe ? Provider.of(context).theme.messageFromMeBackgroundColor() : Provider.of(context).theme.messageFromOtherBackgroundColor(), width: 1), + Border.all(color: fromMe ? Provider.of(context).theme.messageFromMeBackgroundColor : Provider.of(context).theme.messageFromOtherBackgroundColor, width: 1), borderRadius: BorderRadius.only( topLeft: Radius.circular(borderRadiousEh), topRight: Radius.circular(borderRadiousEh), @@ -196,7 +196,7 @@ class FileBubbleState extends State { SelectableText( chrome + '\u202F', style: TextStyle( - color: Provider.of(context).theme.messageFromMeTextColor(), + color: Provider.of(context).theme.messageFromMeTextColor, ), textAlign: TextAlign.left, maxLines: 2, @@ -205,7 +205,7 @@ class FileBubbleState extends State { SelectableText( fileName + '\u202F', style: TextStyle( - color: Provider.of(context).theme.messageFromMeTextColor(), + color: Provider.of(context).theme.messageFromMeTextColor, fontWeight: FontWeight.bold, overflow: TextOverflow.ellipsis, ), @@ -216,7 +216,7 @@ class FileBubbleState extends State { SelectableText( prettyBytes(fileSize) + '\u202F' + '\n', style: TextStyle( - color: Provider.of(context).theme.messageFromMeTextColor(), + color: Provider.of(context).theme.messageFromMeTextColor, ), textAlign: TextAlign.left, maxLines: 2, @@ -225,7 +225,7 @@ class FileBubbleState extends State { subtitle: SelectableText( 'sha512: ' + rootHash + '\u202F', style: TextStyle( - color: Provider.of(context).theme.messageFromMeTextColor(), + color: Provider.of(context).theme.messageFromMeTextColor, fontSize: 10, fontFamily: "monospace", ), @@ -233,7 +233,7 @@ class FileBubbleState extends State { maxLines: 4, textWidthBasis: TextWidthBasis.parent, ), - leading: Icon(Icons.attach_file, size: 32, color: Provider.of(context).theme.messageFromMeTextColor())); + leading: Icon(Icons.attach_file, size: 32, color: Provider.of(context).theme.messageFromMeTextColor)); } // Construct an file chrome @@ -244,7 +244,7 @@ class FileBubbleState extends State { SelectableText( chrome + '\u202F', style: TextStyle( - color: Provider.of(context).theme.messageFromOtherTextColor(), + color: Provider.of(context).theme.messageFromOtherTextColor, ), textAlign: TextAlign.left, maxLines: 2, @@ -253,7 +253,7 @@ class FileBubbleState extends State { SelectableText( fileName + '\u202F', style: TextStyle( - color: Provider.of(context).theme.messageFromOtherTextColor(), + color: Provider.of(context).theme.messageFromOtherTextColor, fontWeight: FontWeight.bold, overflow: TextOverflow.ellipsis, ), @@ -264,7 +264,7 @@ class FileBubbleState extends State { SelectableText( AppLocalizations.of(context)!.labelFilesize + ': ' + prettyBytes(fileSize) + '\u202F' + '\n', style: TextStyle( - color: Provider.of(context).theme.messageFromOtherTextColor(), + color: Provider.of(context).theme.messageFromOtherTextColor, ), textAlign: TextAlign.left, maxLines: 2, @@ -273,7 +273,7 @@ class FileBubbleState extends State { subtitle: SelectableText( 'sha512: ' + rootHash + '\u202F', style: TextStyle( - color: Provider.of(context).theme.messageFromMeTextColor(), + color: Provider.of(context).theme.messageFromMeTextColor, fontSize: 10, fontFamily: "monospace", ), @@ -281,13 +281,13 @@ class FileBubbleState extends State { maxLines: 4, textWidthBasis: TextWidthBasis.parent, ), - leading: Icon(Icons.attach_file, size: 32, color: Provider.of(context).theme.messageFromOtherTextColor()), + leading: Icon(Icons.attach_file, size: 32, color: Provider.of(context).theme.messageFromOtherTextColor), trailing: Visibility( visible: speed != "0 B/s", child: SelectableText( speed + '\u202F', style: TextStyle( - color: Provider.of(context).theme.messageFromMeTextColor(), + color: Provider.of(context).theme.messageFromMeTextColor, ), textAlign: TextAlign.left, maxLines: 1, diff --git a/lib/widgets/invitationbubble.dart b/lib/widgets/invitationbubble.dart index 483ed833..e8ced225 100644 --- a/lib/widgets/invitationbubble.dart +++ b/lib/widgets/invitationbubble.dart @@ -56,7 +56,7 @@ class InvitationBubbleState extends State { var wdgSender = Center( widthFactor: 1, child: SelectableText(senderDisplayStr + '\u202F', - style: TextStyle(fontSize: 9.0, color: fromMe ? Provider.of(context).theme.messageFromMeTextColor() : Provider.of(context).theme.messageFromOtherTextColor()))); + style: TextStyle(fontSize: 9.0, color: fromMe ? Provider.of(context).theme.messageFromMeTextColor : Provider.of(context).theme.messageFromOtherTextColor))); // If we receive an invite for ourselves, treat it as a bug. The UI no longer allows this so it could have only come from // some kind of malfeasance. @@ -96,9 +96,9 @@ class InvitationBubbleState extends State { widthFactor: 1.0, child: Container( decoration: BoxDecoration( - color: fromMe ? Provider.of(context).theme.messageFromMeBackgroundColor() : Provider.of(context).theme.messageFromOtherBackgroundColor(), + color: fromMe ? Provider.of(context).theme.messageFromMeBackgroundColor : Provider.of(context).theme.messageFromOtherBackgroundColor, border: - Border.all(color: fromMe ? Provider.of(context).theme.messageFromMeBackgroundColor() : Provider.of(context).theme.messageFromOtherBackgroundColor(), width: 1), + Border.all(color: fromMe ? Provider.of(context).theme.messageFromMeBackgroundColor : Provider.of(context).theme.messageFromOtherBackgroundColor, width: 1), borderRadius: BorderRadius.only( topLeft: Radius.circular(borderRadiousEh), topRight: Radius.circular(borderRadiousEh), @@ -149,7 +149,7 @@ class InvitationBubbleState extends State { SelectableText( chrome + '\u202F', style: TextStyle( - color: Provider.of(context).theme.messageFromMeTextColor(), + color: Provider.of(context).theme.messageFromMeTextColor, ), textAlign: TextAlign.left, maxLines: 2, @@ -158,7 +158,7 @@ class InvitationBubbleState extends State { SelectableText( targetName + '\u202F', style: TextStyle( - color: Provider.of(context).theme.messageFromMeTextColor(), + color: Provider.of(context).theme.messageFromMeTextColor, ), textAlign: TextAlign.left, maxLines: 2, @@ -173,7 +173,7 @@ class InvitationBubbleState extends State { SelectableText( chrome + '\u202F', style: TextStyle( - color: Provider.of(context).theme.messageFromOtherTextColor(), + color: Provider.of(context).theme.messageFromOtherTextColor, ), textAlign: TextAlign.left, textWidthBasis: TextWidthBasis.longestLine, @@ -181,7 +181,7 @@ class InvitationBubbleState extends State { ), SelectableText( targetName + '\u202F', - style: TextStyle(color: Provider.of(context).theme.messageFromOtherTextColor()), + style: TextStyle(color: Provider.of(context).theme.messageFromOtherTextColor), textAlign: TextAlign.left, maxLines: 2, textWidthBasis: TextWidthBasis.longestLine, diff --git a/lib/widgets/messagebubble.dart b/lib/widgets/messagebubble.dart index f05908ed..ba4ecb95 100644 --- a/lib/widgets/messagebubble.dart +++ b/lib/widgets/messagebubble.dart @@ -48,7 +48,7 @@ class MessageBubbleState extends State { } } var wdgSender = SelectableText(senderDisplayStr, - style: TextStyle(fontSize: 9.0, color: fromMe ? Provider.of(context).theme.messageFromMeTextColor() : Provider.of(context).theme.messageFromOtherTextColor())); + style: TextStyle(fontSize: 9.0, color: fromMe ? Provider.of(context).theme.messageFromMeTextColor : Provider.of(context).theme.messageFromOtherTextColor)); var wdgMessage; @@ -58,7 +58,7 @@ class MessageBubbleState extends State { //key: Key(myKey), focusNode: _focus, style: TextStyle( - color: fromMe ? Provider.of(context).theme.messageFromMeTextColor() : Provider.of(context).theme.messageFromOtherTextColor(), + color: fromMe ? Provider.of(context).theme.messageFromMeTextColor : Provider.of(context).theme.messageFromOtherTextColor, ), textAlign: TextAlign.left, textWidthBasis: TextWidthBasis.longestLine, @@ -75,10 +75,10 @@ class MessageBubbleState extends State { //key: Key(myKey), focusNode: _focus, style: TextStyle( - color: fromMe ? Provider.of(context).theme.messageFromMeTextColor() : Provider.of(context).theme.messageFromOtherTextColor(), + color: fromMe ? Provider.of(context).theme.messageFromMeTextColor : Provider.of(context).theme.messageFromOtherTextColor, ), linkStyle: TextStyle( - color: Provider.of(context).current().mainTextColor(), + color: Provider.of(context).current().mainTextColor, ), textAlign: TextAlign.left, textWidthBasis: TextWidthBasis.longestLine, @@ -97,11 +97,11 @@ class MessageBubbleState extends State { decoration: BoxDecoration( color: error ? malformedColor - : (fromMe ? Provider.of(context).theme.messageFromMeBackgroundColor() : Provider.of(context).theme.messageFromOtherBackgroundColor()), + : (fromMe ? Provider.of(context).theme.messageFromMeBackgroundColor : Provider.of(context).theme.messageFromOtherBackgroundColor), border: Border.all( color: error ? malformedColor - : (fromMe ? Provider.of(context).theme.messageFromMeBackgroundColor() : Provider.of(context).theme.messageFromOtherBackgroundColor()), + : (fromMe ? Provider.of(context).theme.messageFromMeBackgroundColor : Provider.of(context).theme.messageFromOtherBackgroundColor), width: 1), borderRadius: BorderRadius.only( topLeft: Radius.circular(borderRadiousEh), diff --git a/lib/widgets/messagebubbledecorations.dart b/lib/widgets/messagebubbledecorations.dart index 22ba1e91..3c2ee679 100644 --- a/lib/widgets/messagebubbledecorations.dart +++ b/lib/widgets/messagebubbledecorations.dart @@ -26,7 +26,7 @@ class _MessageBubbleDecoration extends State { children: [ Text(widget.prettyDate, style: - TextStyle(fontSize: 9.0, color: widget.fromMe ? Provider.of(context).theme.messageFromMeTextColor() : Provider.of(context).theme.messageFromOtherTextColor()), + TextStyle(fontSize: 9.0, color: widget.fromMe ? Provider.of(context).theme.messageFromMeTextColor : Provider.of(context).theme.messageFromOtherTextColor), textAlign: widget.fromMe ? TextAlign.right : TextAlign.left), !widget.fromMe ? SizedBox(width: 1, height: 1) @@ -35,14 +35,14 @@ class _MessageBubbleDecoration extends State { child: widget.ackd == true ? Tooltip( message: AppLocalizations.of(context)!.acknowledgedLabel, - child: Icon(Icons.check_circle_outline, color: Provider.of(context).theme.messageFromMeTextColor(), size: 16)) + child: Icon(Icons.check_circle_outline, color: Provider.of(context).theme.messageFromMeTextColor, size: 16)) : (widget.errored == true ? Tooltip( message: AppLocalizations.of(context)!.couldNotSendMsgError, - child: Icon(Icons.error_outline, color: Provider.of(context).theme.messageFromMeTextColor(), size: 16)) + child: Icon(Icons.error_outline, color: Provider.of(context).theme.messageFromMeTextColor, size: 16)) : Tooltip( message: AppLocalizations.of(context)!.pendingLabel, - child: Icon(Icons.hourglass_bottom_outlined, color: Provider.of(context).theme.messageFromMeTextColor(), size: 16)))) + child: Icon(Icons.hourglass_bottom_outlined, color: Provider.of(context).theme.messageFromMeTextColor, size: 16)))) ], )); } diff --git a/lib/widgets/messagelist.dart b/lib/widgets/messagelist.dart index f56f9c66..32a81b73 100644 --- a/lib/widgets/messagelist.dart +++ b/lib/widgets/messagelist.dart @@ -35,15 +35,15 @@ class _MessageListState extends State { return RepaintBoundary( child: Container( - color: Provider.of(context).theme.backgroundMainColor(), + color: Provider.of(context).theme.backgroundMainColor, child: Column(children: [ Visibility( visible: showMessageWarning, child: Container( padding: EdgeInsets.all(5.0), - color: Provider.of(context).theme.defaultButtonActiveColor(), + color: Provider.of(context).theme.defaultButtonActiveColor, child: DefaultTextStyle( - style: TextStyle(color: Provider.of(context).theme.defaultButtonTextColor()), + style: TextStyle(color: Provider.of(context).theme.defaultButtonTextColor), child: showSyncing ? Text(AppLocalizations.of(context)!.serverNotSynced, textAlign: TextAlign.center) : showOfflineWarning @@ -66,7 +66,7 @@ class _MessageListState extends State { fit: BoxFit.scaleDown, alignment: Alignment.center, image: AssetImage("assets/core/negative_heart_512px.png"), - colorFilter: ColorFilter.mode(Provider.of(context).theme.hilightElementColor(), BlendMode.srcIn))), + colorFilter: ColorFilter.mode(Provider.of(context).theme.hilightElementColor, BlendMode.srcIn))), // Don't load messages for syncing server... child: loadMessages ? ScrollablePositionedList.builder( diff --git a/lib/widgets/messagerow.dart b/lib/widgets/messagerow.dart index 9941fb52..98f353c2 100644 --- a/lib/widgets/messagerow.dart +++ b/lib/widgets/messagerow.dart @@ -85,7 +85,7 @@ class MessageRowState extends State with SingleTickerProviderStateMi onPressed: () { Provider.of(context, listen: false).selectedIndex = Provider.of(context, listen: false).messageID; }, - icon: Icon(Icons.reply, color: Provider.of(context).theme.dropShadowColor()))); + icon: Icon(Icons.reply, color: Provider.of(context).theme.dropShadowColor))); Widget wdgSpacer = Flexible(child: SizedBox(width: 60, height: 10)); var widgetRow = []; @@ -96,7 +96,7 @@ class MessageRowState extends State with SingleTickerProviderStateMi actualMessage, ]; } else if (isBlocked && !showBlockedMessage) { - Color blockedMessageBackground = Provider.of(context).theme.messageFromOtherBackgroundColor(); + Color blockedMessageBackground = Provider.of(context).theme.messageFromOtherBackgroundColor; Widget wdgPortrait = Padding(padding: EdgeInsets.all(4.0), child: Icon(CwtchIcons.account_blocked)); widgetRow = [ wdgPortrait, @@ -118,7 +118,7 @@ class MessageRowState extends State with SingleTickerProviderStateMi AppLocalizations.of(context)!.blockedMessageMessage, //key: Key(myKey), style: TextStyle( - color: Provider.of(context).theme.messageFromOtherTextColor(), + color: Provider.of(context).theme.messageFromOtherTextColor, ), textAlign: TextAlign.center, textWidthBasis: TextWidthBasis.longestLine, @@ -152,8 +152,9 @@ class MessageRowState extends State with SingleTickerProviderStateMi diameter: 48.0, imagePath: Provider.of(context).senderImage ?? contact.imagePath, //maskOut: contact.status != "Authenticated", - border: contact.status == "Authenticated" ? Provider.of(context).theme.portraitOnlineBorderColor() : Provider.of(context).theme.portraitOfflineBorderColor(), - badgeTextColor: Colors.red, badgeColor: Colors.red, + border: contact.status == "Authenticated" ? Provider.of(context).theme.portraitOnlineBorderColor : Provider.of(context).theme.portraitOfflineBorderColor, + badgeTextColor: Colors.red, + badgeColor: Colors.red, tooltip: isContact ? AppLocalizations.of(context)!.contactGoto.replaceFirst("%1", senderDisplayStr) : AppLocalizations.of(context)!.addContact, ))); @@ -216,8 +217,8 @@ class MessageRowState extends State with SingleTickerProviderStateMi Widget _bubbleNew() { return Container( decoration: BoxDecoration( - color: Provider.of(context).theme.messageFromMeBackgroundColor(), - border: Border.all(color: Provider.of(context).theme.messageFromMeBackgroundColor(), width: 1), + color: Provider.of(context).theme.messageFromMeBackgroundColor, + border: Border.all(color: Provider.of(context).theme.messageFromMeBackgroundColor, width: 1), borderRadius: BorderRadius.only( topLeft: Radius.circular(8), topRight: Radius.circular(8), diff --git a/lib/widgets/passwordfield.dart b/lib/widgets/passwordfield.dart index acd79787..e8cedd9d 100644 --- a/lib/widgets/passwordfield.dart +++ b/lib/widgets/passwordfield.dart @@ -53,21 +53,21 @@ class _CwtchTextFieldState extends State { }, icon: Icon((obscureText ? CwtchIcons.eye_closed : CwtchIcons.eye_open), semanticLabel: label), tooltip: label, - color: theme.current().mainTextColor(), - highlightColor: theme.current().defaultButtonColor(), - focusColor: theme.current().defaultButtonActiveColor(), - splashColor: theme.current().defaultButtonActiveColor(), + color: theme.current().mainTextColor, + highlightColor: theme.current().defaultButtonColor, + focusColor: theme.current().defaultButtonActiveColor, + splashColor: theme.current().defaultButtonActiveColor, ), errorStyle: TextStyle( - color: theme.current().textfieldErrorColor(), + color: theme.current().textfieldErrorColor, fontWeight: FontWeight.bold, ), - focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor(), width: 3.0)), - focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor(), width: 3.0)), - errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor(), width: 3.0)), + focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 3.0)), + focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 3.0)), + errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 3.0)), filled: true, - fillColor: theme.current().textfieldBackgroundColor(), - enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor(), width: 3.0)), + fillColor: theme.current().textfieldBackgroundColor, + enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 3.0)), ), ); }); diff --git a/lib/widgets/profileimage.dart b/lib/widgets/profileimage.dart index 00001370..f790a520 100644 --- a/lib/widgets/profileimage.dart +++ b/lib/widgets/profileimage.dart @@ -28,11 +28,11 @@ class _ProfileImageState extends State { filterQuality: FilterQuality.medium, // We need some theme specific blending here...we might want to consider making this a theme level attribute colorBlendMode: !widget.maskOut - ? Provider.of(context).theme.identifier() == "dark" + ? Provider.of(context).theme.mode == mode_dark ? BlendMode.softLight : BlendMode.darken : BlendMode.srcOut, - color: Provider.of(context).theme.portraitBackgroundColor(), + color: Provider.of(context).theme.portraitBackgroundColor, isAntiAlias: true, width: widget.diameter, height: widget.diameter, diff --git a/lib/widgets/profilerow.dart b/lib/widgets/profilerow.dart index 39bce219..a5d9e418 100644 --- a/lib/widgets/profilerow.dart +++ b/lib/widgets/profilerow.dart @@ -32,11 +32,11 @@ class _ProfileRowState extends State { padding: const EdgeInsets.all(6.0), //border size child: ProfileImage( badgeCount: 0, - badgeColor: Provider.of(context).theme.portraitProfileBadgeColor(), - badgeTextColor: Provider.of(context).theme.portraitProfileBadgeTextColor(), + badgeColor: Provider.of(context).theme.portraitProfileBadgeColor, + badgeTextColor: Provider.of(context).theme.portraitProfileBadgeTextColor, diameter: 64.0, imagePath: profile.imagePath, - border: profile.isOnline ? Provider.of(context).theme.portraitOnlineBorderColor() : Provider.of(context).theme.portraitOfflineBorderColor())), + border: profile.isOnline ? Provider.of(context).theme.portraitOnlineBorderColor : Provider.of(context).theme.portraitOfflineBorderColor)), Expanded( child: Column( children: [ @@ -60,7 +60,7 @@ class _ProfileRowState extends State { IconButton( enableFeedback: true, tooltip: AppLocalizations.of(context)!.editProfile + " " + profile.nickname, - icon: Icon(Icons.create, color: Provider.of(context).current().mainTextColor()), + icon: Icon(Icons.create, color: Provider.of(context).current().mainTextColor), onPressed: () { _pushEditProfile(onion: profile.onion, displayName: profile.nickname, profileImage: profile.imagePath, encrypted: profile.isEncrypted); }, diff --git a/lib/widgets/quotedmessage.dart b/lib/widgets/quotedmessage.dart index 6d1854bc..78654f02 100644 --- a/lib/widgets/quotedmessage.dart +++ b/lib/widgets/quotedmessage.dart @@ -42,13 +42,13 @@ class QuotedMessageBubbleState extends State { } } var wdgSender = SelectableText(senderDisplayStr, - style: TextStyle(fontSize: 9.0, color: fromMe ? Provider.of(context).theme.messageFromMeTextColor() : Provider.of(context).theme.messageFromOtherTextColor())); + style: TextStyle(fontSize: 9.0, color: fromMe ? Provider.of(context).theme.messageFromMeTextColor : Provider.of(context).theme.messageFromOtherTextColor)); var wdgMessage = SelectableText( widget.body + '\u202F', focusNode: _focus, style: TextStyle( - color: fromMe ? Provider.of(context).theme.messageFromMeTextColor() : Provider.of(context).theme.messageFromOtherTextColor(), + color: fromMe ? Provider.of(context).theme.messageFromMeTextColor : Provider.of(context).theme.messageFromOtherTextColor, ), textAlign: TextAlign.left, textWidthBasis: TextWidthBasis.longestLine, @@ -61,11 +61,11 @@ class QuotedMessageBubbleState extends State { try { var qMessage = (snapshot.data! as Message); // Swap the background color for quoted tweets.. - var qTextColor = fromMe ? Provider.of(context).theme.messageFromOtherTextColor() : Provider.of(context).theme.messageFromMeTextColor(); + var qTextColor = fromMe ? Provider.of(context).theme.messageFromOtherTextColor : Provider.of(context).theme.messageFromMeTextColor; return Container( margin: EdgeInsets.all(5), padding: EdgeInsets.all(5), - color: fromMe ? Provider.of(context).theme.messageFromOtherBackgroundColor() : Provider.of(context).theme.messageFromMeBackgroundColor(), + color: fromMe ? Provider.of(context).theme.messageFromOtherBackgroundColor : Provider.of(context).theme.messageFromMeBackgroundColor, child: Wrap(runAlignment: WrapAlignment.spaceEvenly, alignment: WrapAlignment.spaceEvenly, runSpacing: 1.0, crossAxisAlignment: WrapCrossAlignment.center, children: [ Center(widthFactor: 1, child: Padding(padding: EdgeInsets.all(10.0), child: Icon(Icons.reply, size: 32, color: qTextColor))), Center(widthFactor: 1.0, child: DefaultTextStyle(child: qMessage.getPreviewWidget(context), style: TextStyle(color: qTextColor))) @@ -92,11 +92,11 @@ class QuotedMessageBubbleState extends State { decoration: BoxDecoration( color: error ? malformedColor - : (fromMe ? Provider.of(context).theme.messageFromMeBackgroundColor() : Provider.of(context).theme.messageFromOtherBackgroundColor()), + : (fromMe ? Provider.of(context).theme.messageFromMeBackgroundColor : Provider.of(context).theme.messageFromOtherBackgroundColor), border: Border.all( color: error ? malformedColor - : (fromMe ? Provider.of(context).theme.messageFromMeBackgroundColor() : Provider.of(context).theme.messageFromOtherBackgroundColor()), + : (fromMe ? Provider.of(context).theme.messageFromMeBackgroundColor : Provider.of(context).theme.messageFromOtherBackgroundColor), width: 1), borderRadius: BorderRadius.only( topLeft: Radius.circular(borderRadiousEh), diff --git a/lib/widgets/serverrow.dart b/lib/widgets/serverrow.dart index a4e8bb05..3acac630 100644 --- a/lib/widgets/serverrow.dart +++ b/lib/widgets/serverrow.dart @@ -29,7 +29,7 @@ class _ServerRowState extends State { Padding( padding: const EdgeInsets.all(6.0), //border size child: Icon(CwtchIcons.dns_24px, - color: server.running ? Provider.of(context).theme.portraitOnlineBorderColor() : Provider.of(context).theme.portraitOfflineBorderColor(), size: 64)), + color: server.running ? Provider.of(context).theme.portraitOnlineBorderColor : Provider.of(context).theme.portraitOfflineBorderColor, size: 64)), Expanded( child: Column( children: [ @@ -38,7 +38,7 @@ class _ServerRowState extends State { semanticsLabel: server.description, style: Provider.of(context) .biggerFont - .apply(color: server.running ? Provider.of(context).theme.portraitOnlineBorderColor() : Provider.of(context).theme.portraitOfflineBorderColor()), + .apply(color: server.running ? Provider.of(context).theme.portraitOnlineBorderColor : Provider.of(context).theme.portraitOfflineBorderColor), softWrap: true, overflow: TextOverflow.ellipsis, ), @@ -49,7 +49,7 @@ class _ServerRowState extends State { server.onion, softWrap: true, overflow: TextOverflow.ellipsis, - style: TextStyle(color: server.running ? Provider.of(context).theme.portraitOnlineBorderColor() : Provider.of(context).theme.portraitOfflineBorderColor()), + style: TextStyle(color: server.running ? Provider.of(context).theme.portraitOnlineBorderColor : Provider.of(context).theme.portraitOfflineBorderColor), ))) ], )), @@ -58,7 +58,7 @@ class _ServerRowState extends State { IconButton( enableFeedback: true, tooltip: AppLocalizations.of(context)!.copyServerKeys, - icon: Icon(CwtchIcons.address_copy_2, color: Provider.of(context).current().mainTextColor()), + icon: Icon(CwtchIcons.address_copy_2, color: Provider.of(context).current().mainTextColor), onPressed: () { Clipboard.setData(new ClipboardData(text: server.serverBundle)); }, @@ -68,7 +68,7 @@ class _ServerRowState extends State { IconButton( enableFeedback: true, tooltip: AppLocalizations.of(context)!.editServerTitle, - icon: Icon(Icons.create, color: Provider.of(context).current().mainTextColor()), + icon: Icon(Icons.create, color: Provider.of(context).current().mainTextColor), onPressed: () { _pushEditServer(server); }, diff --git a/lib/widgets/textfield.dart b/lib/widgets/textfield.dart index f3803391..3dddd5ee 100644 --- a/lib/widgets/textfield.dart +++ b/lib/widgets/textfield.dart @@ -45,17 +45,17 @@ class _CwtchTextFieldState extends State { hintText: widget.hintText, floatingLabelBehavior: FloatingLabelBehavior.never, filled: true, - focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor(), width: 3.0)), - focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor(), width: 3.0)), + focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 3.0)), + focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 3.0)), - errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor(), width: 3.0)), + errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldErrorColor, width: 3.0)), errorStyle: TextStyle( - color: theme.current().textfieldErrorColor(), + color: theme.current().textfieldErrorColor, fontWeight: FontWeight.bold, ), - fillColor: theme.current().textfieldBackgroundColor(), + fillColor: theme.current().textfieldBackgroundColor, contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), - enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor(), width: 3.0))), + enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(15.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 3.0))), ); }); } diff --git a/lib/widgets/tor_icon.dart b/lib/widgets/tor_icon.dart index 796e2a5f..5bdebfa8 100644 --- a/lib/widgets/tor_icon.dart +++ b/lib/widgets/tor_icon.dart @@ -19,7 +19,7 @@ class _TorIconState extends State { return RepaintBoundary( child: Icon( Provider.of(context).progress == 0 ? CwtchIcons.onion_off : (Provider.of(context).progress == 100 ? CwtchIcons.onion_on : CwtchIcons.onion_waiting), - color: Provider.of(context).theme.mainTextColor(), + color: Provider.of(context).theme.mainTextColor, semanticLabel: Provider.of(context).progress == 100 ? AppLocalizations.of(context)!.networkStatusOnline : (Provider.of(context).progress == 0 ? AppLocalizations.of(context)!.networkStatusDisconnected : AppLocalizations.of(context)!.networkStatusAttemptingTor), diff --git a/test/profileimage_test.dart b/test/profileimage_test.dart index cf582241..dc99213d 100644 --- a/test/profileimage_test.dart +++ b/test/profileimage_test.dart @@ -33,10 +33,10 @@ void main() { Widget testWidget = ProfileImage( imagePath: "profiles/001-centaur.png", - badgeTextColor: settingsEnglishDark.theme.portraitProfileBadgeTextColor(), - badgeColor: settingsEnglishDark.theme.portraitProfileBadgeColor(), + badgeTextColor: settingsEnglishDark.theme.portraitProfileBadgeTextColor, + badgeColor: settingsEnglishDark.theme.portraitProfileBadgeColor, maskOut: false, - border: settingsEnglishDark.theme.portraitOfflineBorderColor(), + border: settingsEnglishDark.theme.portraitOfflineBorderColor, diameter: 64.0, badgeCount: 10, );