TF-1714 Change ButtonBuilder to TMailButton widget
(cherry picked from commit fd536ff648370a60ef89d4428fedd949a3e62ae7)
This commit is contained in:
@@ -57,7 +57,21 @@ class MailboxView extends BaseMailboxView {
|
||||
Obx(() {
|
||||
if (controller.isSelectionEnabled()
|
||||
&& controller.listActionOfMailboxSelected.isNotEmpty) {
|
||||
return _buildOptionSelectionMailbox(context);
|
||||
return SafeArea(
|
||||
right: false,
|
||||
top: false,
|
||||
child: BottomBarSelectionMailboxWidget(
|
||||
controller.listMailboxSelected,
|
||||
controller.listActionOfMailboxSelected,
|
||||
onMailboxActionsClick: (actions, listMailboxSelected) {
|
||||
return controller.pressMailboxSelectionAction(
|
||||
context,
|
||||
actions,
|
||||
listMailboxSelected
|
||||
);
|
||||
}
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
@@ -369,35 +383,6 @@ class MailboxView extends BaseMailboxView {
|
||||
}).toList() ?? <Widget>[];
|
||||
}
|
||||
|
||||
Widget _buildOptionSelectionMailbox(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Divider(
|
||||
color: AppColor.lineItemListColor,
|
||||
height: 1,
|
||||
thickness: 0.2
|
||||
),
|
||||
SafeArea(
|
||||
right: false,
|
||||
top: false,
|
||||
child: BottomBarSelectionMailboxWidget(
|
||||
responsiveUtils,
|
||||
imagePaths,
|
||||
controller.listMailboxSelected,
|
||||
controller.listActionOfMailboxSelected,
|
||||
onMailboxActionsClick: (actions, listMailboxSelected) =>
|
||||
controller.pressMailboxSelectionAction(
|
||||
context,
|
||||
actions,
|
||||
listMailboxSelected
|
||||
)
|
||||
)
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildVersionInformation(BuildContext context, PackageInfo packageInfo) {
|
||||
return Container(
|
||||
color: AppColor.colorBgMailbox,
|
||||
|
||||
+32
-22
@@ -1,8 +1,9 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/presentation/views/button/button_builder.dart';
|
||||
import 'package:core/presentation/views/button/tmail_button_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_actions.dart';
|
||||
|
||||
@@ -10,15 +11,11 @@ typedef OnMailboxActionsClick = void Function(MailboxActions, List<PresentationM
|
||||
|
||||
class BottomBarSelectionMailboxWidget extends StatelessWidget {
|
||||
|
||||
final ResponsiveUtils _responsiveUtils;
|
||||
final ImagePaths _imagePaths;
|
||||
final List<PresentationMailbox> _listSelectionMailbox;
|
||||
final List<MailboxActions> _listMailboxActions;
|
||||
final OnMailboxActionsClick onMailboxActionsClick;
|
||||
|
||||
const BottomBarSelectionMailboxWidget(
|
||||
this._responsiveUtils,
|
||||
this._imagePaths,
|
||||
this._listSelectionMailbox,
|
||||
this._listMailboxActions,
|
||||
{
|
||||
@@ -30,23 +27,36 @@ class BottomBarSelectionMailboxWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(children: _listMailboxActions
|
||||
.map((action) => _buildMailboxActionButton(context, action))
|
||||
.toList());
|
||||
}
|
||||
final responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
final imagePaths = Get.find<ImagePaths>();
|
||||
|
||||
Widget _buildMailboxActionButton(BuildContext context, MailboxActions actions) {
|
||||
return Expanded(child: (ButtonBuilder(actions.getContextMenuIcon(_imagePaths))
|
||||
..radiusSplash(8)
|
||||
..padding(const EdgeInsets.all(8))
|
||||
..tooltip(actions.getTitleContextMenu(context))
|
||||
..textStyle(const TextStyle(fontSize: 12, color: AppColor.colorTextButton))
|
||||
..iconColor(AppColor.colorTextButton)
|
||||
..onPressActionClick(() => onMailboxActionsClick.call(actions, _listSelectionMailbox))
|
||||
..text(
|
||||
_responsiveUtils.isLandscapeMobile(context) ? null : actions.getTitleContextMenu(context),
|
||||
isVertical: true
|
||||
)
|
||||
).build());
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(top: BorderSide(
|
||||
color: AppColor.colorDividerHorizontal,
|
||||
width: 0.5,
|
||||
)),
|
||||
),
|
||||
child: IntrinsicHeight(
|
||||
child: Row(children: _listMailboxActions
|
||||
.map((action) {
|
||||
return Expanded(child: TMailButtonWidget(
|
||||
key: Key('${action.name}_button'),
|
||||
text: responsiveUtils.isLandscapeMobile(context)
|
||||
? ''
|
||||
: action.getTitleContextMenu(context),
|
||||
icon: action.getContextMenuIcon(imagePaths),
|
||||
borderRadius: 0,
|
||||
backgroundColor: Colors.transparent,
|
||||
flexibleText: true,
|
||||
tooltipMessage: action.getTitleContextMenu(context),
|
||||
textStyle: const TextStyle(fontSize: 12, color: AppColor.colorTextButton),
|
||||
onTapActionCallback: () => onMailboxActionsClick.call(action, _listSelectionMailbox),
|
||||
));
|
||||
})
|
||||
.toList()
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user