TF-2078 Add CalendarEventActionButton widget
(cherry picked from commit dbd936a925e88939abe998ed61e38c838636a074)
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
import 'package:core/presentation/extensions/color_extension.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class CalendarEventActionButtonWidgetStyles {
|
||||||
|
static const double borderRadius = 10;
|
||||||
|
static const double textSize = 16;
|
||||||
|
static const double space = 16;
|
||||||
|
static const double borderWidth = 1;
|
||||||
|
static const double minWidth = 80;
|
||||||
|
|
||||||
|
static const Color backgroundColor = Colors.transparent;
|
||||||
|
static const Color textColor = AppColor.primaryColor;
|
||||||
|
|
||||||
|
static const FontWeight fontWeight = FontWeight.w500;
|
||||||
|
|
||||||
|
static const EdgeInsetsGeometry buttonPadding = EdgeInsetsDirectional.symmetric(vertical: 8, horizontal: 12);
|
||||||
|
static const EdgeInsetsGeometry paddingMobile = EdgeInsetsDirectional.only(top: 16);
|
||||||
|
static const EdgeInsetsGeometry paddingWeb = EdgeInsetsDirectional.only(start: 100, end: 16, top: 16);
|
||||||
|
static const EdgeInsetsGeometry margin = EdgeInsetsDirectional.only(top: 16);
|
||||||
|
}
|
||||||
+54
@@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
import 'package:core/core.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/domain/model/event_action.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/presentation/styles/calendar_event_action_button_widget_styles.dart';
|
||||||
|
import 'package:tmail_ui_user/main/utils/app_utils.dart';
|
||||||
|
|
||||||
|
class CalendarEventActionButtonWidget extends StatelessWidget {
|
||||||
|
|
||||||
|
final List<EventAction> eventActions;
|
||||||
|
|
||||||
|
const CalendarEventActionButtonWidget({
|
||||||
|
super.key,
|
||||||
|
required this.eventActions
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final responsiveUtils = Get.find<ResponsiveUtils>();
|
||||||
|
return Container(
|
||||||
|
width: double.infinity,
|
||||||
|
margin: CalendarEventActionButtonWidgetStyles.margin,
|
||||||
|
padding: responsiveUtils.isPortraitMobile(context)
|
||||||
|
? CalendarEventActionButtonWidgetStyles.paddingMobile
|
||||||
|
: CalendarEventActionButtonWidgetStyles.paddingWeb,
|
||||||
|
child: Wrap(
|
||||||
|
spacing: CalendarEventActionButtonWidgetStyles.space,
|
||||||
|
runSpacing: CalendarEventActionButtonWidgetStyles.space,
|
||||||
|
children: eventActions
|
||||||
|
.map((action) => TMailButtonWidget(
|
||||||
|
text: action.actionType.getLabelButton(context),
|
||||||
|
backgroundColor: CalendarEventActionButtonWidgetStyles.backgroundColor,
|
||||||
|
borderRadius: CalendarEventActionButtonWidgetStyles.borderRadius,
|
||||||
|
padding: CalendarEventActionButtonWidgetStyles.buttonPadding,
|
||||||
|
textStyle: const TextStyle(
|
||||||
|
fontWeight: CalendarEventActionButtonWidgetStyles.fontWeight,
|
||||||
|
fontSize: CalendarEventActionButtonWidgetStyles.textSize,
|
||||||
|
color: CalendarEventActionButtonWidgetStyles.textColor,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
minWidth: CalendarEventActionButtonWidgetStyles.minWidth,
|
||||||
|
width: responsiveUtils.isPortraitMobile(context) ? double.infinity : null,
|
||||||
|
border: Border.all(
|
||||||
|
width: CalendarEventActionButtonWidgetStyles.borderWidth,
|
||||||
|
color: CalendarEventActionButtonWidgetStyles.textColor
|
||||||
|
),
|
||||||
|
onTapActionCallback: () => AppUtils.launchLink(action.link),
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"@@last_modified": "2023-08-09T18:38:10.703509",
|
"@@last_modified": "2023-08-10T17:46:51.619248",
|
||||||
"initializing_data": "Initializing data...",
|
"initializing_data": "Initializing data...",
|
||||||
"@initializing_data": {
|
"@initializing_data": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@@ -3161,5 +3161,11 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"maybe": "Maybe",
|
||||||
|
"@maybe": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3260,4 +3260,10 @@ class AppLocalizations {
|
|||||||
name: 'createFilters');
|
name: 'createFilters');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String get maybe {
|
||||||
|
return Intl.message(
|
||||||
|
'Maybe',
|
||||||
|
name: 'maybe');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user