TF-2101 Add buttons and hasAttachment checkbox
(cherry picked from commit c132bf1c8bdbe15a807f95c2668d4c35d3aa77ff)
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
class ListButtonWidgetStyles {
|
||||
static const double space = 12.0;
|
||||
static const double mobileSpace = 16.0;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class TextActionButtonWidgetStyles {
|
||||
static const double radius = 10.0;
|
||||
static const double height = 44.0;
|
||||
static const double fontSize = 17.0;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/views/checkbox/labeled_checkbox.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tmail_ui_user/features/base/isolate/background_isolate_binary_messenger/background_isolate_binary_messenger_mobile.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
typedef OnChangedHasAttachment = void Function(bool? value);
|
||||
|
||||
class CheckBoxHasAttachmentWidget extends StatelessWidget {
|
||||
final bool hasAttachmentValue;
|
||||
final FocusNode? currentFocusNode;
|
||||
final FocusNode? nextFocusNode;
|
||||
final OnChangedHasAttachment? onChanged;
|
||||
|
||||
const CheckBoxHasAttachmentWidget({
|
||||
super.key,
|
||||
required this.hasAttachmentValue,
|
||||
this.currentFocusNode,
|
||||
this.nextFocusNode,
|
||||
this.onChanged,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RawKeyboardListener(
|
||||
focusNode: FocusNode(),
|
||||
onKey: (event) {
|
||||
if (event.logicalKey == LogicalKeyboardKey.tab) {
|
||||
nextFocusNode?.requestFocus();
|
||||
}
|
||||
},
|
||||
child: LabeledCheckbox(
|
||||
label: AppLocalizations.of(context).hasAttachment,
|
||||
focusNode: currentFocusNode,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
value: hasAttachmentValue,
|
||||
activeColor: AppColor.primaryColor,
|
||||
onChanged: onChanged,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tmail_ui_user/features/email_recovery/presentation/styles/list_button_widget_styles.dart';
|
||||
import 'package:tmail_ui_user/features/email_recovery/presentation/widgets/text_action_button_widget.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
class ListButtonWidget extends StatelessWidget {
|
||||
final VoidCallback onCancel;
|
||||
final VoidCallback onRestore;
|
||||
final ResponsiveUtils responsiveUtils;
|
||||
|
||||
const ListButtonWidget({
|
||||
super.key,
|
||||
required this.onCancel,
|
||||
required this.onRestore,
|
||||
required this.responsiveUtils,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextActionButtonWidget(
|
||||
colorButton: AppColor.colorBgSearchBar,
|
||||
colorText: AppColor.primaryColor,
|
||||
text: AppLocalizations.of(context).cancel,
|
||||
onAction: onCancel
|
||||
),
|
||||
),
|
||||
SizedBox(width: responsiveUtils.isMobile(context)
|
||||
? ListButtonWidgetStyles.mobileSpace
|
||||
: ListButtonWidgetStyles.space
|
||||
),
|
||||
Expanded(
|
||||
child: TextActionButtonWidget(
|
||||
colorButton: AppColor.primaryColor,
|
||||
colorText: Colors.white,
|
||||
text: AppLocalizations.of(context).restore,
|
||||
onAction: onRestore
|
||||
)
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import 'package:core/presentation/views/button/icon_button_web.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tmail_ui_user/features/email_recovery/presentation/styles/text_action_button_widget_styles.dart';
|
||||
|
||||
class TextActionButtonWidget extends StatelessWidget {
|
||||
final Color colorButton;
|
||||
final Color colorText;
|
||||
final String text;
|
||||
final VoidCallback onAction;
|
||||
final double? minWidth;
|
||||
|
||||
const TextActionButtonWidget({
|
||||
super.key,
|
||||
required this.colorButton,
|
||||
required this.colorText,
|
||||
required this.text,
|
||||
required this.onAction,
|
||||
this.minWidth,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return buildButtonWrapText(
|
||||
text,
|
||||
radius: TextActionButtonWidgetStyles.radius,
|
||||
height: TextActionButtonWidgetStyles.height,
|
||||
minWidth: minWidth,
|
||||
textStyle: TextStyle(
|
||||
fontSize: TextActionButtonWidgetStyles.fontSize,
|
||||
color: colorText,
|
||||
fontWeight: FontWeight.w500
|
||||
),
|
||||
bgColor: colorButton,
|
||||
onTap: onAction
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user