diff --git a/CHANGELOG.md b/CHANGELOG.md index a03350c0..c9558a8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.6 + +- Improved link color contrast in Dark Mode. + ## 0.3.5 - Added support for Reactions. diff --git a/lib/src/services/ds_dialog.service.dart b/lib/src/services/ds_dialog.service.dart index 33ff697d..481c1511 100644 --- a/lib/src/services/ds_dialog.service.dart +++ b/lib/src/services/ds_dialog.service.dart @@ -79,7 +79,7 @@ class DSDialogService { child: Container( constraints: const BoxConstraints(maxWidth: 400.0), decoration: BoxDecoration( - color: DSThemeService.isDarkMode() + color: DSThemeService.isDarkMode ? DSDarkColors.surface3 : DSColors.neutralLightSnow, borderRadius: const BorderRadius.all(Radius.circular(15.0)), diff --git a/lib/src/services/ds_theme.service.dart b/lib/src/services/ds_theme.service.dart index dc00775f..64050657 100644 --- a/lib/src/services/ds_theme.service.dart +++ b/lib/src/services/ds_theme.service.dart @@ -5,9 +5,9 @@ import '../themes/colors/ds_colors.theme.dart'; abstract class DSThemeService { static ThemeMode _themeMode = ThemeMode.light; - static setThemeMode(final ThemeMode themeMode) => _themeMode = themeMode; + static void setThemeMode(final ThemeMode themeMode) => _themeMode = themeMode; - static isDarkMode() => _themeMode == ThemeMode.dark; + static bool get isDarkMode => _themeMode == ThemeMode.dark; static Color get foregoundColor => _themeMode == ThemeMode.dark ? DSColors.neutralLightSnow diff --git a/lib/src/widgets/buttons/audio/ds_audio_resume_button.widget.dart b/lib/src/widgets/buttons/audio/ds_audio_resume_button.widget.dart index 740c4924..5aefa3d3 100644 --- a/lib/src/widgets/buttons/audio/ds_audio_resume_button.widget.dart +++ b/lib/src/widgets/buttons/audio/ds_audio_resume_button.widget.dart @@ -16,7 +16,7 @@ class DSAudioResumeButton extends DSTertiaryButton { 'assets/images/microphone.svg', package: DSUtils.packageName, colorFilter: ColorFilter.mode( - DSThemeService.isDarkMode() + DSThemeService.isDarkMode ? DSColors.neutralLightSnow : DSColors.neutralDarkRooftop, BlendMode.srcIn, diff --git a/lib/src/widgets/buttons/ds_custom_replies_icon_button.widget.dart b/lib/src/widgets/buttons/ds_custom_replies_icon_button.widget.dart index 3d905c78..4219c8f1 100644 --- a/lib/src/widgets/buttons/ds_custom_replies_icon_button.widget.dart +++ b/lib/src/widgets/buttons/ds_custom_replies_icon_button.widget.dart @@ -25,7 +25,7 @@ class DSCustomRepliesIconButton extends StatelessWidget { onPressed: onPressed, icon: Icon( DSIcons.message_talk_outline, - color: DSThemeService.isDarkMode() + color: DSThemeService.isDarkMode ? DSColors.neutralLightSnow : DSColors.neutralDarkRooftop, ), diff --git a/lib/src/widgets/buttons/ds_secondary_button.widget.dart b/lib/src/widgets/buttons/ds_secondary_button.widget.dart index 855a0333..8867d6d5 100644 --- a/lib/src/widgets/buttons/ds_secondary_button.widget.dart +++ b/lib/src/widgets/buttons/ds_secondary_button.widget.dart @@ -26,12 +26,12 @@ class DSSecondaryButton extends DSButton { Color? borderColor, }) : super( backgroundColor: backgroundColor ?? - (DSThemeService.isDarkMode() + (DSThemeService.isDarkMode ? DSDarkColors.surface3 : DSColors.neutralLightSnow), foregroundColor: foregroundColor ?? (isEnabled - ? DSThemeService.isDarkMode() + ? DSThemeService.isDarkMode ? DSColors.neutralLightSnow : DSColors.primaryNight : DSColors.neutralMediumElephant), diff --git a/lib/src/widgets/buttons/ds_tertiary_button.widget.dart b/lib/src/widgets/buttons/ds_tertiary_button.widget.dart index 70c3ea51..ca209b94 100644 --- a/lib/src/widgets/buttons/ds_tertiary_button.widget.dart +++ b/lib/src/widgets/buttons/ds_tertiary_button.widget.dart @@ -23,10 +23,10 @@ class DSTertiaryButton extends DSButton { }) : super( backgroundColor: Colors.transparent, foregroundColor: isEnabled - ? DSThemeService.isDarkMode() + ? DSThemeService.isDarkMode ? DSColors.neutralLightSnow : DSColors.neutralDarkCity - : DSThemeService.isDarkMode() + : DSThemeService.isDarkMode ? DSColors.neutralDarkCity : DSColors.neutralMediumElephant, ); diff --git a/lib/src/widgets/chat/ds_highlight.dart b/lib/src/widgets/chat/ds_highlight.dart index 8057eb69..7e7ec60d 100644 --- a/lib/src/widgets/chat/ds_highlight.dart +++ b/lib/src/widgets/chat/ds_highlight.dart @@ -40,7 +40,7 @@ class _DSTesteState extends State with TickerProviderStateMixin { decoration: DecorationTween( begin: BoxDecoration(), end: BoxDecoration( - color: DSThemeService.isDarkMode() + color: DSThemeService.isDarkMode ? DSDarkColors.surface1 : Colors.black.withValues(alpha: 0.1), ), diff --git a/lib/src/widgets/fields/ds_input_container.widget.dart b/lib/src/widgets/fields/ds_input_container.widget.dart index c169fb73..9a4dbde6 100644 --- a/lib/src/widgets/fields/ds_input_container.widget.dart +++ b/lib/src/widgets/fields/ds_input_container.widget.dart @@ -47,10 +47,10 @@ class DSInputContainer extends StatelessWidget { : DSColors.neutralLightBox, ), color: isEnabled - ? DSThemeService.isDarkMode() + ? DSThemeService.isDarkMode ? DSDarkColors.surface3 : DSColors.neutralLightSnow - : DSThemeService.isDarkMode() + : DSThemeService.isDarkMode ? DSDarkColors.surface1 : DSColors.neutralLightWhisper, ), diff --git a/lib/src/widgets/fields/ds_phone_input.widget.dart b/lib/src/widgets/fields/ds_phone_input.widget.dart index d058c263..01edb4f0 100644 --- a/lib/src/widgets/fields/ds_phone_input.widget.dart +++ b/lib/src/widgets/fields/ds_phone_input.widget.dart @@ -97,7 +97,7 @@ class _DSPhoneInputState extends State { () => Container( padding: const EdgeInsets.fromLTRB(12.0, 0.0, 4.0, 0.0), decoration: BoxDecoration( - color: DSThemeService.isDarkMode() + color: DSThemeService.isDarkMode ? DSDarkColors.surface3 : DSColors.neutralLightSnow, border: Border.all(color: _borderColor.value), @@ -118,7 +118,7 @@ class _DSPhoneInputState extends State { style: DSTextStyle( fontSize: 9.0, fontWeight: DSFontWeights.bold, - color: DSThemeService.isDarkMode() + color: DSThemeService.isDarkMode ? DSColors.neutralLightSnow : DSColors.neutralMediumCloud, ), @@ -271,7 +271,7 @@ class _DSPhoneInputState extends State { } else if (_focusNode.hasFocus && widget.shouldFocus) { return DSColors.primaryNight; } else { - return DSThemeService.isDarkMode() + return DSThemeService.isDarkMode ? DSDarkColors.surface0 : DSColors.neutralMediumWave; } diff --git a/lib/src/widgets/fields/ds_search_input.widget.dart b/lib/src/widgets/fields/ds_search_input.widget.dart index aba7a61f..0c7f5248 100644 --- a/lib/src/widgets/fields/ds_search_input.widget.dart +++ b/lib/src/widgets/fields/ds_search_input.widget.dart @@ -42,7 +42,7 @@ class DSSearchInput extends StatelessWidget { controller: controller, onChanged: onSearch, style: DSBodyTextStyle( - color: DSThemeService.isDarkMode() + color: DSThemeService.isDarkMode ? DSColors.neutralLightSnow : DSColors.neutralDarkCity), autofocus: false, @@ -58,7 +58,7 @@ class DSSearchInput extends StatelessWidget { ), ), ), - fillColor: DSThemeService.isDarkMode() + fillColor: DSThemeService.isDarkMode ? DSDarkColors.surface3 : DSColors.neutralLightSnow, prefixIconConstraints: const BoxConstraints( @@ -107,7 +107,7 @@ class DSSearchInput extends StatelessWidget { OutlineInputBorder _getBorder() => OutlineInputBorder( borderRadius: BorderRadius.circular(8.0), borderSide: BorderSide( - color: DSThemeService.isDarkMode() + color: DSThemeService.isDarkMode ? DSDarkColors.surface0 : DSColors.neutralMediumWave, width: 1.0, diff --git a/lib/src/widgets/fields/ds_select_input.widget.dart b/lib/src/widgets/fields/ds_select_input.widget.dart index 6f8049d8..875a6e90 100644 --- a/lib/src/widgets/fields/ds_select_input.widget.dart +++ b/lib/src/widgets/fields/ds_select_input.widget.dart @@ -52,7 +52,7 @@ class DSSelectInput extends StatelessWidget { controller: controller, onChanged: onChanged, style: DSBodyTextStyle( - color: DSThemeService.isDarkMode() + color: DSThemeService.isDarkMode ? DSColors.neutralLightSnow : DSColors.neutralDarkCity, ), @@ -65,7 +65,7 @@ class DSSelectInput extends StatelessWidget { color: DSColors.neutralMediumCloud, ), ), - fillColor: DSThemeService.isDarkMode() + fillColor: DSThemeService.isDarkMode ? DSDarkColors.surface3 : DSColors.neutralLightSnow, contentPadding: const EdgeInsets.all(10.0), @@ -79,7 +79,7 @@ class DSSelectInput extends StatelessWidget { enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(8.0), borderSide: BorderSide( - color: DSThemeService.isDarkMode() + color: DSThemeService.isDarkMode ? DSDarkColors.surface0 : DSColors.neutralMediumWave, width: 1.0, diff --git a/lib/src/widgets/fields/ds_text_field.widget.dart b/lib/src/widgets/fields/ds_text_field.widget.dart index a5247b45..404c6a73 100644 --- a/lib/src/widgets/fields/ds_text_field.widget.dart +++ b/lib/src/widgets/fields/ds_text_field.widget.dart @@ -141,10 +141,10 @@ class _DSTextFieldState extends State { onTapOutside: widget.onTapOutside, decoration: InputDecoration( fillColor: widget.isEnabled - ? DSThemeService.isDarkMode() + ? DSThemeService.isDarkMode ? DSDarkColors.surface3 : DSColors.neutralLightSnow - : DSThemeService.isDarkMode() + : DSThemeService.isDarkMode ? DSDarkColors.surface1 : DSColors.neutralLightWhisper, filled: true, diff --git a/lib/src/widgets/fields/ds_text_form_field.widget.dart b/lib/src/widgets/fields/ds_text_form_field.widget.dart index c5dd483b..92533aaa 100644 --- a/lib/src/widgets/fields/ds_text_form_field.widget.dart +++ b/lib/src/widgets/fields/ds_text_form_field.widget.dart @@ -66,10 +66,10 @@ class _DSTextFormFieldState extends State { padding: const EdgeInsets.fromLTRB(12.0, 6.0, 4.0, 6.0), decoration: BoxDecoration( color: widget.isEnabled - ? DSThemeService.isDarkMode() + ? DSThemeService.isDarkMode ? DSDarkColors.surface3 : DSColors.neutralLightSnow - : DSThemeService.isDarkMode() + : DSThemeService.isDarkMode ? DSDarkColors.surface1 : DSColors.neutralLightWhisper, border: Border.all(color: _borderColor.value), @@ -82,7 +82,7 @@ class _DSTextFormFieldState extends State { onChanged: widget.onChanged, style: DSBodyTextStyle( color: widget.isEnabled - ? DSThemeService.isDarkMode() + ? DSThemeService.isDarkMode ? DSColors.neutralLightSnow : DSColors.neutralDarkCity : DSColors.neutralMediumSilver, @@ -92,10 +92,10 @@ class _DSTextFormFieldState extends State { inputFormatters: widget.inputFormatters, decoration: InputDecoration( fillColor: widget.isEnabled - ? DSThemeService.isDarkMode() + ? DSThemeService.isDarkMode ? DSDarkColors.surface3 : DSColors.neutralLightSnow - : DSThemeService.isDarkMode() + : DSThemeService.isDarkMode ? DSDarkColors.surface1 : DSColors.neutralLightWhisper, contentPadding: EdgeInsets.zero, @@ -104,7 +104,7 @@ class _DSTextFormFieldState extends State { labelStyle: DSCaptionSmallTextStyle( fontWeight: DSFontWeights.bold, color: widget.isEnabled - ? DSThemeService.isDarkMode() + ? DSThemeService.isDarkMode ? DSColors.neutralLightSnow : DSColors.neutralMediumCloud : DSColors.neutralMediumSilver, @@ -148,11 +148,11 @@ class _DSTextFormFieldState extends State { } else if (_focusNode.hasFocus) { return DSColors.primaryNight; } else if (widget.isEnabled) { - return DSThemeService.isDarkMode() + return DSThemeService.isDarkMode ? DSDarkColors.surface0 : DSColors.neutralMediumWave; } else { - return DSThemeService.isDarkMode() + return DSThemeService.isDarkMode ? DSDarkColors.surface0 : DSColors.neutralLightBox; } diff --git a/lib/src/widgets/texts/ds_text.widget.dart b/lib/src/widgets/texts/ds_text.widget.dart index 3a7e98fb..bfaf1201 100644 --- a/lib/src/widgets/texts/ds_text.widget.dart +++ b/lib/src/widgets/texts/ds_text.widget.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; -import '../../services/ds_theme.service.dart'; import '../../services/ds_security.service.dart'; +import '../../services/ds_theme.service.dart'; import '../../themes/colors/ds_colors.theme.dart'; import '../../themes/texts/utils/ds_font_weights.theme.dart'; import '../../utils/ds_linkify.util.dart'; @@ -31,7 +31,7 @@ class DSText extends StatelessWidget { this.fontWeight = DSFontWeights.regular, this.fontStyle = FontStyle.normal, Color? color, - this.linkColor = DSColors.primaryNight, + Color? linkColor, this.overflow = TextOverflow.ellipsis, this.decoration, this.textAlign, @@ -40,6 +40,9 @@ class DSText extends StatelessWidget { this.isSelectable = false, this.height, }) : color = DSThemeService.foregoundColor, + linkColor = DSThemeService.isDarkMode + ? DSColors.primaryLight + : DSColors.primaryNight, span = null; DSText.rich( @@ -49,7 +52,7 @@ class DSText extends StatelessWidget { this.fontWeight = DSFontWeights.regular, this.fontStyle = FontStyle.normal, Color? color, - this.linkColor = DSColors.primaryNight, + Color? linkColor, this.overflow = TextOverflow.ellipsis, this.decoration, this.textAlign, @@ -58,6 +61,9 @@ class DSText extends StatelessWidget { this.isSelectable = false, this.height, }) : color = DSThemeService.foregoundColor, + linkColor = DSThemeService.isDarkMode + ? DSColors.primaryLight + : DSColors.primaryNight, text = null; @override diff --git a/lib/src/widgets/utils/ds_bottomsheet_countries.widget.dart b/lib/src/widgets/utils/ds_bottomsheet_countries.widget.dart index ac50c16d..05e81478 100644 --- a/lib/src/widgets/utils/ds_bottomsheet_countries.widget.dart +++ b/lib/src/widgets/utils/ds_bottomsheet_countries.widget.dart @@ -33,7 +33,7 @@ abstract class DSBottomSheetCountries { static Future _bottomSheetCountries() { return DSBottomSheetService( - darkMode: DSThemeService.isDarkMode() ? RxBool(true) : RxBool(false), + darkMode: DSThemeService.isDarkMode ? RxBool(true) : RxBool(false), fixedHeader: Column( children: [ Padding( diff --git a/lib/src/widgets/utils/ds_divider.widget.dart b/lib/src/widgets/utils/ds_divider.widget.dart index ded951ad..b6a3e015 100644 --- a/lib/src/widgets/utils/ds_divider.widget.dart +++ b/lib/src/widgets/utils/ds_divider.widget.dart @@ -12,7 +12,7 @@ class DSDivider extends Divider { Color? color, }) : super( color: color ?? - (DSThemeService.isDarkMode() + (DSThemeService.isDarkMode ? DSDarkColors.surface1 : DSColors.neutralMediumWave), ); diff --git a/pubspec.yaml b/pubspec.yaml index a810580d..7c42d6c1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: blip_ds description: Blip Design System for Flutter. -version: 0.3.5 +version: 0.3.6 homepage: https://github.com/takenet/blip-ds-flutter#readme repository: https://github.com/takenet/blip-ds-flutter