From 2a8860a4c1ccf537cea47332575da9f52a64137d Mon Sep 17 00:00:00 2001 From: dab246 Date: Wed, 27 Apr 2022 10:45:01 +0700 Subject: [PATCH] TF-517 Implement TapCallBack when click logo app --- .../views/text/slogan_builder.dart | 42 ++++++++++++------- .../manage_account_dashboard_view.dart | 1 + 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/core/lib/presentation/views/text/slogan_builder.dart b/core/lib/presentation/views/text/slogan_builder.dart index dcaf2fc4b..bf71a5ca3 100644 --- a/core/lib/presentation/views/text/slogan_builder.dart +++ b/core/lib/presentation/views/text/slogan_builder.dart @@ -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), + ), + ]), + ); } } diff --git a/lib/features/manage_account/presentation/manage_account_dashboard_view.dart b/lib/features/manage_account/presentation/manage_account_dashboard_view.dart index f50a0132f..272ac7207 100644 --- a/lib/features/manage_account/presentation/manage_account_dashboard_view.dart +++ b/lib/features/manage_account/presentation/manage_account_dashboard_view.dart @@ -49,6 +49,7 @@ class ManageAccountDashBoardView extends GetWidget controller.backToMailboxDashBoard()) ..setLogo(_imagePaths.icLogoTMail)) .build(), Obx(() {