TF-2717 Display attachment bar below subject field on landscape mobile

This commit is contained in:
dab246
2024-03-25 14:52:23 +07:00
committed by Dat H. Pham
parent e6e25fc06d
commit 867e758d88
2 changed files with 67 additions and 20 deletions
@@ -21,6 +21,7 @@ class AttachmentItemComposerWidget extends StatelessWidget with AppLoaderMixin {
final UploadFileState fileState; final UploadFileState fileState;
final double? maxWidth; final double? maxWidth;
final EdgeInsetsGeometry? itemMargin; final EdgeInsetsGeometry? itemMargin;
final EdgeInsetsGeometry? itemPadding;
final OnDeleteAttachmentAction? onDeleteAttachmentAction; final OnDeleteAttachmentAction? onDeleteAttachmentAction;
final Widget? buttonAction; final Widget? buttonAction;
@@ -29,6 +30,7 @@ class AttachmentItemComposerWidget extends StatelessWidget with AppLoaderMixin {
required this.fileState, required this.fileState,
this.maxWidth, this.maxWidth,
this.itemMargin, this.itemMargin,
this.itemPadding,
this.buttonAction, this.buttonAction,
this.onDeleteAttachmentAction, this.onDeleteAttachmentAction,
}); });
@@ -42,7 +44,7 @@ class AttachmentItemComposerWidget extends StatelessWidget with AppLoaderMixin {
color: AttachmentItemComposerWidgetStyle.backgroundColor color: AttachmentItemComposerWidgetStyle.backgroundColor
), ),
width: AttachmentItemComposerWidgetStyle.width, width: AttachmentItemComposerWidgetStyle.width,
padding: AttachmentItemComposerWidgetStyle.padding, padding: itemPadding ?? AttachmentItemComposerWidgetStyle.padding,
margin: itemMargin, margin: itemMargin,
child: Row( child: Row(
children: [ children: [
@@ -60,25 +60,70 @@ class _MobileAttachmentComposerWidgetState extends State<MobileAttachmentCompose
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (_responsiveUtils.isLandscapeMobile(context)) if (_responsiveUtils.isLandscapeMobile(context))
SizedBox( Row(
width: _responsiveUtils.getSizeScreenWidth(context) * 0.7, crossAxisAlignment: CrossAxisAlignment.start,
child: GridView.builder( children: [
primary: false, Flexible(
shrinkWrap: true, flex: 7,
itemCount: _listFileDisplayed.length, child: GridView.builder(
gridDelegate: const SliverGridDelegateFixedHeight( primary: false,
height: MobileAttachmentComposerWidgetStyle.listItemHeight, shrinkWrap: true,
crossAxisCount: MobileAttachmentComposerWidgetStyle.maxItemRow, itemCount: _listFileDisplayed.length,
crossAxisSpacing: MobileAttachmentComposerWidgetStyle.listItemSpace, gridDelegate: const SliverGridDelegateFixedHeight(
height: MobileAttachmentComposerWidgetStyle.listItemHeight,
crossAxisCount: MobileAttachmentComposerWidgetStyle.maxItemRow,
crossAxisSpacing: MobileAttachmentComposerWidgetStyle.listItemSpace,
),
itemBuilder: (context, index) {
return AttachmentItemComposerWidget(
fileState: _listFileDisplayed[index],
itemMargin: MobileAttachmentComposerWidgetStyle.itemMargin,
itemPadding: const EdgeInsets.symmetric(horizontal: 8),
onDeleteAttachmentAction: widget.onDeleteAttachmentAction
);
}
)
), ),
itemBuilder: (context, index) { Flexible(
return AttachmentItemComposerWidget( flex: 3,
fileState: _listFileDisplayed[index], child: _isExceededDisplayedAttachments
itemMargin: MobileAttachmentComposerWidgetStyle.itemMargin, ? Row(
onDeleteAttachmentAction: widget.onDeleteAttachmentAction children: [
); if (!_isCollapsed)
} TMailButtonWidget(
), text: AppLocalizations.of(context).showLess,
icon: _imagePaths.icChevronUp,
iconAlignment: TextDirection.rtl,
iconSpace: 2,
iconSize: 24,
iconColor: AppColor.primaryColor,
backgroundColor: Colors.transparent,
textStyle: Theme.of(context).textTheme.labelSmall?.copyWith(
fontSize: 15,
color: AppColor.primaryColor
),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
margin: const EdgeInsetsDirectional.only(start: 8, top: 10),
onTapActionCallback: _toggleListAttachments
)
else
TMailButtonWidget.fromText(
text: AppLocalizations.of(context).showMoreAttachment(_countRemainingAttachments),
backgroundColor: Colors.transparent,
textStyle: Theme.of(context).textTheme.labelSmall?.copyWith(
fontSize: 15,
color: AppColor.primaryColor
),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
margin: const EdgeInsetsDirectional.only(start: 8, top: 10),
onTapActionCallback: _toggleListAttachments
),
const Spacer(),
],
)
: const SizedBox.shrink()
)
],
) )
else else
...[ ...[
@@ -122,7 +167,7 @@ class _MobileAttachmentComposerWidgetState extends State<MobileAttachmentCompose
), ),
if (_isCollapsed && _isExceededDisplayedAttachments) if (_isCollapsed && _isExceededDisplayedAttachments)
TMailButtonWidget.fromText( TMailButtonWidget.fromText(
text: AppLocalizations.of(context).showMore(_countRemainingAttachments), text: AppLocalizations.of(context).showMoreAttachment(_countRemainingAttachments),
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
textStyle: Theme.of(context).textTheme.labelSmall?.copyWith( textStyle: Theme.of(context).textTheme.labelSmall?.copyWith(
fontSize: 15, fontSize: 15,