TF-105 Make buttons in EmailView easier to press
This commit is contained in:
@@ -6,11 +6,9 @@ import 'package:flutter/widgets.dart';
|
|||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
|
||||||
typedef OnPressActionClick = void Function();
|
typedef OnPressActionClick = void Function();
|
||||||
typedef OnTapDownActionClick = void Function(TapDownDetails details);
|
|
||||||
|
|
||||||
class ButtonBuilder {
|
class ButtonBuilder {
|
||||||
OnPressActionClick? _onPressActionClick;
|
OnPressActionClick? _onPressActionClick;
|
||||||
OnTapDownActionClick? _onTapActionClick;
|
|
||||||
|
|
||||||
String? _icon;
|
String? _icon;
|
||||||
String? _text;
|
String? _text;
|
||||||
@@ -20,63 +18,47 @@ class ButtonBuilder {
|
|||||||
Key? _key;
|
Key? _key;
|
||||||
Color? _color;
|
Color? _color;
|
||||||
|
|
||||||
ButtonBuilder key(Key key) {
|
void key(Key key) {
|
||||||
_key = key;
|
_key = key;
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ButtonBuilder size(double size) {
|
void size(double size) {
|
||||||
_size = size;
|
_size = size;
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ButtonBuilder color(Color color) {
|
void color(Color color) {
|
||||||
_color = color;
|
_color = color;
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ButtonBuilder padding(double padding) {
|
void padding(double padding) {
|
||||||
_padding = padding;
|
_padding = padding;
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ButtonBuilder text(String text, {required bool isVertical}) {
|
void text(String text, {required bool isVertical}) {
|
||||||
_text = text;
|
_text = text;
|
||||||
_isVertical = isVertical;
|
_isVertical = isVertical;
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ButtonBuilder(this._icon);
|
ButtonBuilder(this._icon);
|
||||||
|
|
||||||
ButtonBuilder onPressActionClick(OnPressActionClick onPressActionClick) {
|
void onPressActionClick(OnPressActionClick onPressActionClick) {
|
||||||
_onPressActionClick = onPressActionClick;
|
_onPressActionClick = onPressActionClick;
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ButtonBuilder onTapActionClick(OnTapDownActionClick onTapActionClick) {
|
|
||||||
_onTapActionClick = onTapActionClick;
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget build() {
|
Widget build() {
|
||||||
return Container(
|
return GestureDetector(
|
||||||
key: _key,
|
onTap: () {
|
||||||
alignment: Alignment.center,
|
if (_onPressActionClick != null) {
|
||||||
color: Colors.transparent,
|
_onPressActionClick!();
|
||||||
child: MediaQuery(
|
}
|
||||||
data: MediaQueryData(padding: EdgeInsets.zero),
|
},
|
||||||
child: GestureDetector(
|
child: Container(
|
||||||
child: _buildBody(),
|
key: _key,
|
||||||
onTap: () {
|
alignment: Alignment.center,
|
||||||
if (_onPressActionClick != null) {
|
color: Colors.transparent,
|
||||||
_onPressActionClick!();
|
child: MediaQuery(
|
||||||
}
|
data: MediaQueryData(padding: EdgeInsets.zero),
|
||||||
},
|
child: _buildBody()
|
||||||
onTapDown: (detail) {
|
|
||||||
if (_onTapActionClick != null) {
|
|
||||||
_onTapActionClick!(detail);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
+7
-7
@@ -40,13 +40,13 @@ class AppBarDestinationPickerBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildBackButton() {
|
Widget _buildBackButton() {
|
||||||
return ButtonBuilder(_imagePaths.icComposerClose)
|
return (ButtonBuilder(_imagePaths.icComposerClose)
|
||||||
.padding(5)
|
..padding(5)
|
||||||
.size(30)
|
..size(30)
|
||||||
.onPressActionClick(() {
|
..onPressActionClick(() {
|
||||||
if (_onCloseActionClick != null) {
|
if (_onCloseActionClick != null) {
|
||||||
_onCloseActionClick!();
|
_onCloseActionClick!();
|
||||||
}})
|
}}))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,29 +41,29 @@ class BottomBarMailWidgetBuilder {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
ButtonBuilder(_imagePaths.icReplyAll)
|
(ButtonBuilder(_imagePaths.icReplyAll)
|
||||||
.key(Key('button_reply_all_message'))
|
..key(Key('button_reply_all_message'))
|
||||||
.onPressActionClick(() {
|
..onPressActionClick(() {
|
||||||
if (_onPressEmailActionClick != null) {
|
if (_onPressEmailActionClick != null) {
|
||||||
_onPressEmailActionClick!(EmailActionType.replyAll);
|
_onPressEmailActionClick!(EmailActionType.replyAll);
|
||||||
}})
|
}})
|
||||||
.text(AppLocalizations.of(_context).reply_all, isVertical: _responsiveUtils.isMobile(_context))
|
..text(AppLocalizations.of(_context).reply_all, isVertical: _responsiveUtils.isMobile(_context)))
|
||||||
.build(),
|
.build(),
|
||||||
ButtonBuilder(_imagePaths.icReply)
|
(ButtonBuilder(_imagePaths.icReply)
|
||||||
.key(Key('button_reply_message'))
|
..key(Key('button_reply_message'))
|
||||||
.onPressActionClick(() {
|
..onPressActionClick(() {
|
||||||
if (_onPressEmailActionClick != null) {
|
if (_onPressEmailActionClick != null) {
|
||||||
_onPressEmailActionClick!(EmailActionType.reply);
|
_onPressEmailActionClick!(EmailActionType.reply);
|
||||||
}})
|
}})
|
||||||
.text(AppLocalizations.of(_context).reply, isVertical: _responsiveUtils.isMobile(_context))
|
..text(AppLocalizations.of(_context).reply, isVertical: _responsiveUtils.isMobile(_context)))
|
||||||
.build(),
|
.build(),
|
||||||
ButtonBuilder(_imagePaths.icForward)
|
(ButtonBuilder(_imagePaths.icForward)
|
||||||
.key(Key('button_forward_message'))
|
..key(Key('button_forward_message'))
|
||||||
.onPressActionClick(() {
|
..onPressActionClick(() {
|
||||||
if (_onPressEmailActionClick != null) {
|
if (_onPressEmailActionClick != null) {
|
||||||
_onPressEmailActionClick!(EmailActionType.forward);
|
_onPressEmailActionClick!(EmailActionType.forward);
|
||||||
}})
|
}})
|
||||||
.text(AppLocalizations.of(_context).forward, isVertical: _responsiveUtils.isMobile(_context))
|
..text(AppLocalizations.of(_context).forward, isVertical: _responsiveUtils.isMobile(_context)))
|
||||||
.build()
|
.build()
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -133,19 +133,19 @@ class EmailTileBuilder {
|
|||||||
overflow:TextOverflow.ellipsis,
|
overflow:TextOverflow.ellipsis,
|
||||||
style: TextStyle(fontSize: 12, color: AppColor.baseTextColor))),
|
style: TextStyle(fontSize: 12, color: AppColor.baseTextColor))),
|
||||||
if (_presentationEmail.hasAttachment == true)
|
if (_presentationEmail.hasAttachment == true)
|
||||||
ButtonBuilder(_imagePaths.icShare)
|
(ButtonBuilder(_imagePaths.icShare)
|
||||||
.padding(5)
|
..padding(5)
|
||||||
.size(20)
|
..size(20))
|
||||||
.build(),
|
.build(),
|
||||||
ButtonBuilder(_presentationEmail.isFlaggedEmail() ? _imagePaths.icFlagged : _imagePaths.icFlag)
|
(ButtonBuilder(_presentationEmail.isFlaggedEmail() ? _imagePaths.icFlagged : _imagePaths.icFlag)
|
||||||
.padding(5)
|
..padding(5)
|
||||||
.size(20)
|
..size(20)
|
||||||
.onPressActionClick(() {
|
..onPressActionClick(() {
|
||||||
if (_onMarkAsStarEmailActionClick != null) {
|
if (_onMarkAsStarEmailActionClick != null) {
|
||||||
_onMarkAsStarEmailActionClick!(_presentationEmail);
|
_onMarkAsStarEmailActionClick!(_presentationEmail);
|
||||||
}
|
}
|
||||||
})
|
}))
|
||||||
.build(),
|
.build(),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user