TF-517 Implement TapCallBack when click logo app

This commit is contained in:
dab246
2022-04-27 10:45:01 +07:00
committed by Dat H. Pham
parent 72bb594369
commit 2a8860a4c1
2 changed files with 29 additions and 14 deletions
@@ -4,6 +4,9 @@ import 'package:flutter_svg/flutter_svg.dart';
/// A builder which builds a reusable slogan widget.
/// This contains the logo and the slogan text.
/// The elements are arranged in a column or row.
typedef OnTapCallback = void Function();
class SloganBuilder {
final bool arrangedByHorizontal;
@@ -15,6 +18,7 @@ class SloganBuilder {
String? _logoSVG;
String? _logo;
double? _sizeLogo;
OnTapCallback? _onTapCallback;
SloganBuilder({this.arrangedByHorizontal = false});
@@ -46,23 +50,33 @@ class SloganBuilder {
_sizeLogo = size;
}
void addOnTapCallback(OnTapCallback? onTapCallback) {
_onTapCallback = onTapCallback;
}
Widget build() {
if (!arrangedByHorizontal) {
return Column(children: [
_logoApp(),
Padding(
padding: EdgeInsets.only(top: 16, left: 16, right: 16),
child: Text(_text ?? '', key: _key, style: _textStyle, textAlign: _textAlign),
),
]);
return InkWell(
onTap: () => _onTapCallback?.call(),
child: Column(children: [
_logoApp(),
Padding(
padding: EdgeInsets.only(top: 16, left: 16, right: 16),
child: Text(_text ?? '', key: _key, style: _textStyle, textAlign: _textAlign),
),
]),
);
} else {
return Row(children: [
_logoApp(),
Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text(_text ?? '', key: _key, style: _textStyle, textAlign: _textAlign),
),
]);
return InkWell(
onTap: () => _onTapCallback?.call(),
child: Row(children: [
_logoApp(),
Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text(_text ?? '', key: _key, style: _textStyle, textAlign: _textAlign),
),
]),
);
}
}
@@ -49,6 +49,7 @@ class ManageAccountDashBoardView extends GetWidget<ManageAccountDashBoardControl
..setSloganTextAlign(TextAlign.center)
..setSloganTextStyle(const TextStyle(color: Colors.black, fontSize: 20, fontWeight: FontWeight.bold))
..setSizeLogo(24)
..addOnTapCallback(() => controller.backToMailboxDashBoard())
..setLogo(_imagePaths.icLogoTMail))
.build(),
Obx(() {