Skip to content

Commit

Permalink
Merge pull request #101 from takenet/develop
Browse files Browse the repository at this point in the history
merge to main
  • Loading branch information
leonardogbr authored Mar 8, 2023
2 parents 6951275 + 8e95d18 commit bc9d790
Show file tree
Hide file tree
Showing 14 changed files with 163 additions and 117 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.0.34

* [DSHeader] Adding bottom property on appbar
* [DSHeader] Fixes to use with media preview page

## 0.0.33

* [DSHeader] Ajust layout with horizontal screen
Expand Down
26 changes: 26 additions & 0 deletions lib/blip_ds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export 'package:blip_ds/src/extensions/ds_delivery_report_status.extension.dart'
show DSDeliveryReportStatusExtension;

export 'src/enums/ds_align.enum.dart' show DSAlign;

/// Enums
export 'src/enums/ds_border_radius.enum.dart' show DSBorderRadius;
export 'src/enums/ds_delivery_report_status.enum.dart'
Expand All @@ -17,22 +18,27 @@ export 'src/models/ds_message_bubble_avatar_config.model.dart'
show DSMessageBubbleAvatarConfig;
export 'src/models/ds_message_bubble_style.model.dart'
show DSMessageBubbleStyle;

/// Models
export 'src/models/ds_message_item.model.dart' show DSMessageItemModel;
export 'src/models/ds_toast_props.model.dart' show DSToastProps;
export 'src/services/ds_bottom_sheet.service.dart' show DSBottomSheetService;

/// Services
export 'src/services/ds_dialog.service.dart' show DSDialogService;
export 'src/services/ds_toast.service.dart' show DSToastService;

/// Themes / Colors
export 'src/themes/colors/ds_colors.theme.dart' show DSColors;
export 'src/themes/colors/ds_linear_gradient.theme.dart' show DSLinearGradient;

/// Icons
export 'src/themes/icons/ds_icons.dart' show DSIcons;
export 'src/themes/texts/ds_cupertino_theme_data.theme.dart'
show DSCupertinoThemeData;
export 'src/themes/texts/ds_text_selection_theme.theme.dart'
show DSTextSelectionThemeData;

/// Themes / Texts
export 'src/themes/texts/ds_text_theme.theme.dart' show DSTextTheme;
export 'src/themes/texts/styles/ds_body_text_style.theme.dart'
Expand All @@ -43,18 +49,22 @@ export 'src/themes/texts/styles/ds_caption_small_text_style.theme.dart'
show DSCaptionSmallTextStyle;
export 'src/themes/texts/styles/ds_caption_text_style.theme.dart'
show DSCaptionTextStyle;

/// Themes / Texts / Styles
export 'src/themes/texts/styles/ds_headline_large_text_style.theme.dart'
show DSHeadlineLargeTextStyle;
export 'src/themes/texts/styles/ds_headline_small_text_style.theme.dart'
show DSHeadlineSmallTextStyle;

/// Themes / Texts / Utils
export 'src/themes/texts/utils/ds_font_families.theme.dart' show DSFontFamilies;
export 'src/themes/texts/utils/ds_font_weights.theme.dart' show DSFontWeights;
export 'src/utils/ds_animate.util.dart' show DSAnimate;
export 'src/utils/ds_linkify.util.dart' show DSLinkify;

/// Utils
export 'src/utils/ds_utils.util.dart' show DSUtils;

/// Widgets / Animations
export 'src/widgets/animations/ds_animated_size.widget.dart'
show DSAnimatedSize;
Expand All @@ -65,6 +75,7 @@ export 'src/widgets/animations/ds_spinner_loading.widget.dart'
show DSSpinnerLoading;
export 'src/widgets/buttons/ds_attachment_button.widget.dart'
show DSAttachmentButton;

/// Widgets / Buttons
export 'src/widgets/buttons/ds_button.widget.dart' show DSButton;
export 'src/widgets/buttons/ds_icon_button.widget.dart' show DSIconButton;
Expand All @@ -74,9 +85,11 @@ export 'src/widgets/buttons/ds_secondary_button.widget.dart'
export 'src/widgets/buttons/ds_send_button.widget.dart' show DSSendButton;
export 'src/widgets/buttons/ds_tertiary_button.widget.dart'
show DSTertiaryButton;

/// Widgets / Chat / Audio
export 'src/widgets/chat/audio/ds_audio_message_bubble.widget.dart'
show DSAudioMessageBubble;

/// Widgets / Carrousel
export 'src/widgets/chat/ds_carrousel.widget.dart' show DSCarrousel;
export 'src/widgets/chat/ds_delivery_report_icon.widget.dart'
Expand All @@ -85,30 +98,39 @@ export 'src/widgets/chat/ds_file_message_bubble.widget.dart'
show DSFileMessageBubble;
export 'src/widgets/chat/ds_image_message_bubble.widget.dart'
show DSImageMessageBubble;

/// Widgets / Chat
export 'src/widgets/chat/ds_message_bubble.widget.dart' show DSMessageBubble;
export 'src/widgets/chat/ds_message_bubble_detail.widget.dart'
show DSMessageBubbleDetail;
export 'src/widgets/chat/ds_text_message_bubble.widget.dart'
show DSTextMessageBubble;
export 'src/widgets/chat/ds_unsupported_content_message_bubble.widget.dart'
show DSUnsupportedContentMessageBubble;
export 'src/widgets/chat/ds_url_preview.widget.dart' show DSUrlPreview;

/// Widgets / Weblink
export 'src/widgets/chat/ds_weblink.widget.dart' show DSWeblink;
export 'src/widgets/chat/typing/ds_typing_dot_animation.widget.dart'
show DSTypingDotAnimation;

/// Widgets / Typing
export 'src/widgets/chat/typing/ds_typing_message_bubble.widget.dart'
show DSTypingAnimationMessageBubble;

/// Widgets / Video
export 'src/widgets/chat/video/ds_video_message_bubble.widget.dart'
show DSVideoMessageBubble;
export 'src/widgets/chat/video/ds_video_player.widget.dart' show DSVideoPlayer;

/// Widgets / Chat / Form Fields
export 'src/widgets/fields/ds_text_form_field.widget.dart' show DSTextFormField;

/// Widgets / Radio
export 'src/widgets/radio/ds_radio.widget.dart' show DSRadio;
export 'src/widgets/radio/ds_radio_tile.widget.dart' show DSRadioTile;
export 'src/widgets/switch/ds_switch.widget.dart' show DSSwitch;

/// Widgets / SwitchTile
export 'src/widgets/switch/ds_switch_tile.widget.dart' show DSSwitchTile;
export 'src/widgets/tags/ds_input_chip.widget.dart' show DSInputChip;
Expand All @@ -121,14 +143,18 @@ export 'src/widgets/texts/ds_headline_large_text.widget.dart'
show DSHeadlineLargeText;
export 'src/widgets/texts/ds_headline_small_text.widget.dart'
show DSHeadlineSmallText;

/// Widgets / Texts
export 'src/widgets/texts/ds_text.widget.dart' show DSText;

/// Widgets / Information message
export 'src/widgets/ticket_message/ds_ticket_message.widget.dart'
show DSTicketMessage;

/// Widgets / Utils
export 'src/widgets/utils/ds_cached_network_image_view.widget.dart'
show DSCachedNetworkImageView;
export 'src/widgets/utils/ds_card.widget.dart' show DSCard;
export 'src/widgets/utils/ds_chip.widget.dart' show DSChip;
export 'src/widgets/utils/ds_divider.widget.dart' show DSDivider;
export 'src/widgets/utils/ds_file_extension_icon.util.dart'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import 'package:filesize/filesize.dart';
import 'package:get/get.dart';

import 'package:blip_ds/src/services/ds_file.service.dart';
import '../../services/ds_file.service.dart';

class DSFileMessageBubbleController extends GetxController {
final isDownloading = RxBool(false);

String getFileSize(final int size) {
return filesize(size, 1);
return size > 0 ? filesize(size, 1) : '';
}

Future<void> openFile(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:get/get.dart';

class DSImageMessageBubbleController extends GetxController {
final error = RxBool(false);
final appBarVisible = RxBool(false);
final appBarVisible = RxBool(true);

void setError() {
error.value = true;
Expand Down
10 changes: 6 additions & 4 deletions lib/src/controllers/chat/ds_video_message_bubble.controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ class DSVideoMessageBubbleController {
final hasError = RxBool(false);

String size() {
return FileSize.getSize(
mediaSize,
precision: PrecisionValue.One,
);
return mediaSize > 0
? FileSize.getSize(
mediaSize,
precision: PrecisionValue.One,
)
: 'Download';
}

Future<void> setThumbnail() async {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/models/ds_document_select.model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class DSDocumentSelectOption {
return DSDocumentSelectOption(
label:
DSDocumentSelectValue(json['label']['type'], json['label']['value']),
value: json.containsKey('value')
value: json.containsKey('value') && json['value'] != null
? DSDocumentSelectValue(json['value']['type'], json['value']['value'])
: null,
);
Expand Down
9 changes: 6 additions & 3 deletions lib/src/widgets/chat/ds_file_message_bubble.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@ class DSFileMessageBubble extends StatelessWidget {
textAlign: TextAlign.center,
isSelectable: true,
),
DSCaptionSmallText(
controller.getFileSize(size),
color: color,
Visibility(
visible: size > 0,
child: DSCaptionSmallText(
controller.getFileSize(size),
color: color,
),
)
],
),
Expand Down
96 changes: 31 additions & 65 deletions lib/src/widgets/chat/ds_image_message_bubble.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ import '../../enums/ds_border_radius.enum.dart';
import '../../models/ds_document_select.model.dart';
import '../../models/ds_message_bubble_style.model.dart';
import '../../themes/colors/ds_colors.theme.dart';
import '../../themes/icons/ds_icons.dart';
import '../../utils/ds_utils.util.dart';
import '../animations/ds_spinner_loading.widget.dart';
import '../texts/ds_caption_text.widget.dart';
import '../texts/ds_headline_small_text.widget.dart';
import '../utils/ds_cached_network_image_view.widget.dart';
import '../utils/ds_user_avatar.widget.dart';
import '../animations/ds_spinner_loading.widget.dart';
import '../utils/ds_header.widget.dart';
import 'ds_document_select.widget.dart';
import 'ds_message_bubble.widget.dart';
import 'ds_show_more_text.widget.dart';
Expand Down Expand Up @@ -107,7 +105,7 @@ class _DSImageMessageBubbleState extends State<DSImageMessageBubble>
child: GestureDetector(
onTap: () {
if (!_controller.error.value) {
_controller.appBarVisible.value = false;
_controller.appBarVisible.value = true;

showGeneralDialog(
context: context,
Expand Down Expand Up @@ -200,67 +198,35 @@ class _DSImageMessageBubbleState extends State<DSImageMessageBubble>
value: SystemUiOverlayStyle.light.copyWith(
statusBarColor: Colors.transparent,
),
child: Container(
color: Colors.black,
child: SafeArea(
child: Obx(
() {
return Scaffold(
backgroundColor: Colors.transparent,
appBar: PreferredSize(
preferredSize: const Size.fromHeight(80.0),
child: AnimatedOpacity(
opacity: _controller.appBarVisible.value ? 1.0 : 0.0,
duration: DSUtils.defaultAnimationDuration,
child: Row(
children: [
IconButton(
splashRadius: 20.0,
padding: EdgeInsets.zero,
onPressed: () => Navigator.of(context).pop(),
icon: const Icon(
DSIcons.arrow_left_outline,
color: DSColors.neutralLightSnow,
size: 32.0,
),
),
Expanded(
child: ListTile(
contentPadding: EdgeInsets.zero,
leading: DSUserAvatar(
text: widget.appBarText,
uri: widget.appBarPhotoUri,
),
title: DSHeadlineSmallText(
widget.appBarText,
color: DSColors.neutralLightSnow,
),
),
),
],
),
),
),
body: GestureDetector(
onTap: () => _controller.showAppBar(),
child: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
padding: const EdgeInsets.all(8.0),
color: Colors.black,
child: PinchZoom(
resetDuration: const Duration(milliseconds: 100),
child: DSCachedNetworkImageView(
url: widget.url,
fit: BoxFit.contain,
align: widget.align,
style: widget.style,
),
),
),
child: Obx(
() => Scaffold(
backgroundColor: Colors.black,
extendBodyBehindAppBar: true,
appBar: DSHeader(
showBorder: false,
visible: _controller.appBarVisible.value,
title: widget.appBarText,
customerUri: widget.appBarPhotoUri,
customerName: widget.appBarText,
backgroundColor: Colors.black.withOpacity(.7),
systemUiOverlayStyle: SystemUiOverlayStyle.light.copyWith(
statusBarColor: Colors.transparent,
),
onBackButtonPressed: Get.back,
),
body: GestureDetector(
onTap: () => _controller.showAppBar(),
child: Container(
padding: const EdgeInsets.all(8.0),
child: PinchZoom(
child: DSCachedNetworkImageView(
url: widget.url,
fit: BoxFit.contain,
align: widget.align,
style: widget.style,
),
);
},
),
),
),
),
),
Expand Down
7 changes: 3 additions & 4 deletions lib/src/widgets/chat/video/ds_video_player.widget.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import 'package:flutter/material.dart';

import 'package:chewie/chewie.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';

import '../../../controllers/ds_video_player.controller.dart';
import '../../../themes/colors/ds_colors.theme.dart';
import '../../utils/ds_header.widget.dart';

class DSVideoPlayer extends StatelessWidget {
Expand Down Expand Up @@ -44,10 +42,11 @@ class DSVideoPlayer extends StatelessWidget {
child: Scaffold(
backgroundColor: Colors.black,
appBar: DSHeader(
showBorder: false,
title: appBarText,
customerUri: appBarPhotoUri,
customerName: appBarText,
backgroundColor: DSColors.neutralDarkEclipse.withOpacity(0.7),
backgroundColor: Colors.black.withOpacity(.7),
systemUiOverlayStyle: SystemUiOverlayStyle.light.copyWith(
statusBarColor: Colors.transparent,
),
Expand Down
3 changes: 3 additions & 0 deletions lib/src/widgets/fields/ds_text_form_field.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class DSTextFormField extends StatelessWidget {
this.showEmojiButton = false,
this.obscureText = false,
this.isEnabled = true,
this.focusNode,
});

final TextEditingController controller;
Expand All @@ -25,6 +26,7 @@ class DSTextFormField extends StatelessWidget {
final bool showEmojiButton;
final bool obscureText;
final bool isEnabled;
final FocusNode? focusNode;

final hasFocus = false.obs;
final _scrollController = ScrollController();
Expand Down Expand Up @@ -89,6 +91,7 @@ class DSTextFormField extends StatelessWidget {
textInputAction: textInputAction,
maxLines: obscureText ? 1 : maxLines,
onChanged: onChanged,
focusNode: focusNode,
),
),
),
Expand Down
Loading

0 comments on commit bc9d790

Please sign in to comment.