TF-248 Update UI and Action for selection multiple email

This commit is contained in:
dab246
2022-02-09 13:00:49 +07:00
committed by Dat H. Pham
parent 879692aa54
commit a48f508171
22 changed files with 443 additions and 155 deletions
@@ -51,6 +51,14 @@ class ImagePaths {
String get icFilter => _getImagePath('ic_filter.svg');
String get icSearchBar => _getImagePath('ic_search_bar.svg');
String get icCompose => _getImagePath('ic_compose.svg');
String get icReadV2 => _getImagePath('ic_read_v2.svg');
String get icUnreadV2 => _getImagePath('ic_unread_v2.svg');
String get icSelectedV2 => _getImagePath('ic_selected_v2.svg');
String get icUnSelectedV2 => _getImagePath('ic_unselected_v2.svg');
String get icDeleteV2 => _getImagePath('ic_delete_v2.svg');
String get icSpamV2 => _getImagePath('ic_spam_v2.svg');
String get icMoveV2 => _getImagePath('ic_move_v2.svg');
String get icFlagV2 => _getImagePath('ic_flag_v2.svg');
String _getImagePath(String imageName) {
return AssetsPaths.images + imageName;
@@ -13,10 +13,11 @@ class ButtonBuilder {
String? _icon;
String? _text;
double? _size;
double? _padding;
EdgeInsets? _paddingIcon;
bool? _isVertical;
Key? _key;
Color? _color;
Color? _iconColor;
TextStyle? _textStyle;
void key(Key key) {
_key = key;
@@ -26,12 +27,16 @@ class ButtonBuilder {
_size = size;
}
void color(Color color) {
_color = color;
void iconColor(Color color) {
_iconColor = color;
}
void padding(double padding) {
_padding = padding;
void textStyle(TextStyle style) {
_textStyle = style;
}
void paddingIcon(EdgeInsets paddingIcon) {
_paddingIcon = paddingIcon;
}
void text(String text, {required bool isVertical}) {
@@ -87,15 +92,15 @@ class ButtonBuilder {
}
Widget _buildIcon() => Padding(
padding: EdgeInsets.all(_padding ?? 10),
child: SvgPicture.asset(_icon ?? '', width: _size ?? 24, height: _size ?? 24, fit: BoxFit.fill, color: _color));
padding: _paddingIcon ?? EdgeInsets.all(10),
child: SvgPicture.asset(_icon ?? '', width: _size ?? 24, height: _size ?? 24, fit: BoxFit.fill, color: _iconColor));
Widget _buildText() {
return Text(
'${_text ?? ''}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 12, color: AppColor.textButtonColor, fontWeight: FontWeight.w500),
style: _textStyle ?? TextStyle(fontSize: 12, color: AppColor.textButtonColor, fontWeight: FontWeight.w500),
);
}
}
@@ -103,16 +103,20 @@ class _ScrollingFloatingButtonAnimatedState
_scrollController.position.userScrollDirection ==
ScrollDirection.reverse) {
if (widget.animateIcon!) _animationController.forward();
setState(() {
_onTop = false;
});
if (mounted) {
setState(() {
_onTop = false;
});
}
} else if (_scrollController.position.pixels <= widget.limitIndicator! &&
_scrollController.position.userScrollDirection ==
ScrollDirection.forward) {
if (widget.animateIcon!) _animationController.reverse();
setState(() {
_onTop = true;
});
if (mounted) {
setState(() {
_onTop = true;
});
}
}
});
}
@@ -128,9 +132,11 @@ class _ScrollingFloatingButtonAnimatedState
height: widget.height,
width: _onTop ? widget.width : widget.height,
onEnd: () {
setState(() {
_visibleText = !_visibleText;
});
if (mounted) {
setState(() {
_visibleText = !_visibleText;
});
}
},
decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(widget.height! / 2))),
child: InkWell(
@@ -7,6 +7,7 @@ class IconBuilder {
Key? _key;
double? _size;
String? _icon;
EdgeInsets? _padding;
OnPressIconActionClick? _onPressIconActionClick;
IconBuilder(this._icon);
@@ -19,6 +20,10 @@ class IconBuilder {
_size = size;
}
void padding(EdgeInsets padding) {
_padding = padding;
}
void addOnTapActionClick(OnPressIconActionClick onPressIconActionClick) {
_onPressIconActionClick = onPressIconActionClick;
}
@@ -29,16 +34,21 @@ class IconBuilder {
width: _size ?? 40,
height: _size ?? 40,
alignment: Alignment.center,
padding: EdgeInsets.all(3),
child: IconButton(
padding: EdgeInsets.zero,
iconSize: _size ?? 40,
icon: SvgPicture.asset(_icon!, width: _size ?? 40, height: _size ?? 40, fit: BoxFit.fill),
onPressed: () => {
if (_onPressIconActionClick != null) {
_onPressIconActionClick!()
}
})
padding: _padding ?? EdgeInsets.all(3),
child: Material(
borderRadius: BorderRadius.circular((_size ?? 40) / 2),
color: Colors.transparent,
child: IconButton(
padding: EdgeInsets.zero,
iconSize: _size ?? 40,
icon: SvgPicture.asset(_icon!, width: _size ?? 40, height: _size ?? 40, fit: BoxFit.fill),
onPressed: () => {
if (_onPressIconActionClick != null) {
_onPressIconActionClick!()
}
}
)
)
);
}
}