Skip to content

Commit

Permalink
Merge pull request #297 from takenet/release/0.3.4
Browse files Browse the repository at this point in the history
Release/0.3.4
  • Loading branch information
githubdoandre authored Feb 5, 2025
2 parents cf66419 + 963b042 commit 500fda2
Show file tree
Hide file tree
Showing 31 changed files with 247 additions and 94 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.4

- Added support to dark mode.

## 0.3.3

- [DSTabBar] Added new widget based on Material TabBar.
Expand Down
3 changes: 3 additions & 0 deletions devtools_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:
1 change: 1 addition & 0 deletions lib/blip_ds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export 'src/services/ds_file.service.dart' show DSFileService;
export 'src/services/ds_localization.service.dart' show DSLocalizationService;
export 'src/services/ds_media_format.service.dart' show DSMediaFormatService;
export 'src/services/ds_security.service.dart' show DSSecurityService;
export 'src/services/ds_theme.service.dart' show DSThemeService;
export 'src/services/ds_toast.service.dart' show DSToastService;
export 'src/themes/colors/ds_colors.theme.dart' show DSColors;
export 'src/themes/colors/ds_dark_colors.theme.dart' show DSDarkColors;
Expand Down
9 changes: 8 additions & 1 deletion lib/src/models/ds_media_link.model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,18 @@ class DSMediaLink {

DSMediaLink.fromJson(Map<String, dynamic> json)
: uri = json['uri'],
type = json['type'],
type = _formatMimeType(
type: json['type'],
),
title = json['title'],
text = json['text'],
aspectRatio = json['aspectRatio'],
size = json['size'],
authorizationRealm = json['authorizationRealm'],
previewUri = json['previewUri'];

static String _formatMimeType({
required final String? type,
}) =>
type?.toLowerCase().replaceFirst('sticker/', 'image/') ?? '';
}
62 changes: 35 additions & 27 deletions lib/src/services/ds_bottom_sheet.service.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../themes/colors/ds_colors.theme.dart';
import '../themes/colors/ds_dark_colors.theme.dart';

class DSBottomSheetService {
final BuildContext context;
final Widget Function(ScrollController?) builder;
final Widget? fixedHeader;
final bool hasBottomInsets;
final RxBool darkMode;

DSBottomSheetService({
required this.context,
required this.builder,
this.hasBottomInsets = true,
this.fixedHeader,
});
RxBool? darkMode,
}) : darkMode = darkMode ?? RxBool(false);

Widget _buildBottomSheet({
ScrollController? controller,
Expand All @@ -24,37 +28,39 @@ class DSBottomSheetService {
return GestureDetector(
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
behavior: HitTestBehavior.translucent,
child: Container(
padding: hasBottomInsets
? EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
)
: null,
margin: EdgeInsets.only(
top: MediaQueryData.fromView(window).padding.top + 10,
),
decoration: _border(),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Visibility(
visible: !hideGrabber,
replacement: Container(
decoration: _border(),
child: Obx(
() => Container(
padding: hasBottomInsets
? EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
)
: null,
margin: EdgeInsets.only(
top: MediaQueryData.fromView(window).padding.top + 10,
),
decoration: _border(),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Visibility(
visible: !hideGrabber,
replacement: Container(
decoration: _border(),
),
child: _grabber(),
),
child: _grabber(),
),
fixedHeader ?? const SizedBox.shrink(),
_buildChild(controller),
],
fixedHeader ?? const SizedBox.shrink(),
_buildChild(controller),
],
),
),
),
);
}

BoxDecoration _border() {
return const BoxDecoration(
color: DSColors.neutralLightSnow,
return BoxDecoration(
color: darkMode.value ? DSDarkColors.surface3 : DSColors.neutralLightSnow,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(22.0),
topRight: Radius.circular(22.0),
Expand All @@ -73,8 +79,10 @@ class DSBottomSheetService {
Container(
height: 4.0,
width: 32.0,
decoration: const BoxDecoration(
color: DSColors.neutralMediumWave,
decoration: BoxDecoration(
color: darkMode.value
? DSColors.neutralLightSnow
: DSColors.neutralMediumWave,
borderRadius: BorderRadius.all(
Radius.circular(15.0),
),
Expand Down
8 changes: 7 additions & 1 deletion lib/src/services/ds_dialog.service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import 'package:flutter/services.dart';

import '../enums/ds_dialog_type.enum.dart';
import '../themes/colors/ds_colors.theme.dart';
import '../themes/colors/ds_dark_colors.theme.dart';
import '../themes/icons/ds_icons.dart';
import '../themes/system_overlay/ds_system_overlay.style.dart';
import '../widgets/texts/ds_body_text.widget.dart';
import '../widgets/texts/ds_headline_small_text.widget.dart';
import 'ds_context.service.dart';
import 'ds_theme.service.dart';

/// A Design System's [Dialog] used to display a dialog box.
class DSDialogService {
Expand Down Expand Up @@ -77,7 +79,9 @@ class DSDialogService {
child: Container(
constraints: const BoxConstraints(maxWidth: 400.0),
decoration: BoxDecoration(
color: DSColors.neutralLightSnow,
color: DSThemeService.isDarkMode()
? DSDarkColors.surface3
: DSColors.neutralLightSnow,
borderRadius: const BorderRadius.all(Radius.circular(15.0)),
boxShadow: [
BoxShadow(
Expand Down Expand Up @@ -151,6 +155,7 @@ class DSDialogService {
child: DSHeadlineSmallText(
title,
overflow: TextOverflow.visible,
color: DSColors.neutralDarkCity,
),
),
),
Expand All @@ -166,6 +171,7 @@ class DSDialogService {
child: DSBodyText(
text,
overflow: TextOverflow.clip,
color: DSThemeService.foregoundColor,
),
);
}
Expand Down
15 changes: 15 additions & 0 deletions lib/src/services/ds_theme.service.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:flutter/material.dart';

import '../themes/colors/ds_colors.theme.dart';

abstract class DSThemeService {
static ThemeMode _themeMode = ThemeMode.light;

static setThemeMode(final ThemeMode themeMode) => _themeMode = themeMode;

static isDarkMode() => _themeMode == ThemeMode.dark;

static Color get foregoundColor => _themeMode == ThemeMode.dark
? DSColors.neutralLightSnow
: DSColors.neutralDarkCity;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ class DSAudioIconButton extends DSTertiaryButton {
super.key,
super.onPressed,
super.isLoading,
Color? iconColor,
}) : super(
leadingIcon: SvgPicture.asset(
'assets/images/microphone.svg',
package: DSUtils.packageName,
colorFilter: const ColorFilter.mode(
DSColors.neutralDarkRooftop,
colorFilter: ColorFilter.mode(
iconColor ?? DSColors.neutralDarkRooftop,
BlendMode.srcIn,
),
height: 24.0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/painting.dart';
import 'package:flutter_svg/svg.dart';

import '../../../services/ds_theme.service.dart';
import '../../../themes/colors/ds_colors.theme.dart';
import '../../../utils/ds_utils.util.dart';
import '../ds_tertiary_button.widget.dart';
Expand All @@ -14,8 +15,10 @@ class DSAudioResumeButton extends DSTertiaryButton {
leadingIcon: SvgPicture.asset(
'assets/images/microphone.svg',
package: DSUtils.packageName,
colorFilter: const ColorFilter.mode(
DSColors.neutralDarkRooftop,
colorFilter: ColorFilter.mode(
DSThemeService.isDarkMode()
? DSColors.neutralLightSnow
: DSColors.neutralDarkRooftop,
BlendMode.srcIn,
),
height: 24.0,
Expand Down
5 changes: 3 additions & 2 deletions lib/src/widgets/buttons/ds_attachment_button.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ class DSAttachmentButton extends DSIconButton {
super.key,
required super.onPressed,
super.isLoading,
Color? iconColor,
}) : super(
icon: const Icon(
icon: Icon(
DSIcons.attach_outline,
color: DSColors.neutralDarkRooftop,
color: iconColor ?? DSColors.neutralDarkRooftop,
),
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';

import '../../services/ds_theme.service.dart';
import '../../themes/colors/ds_colors.theme.dart';
import '../../themes/icons/ds_icons.dart';
import 'ds_icon_button.widget.dart';
Expand All @@ -22,9 +23,11 @@ class DSCustomRepliesIconButton extends StatelessWidget {
child: DSIconButton(
isLoading: isLoading,
onPressed: onPressed,
icon: const Icon(
icon: Icon(
DSIcons.message_talk_outline,
color: DSColors.neutralDarkRooftop,
color: DSThemeService.isDarkMode()
? DSColors.neutralLightSnow
: DSColors.neutralDarkRooftop,
),
),
);
Expand Down
11 changes: 9 additions & 2 deletions lib/src/widgets/buttons/ds_secondary_button.widget.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:flutter/material.dart';

import '../../services/ds_theme.service.dart';
import '../../themes/colors/ds_colors.theme.dart';
import '../../themes/colors/ds_dark_colors.theme.dart';
import 'ds_button.widget.dart';

/// A Design System's [ButtonStyleButton] primarily used by secondary actions.
Expand All @@ -23,10 +25,15 @@ class DSSecondaryButton extends DSButton {
Color? foregroundColor,
Color? borderColor,
}) : super(
backgroundColor: backgroundColor ?? DSColors.neutralLightSnow,
backgroundColor: backgroundColor ??
(DSThemeService.isDarkMode()
? DSDarkColors.surface3
: DSColors.neutralLightSnow),
foregroundColor: foregroundColor ??
(isEnabled
? DSColors.primaryNight
? DSThemeService.isDarkMode()
? DSColors.neutralLightSnow
: DSColors.primaryNight
: DSColors.neutralMediumElephant),
borderColor: borderColor ??
(isEnabled
Expand Down
9 changes: 7 additions & 2 deletions lib/src/widgets/buttons/ds_tertiary_button.widget.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';

import '../../services/ds_theme.service.dart';
import '../../themes/colors/ds_colors.theme.dart';
import 'ds_button.widget.dart';

Expand All @@ -22,7 +23,11 @@ class DSTertiaryButton extends DSButton {
}) : super(
backgroundColor: Colors.transparent,
foregroundColor: isEnabled
? DSColors.neutralDarkCity
: DSColors.neutralMediumElephant,
? DSThemeService.isDarkMode()
? DSColors.neutralLightSnow
: DSColors.neutralDarkCity
: DSThemeService.isDarkMode()
? DSColors.neutralDarkCity
: DSColors.neutralMediumElephant,
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class _DSEndCallsMessageBubbleState extends State<DSEndCallsMessageBubble> {
: DSIcons.voip_calling_outline
: DSIcons.voip_ended_outline,
size: 24.0,
color: DSColors.neutralDarkCity,
),
),
),
Expand Down
6 changes: 5 additions & 1 deletion lib/src/widgets/chat/ds_highlight.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:flutter/material.dart';

import '../../controllers/chat/ds_highlight.controller.dart';
import '../../services/ds_theme.service.dart';
import '../../themes/colors/ds_dark_colors.theme.dart';

class DSHighlight extends StatefulWidget {
final Widget child;
Expand Down Expand Up @@ -38,7 +40,9 @@ class _DSTesteState extends State<DSHighlight> with TickerProviderStateMixin {
decoration: DecorationTween(
begin: BoxDecoration(),
end: BoxDecoration(
color: Colors.black.withValues(alpha: 0.1),
color: DSThemeService.isDarkMode()
? DSDarkColors.surface1
: Colors.black.withValues(alpha: 0.1),
),
).animate(animationController!),
child: widget.child,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class DSInteractiveVoiceCallMessageBubble extends StatelessWidget {
content.action?.name == 'voice_call'
? Column(
children: [
const Padding(
Padding(
padding: EdgeInsets.symmetric(
vertical: 8.0,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class _DSLocationMessageBubbleState extends State<DSLocationMessageBubble> {
),
),
),
const DSDivider()
DSDivider()
],
);
}
Expand Down
10 changes: 8 additions & 2 deletions lib/src/widgets/fields/ds_input_container.widget.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import 'package:flutter/material.dart';

import '../../enums/ds_input_container_shape.enum.dart';
import '../../services/ds_theme.service.dart';
import '../../themes/colors/ds_colors.theme.dart';
import '../../themes/colors/ds_dark_colors.theme.dart';
import '../../utils/ds_utils.util.dart';

class DSInputContainer extends StatelessWidget {
Expand Down Expand Up @@ -45,8 +47,12 @@ class DSInputContainer extends StatelessWidget {
: DSColors.neutralLightBox,
),
color: isEnabled
? DSColors.neutralLightSnow
: DSColors.neutralLightWhisper,
? DSThemeService.isDarkMode()
? DSDarkColors.surface3
: DSColors.neutralLightSnow
: DSThemeService.isDarkMode()
? DSDarkColors.surface1
: DSColors.neutralLightWhisper,
),
child: Container(
constraints: BoxConstraints(
Expand Down
Loading

0 comments on commit 500fda2

Please sign in to comment.