Apply new style for create identity view on mobile
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
+11
-13
@@ -23,18 +23,16 @@ class IdentityCreatorFormBottomView extends StatelessWidget {
|
||||
|
||||
final checkboxWidget = Obx(() {
|
||||
if (controller.isDefaultIdentitySupported.isTrue) {
|
||||
return Expanded(
|
||||
child: Obx(() {
|
||||
return CustomIconLabeledCheckbox(
|
||||
label: appLocalizations.setDefaultIdentity,
|
||||
svgIconPath: controller.imagePaths.icCheckboxUnselected,
|
||||
selectedSvgIconPath: controller.imagePaths.icCheckboxSelected,
|
||||
value: controller.isDefaultIdentity.value,
|
||||
semanticsLabel: 'Set default identity checkbox',
|
||||
onChanged: (_) => controller.onCheckboxChanged(),
|
||||
);
|
||||
}),
|
||||
);
|
||||
return Obx(() {
|
||||
return CustomIconLabeledCheckbox(
|
||||
label: appLocalizations.setDefaultIdentity,
|
||||
svgIconPath: controller.imagePaths.icCheckboxUnselected,
|
||||
selectedSvgIconPath: controller.imagePaths.icCheckboxSelected,
|
||||
value: controller.isDefaultIdentity.value,
|
||||
semanticsLabel: 'Set default identity checkbox',
|
||||
onChanged: (_) => controller.onCheckboxChanged(),
|
||||
);
|
||||
});
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
@@ -113,7 +111,7 @@ class IdentityCreatorFormBottomView extends StatelessWidget {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
checkboxWidget,
|
||||
Expanded(child: checkboxWidget),
|
||||
Expanded(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
|
||||
+79
-45
@@ -1,7 +1,11 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/utils/platform_info.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rich_text_composer/views/keyboard_rich_text.dart';
|
||||
import 'package:rich_text_composer/views/widgets/rich_text_keyboard_toolbar.dart';
|
||||
import 'package:tmail_ui_user/features/base/widget/default_field/default_close_button_widget.dart';
|
||||
import 'package:tmail_ui_user/features/identity_creator/presentation/identity_creator_controller.dart';
|
||||
import 'package:tmail_ui_user/features/identity_creator/presentation/widgets/identity_creator_form_bottom_view.dart';
|
||||
@@ -11,66 +15,96 @@ import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
class IdentityCreatorFormDesktopBuilder extends StatelessWidget {
|
||||
final IdentityCreatorController controller;
|
||||
final Widget formView;
|
||||
final bool enableRichTextKeyboard;
|
||||
|
||||
const IdentityCreatorFormDesktopBuilder({
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.formView,
|
||||
this.enableRichTextKeyboard = false,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final appLocalizations = AppLocalizations.of(context);
|
||||
|
||||
Widget bodyWidget = Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.08),
|
||||
blurRadius: 24,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.08),
|
||||
blurRadius: 2,
|
||||
),
|
||||
],
|
||||
),
|
||||
width: min(
|
||||
controller.responsiveUtils.getSizeScreenWidth(context) - 48,
|
||||
784,
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Obx(() {
|
||||
final actionType = controller.actionType.value;
|
||||
return IdentityCreatorFormTitleWidget(
|
||||
title: actionType.getTitle(appLocalizations),
|
||||
);
|
||||
}),
|
||||
Flexible(child: formView),
|
||||
const SizedBox(height: 24),
|
||||
IdentityCreatorFormBottomView(controller: controller),
|
||||
],
|
||||
),
|
||||
DefaultCloseButtonWidget(
|
||||
iconClose: controller.imagePaths.icCloseDialog,
|
||||
onTapActionCallback: () => controller.closeView(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
if (enableRichTextKeyboard) {
|
||||
final richTextController = controller
|
||||
.richTextMobileTabletController
|
||||
!.richTextController;
|
||||
|
||||
bodyWidget = KeyboardRichText(
|
||||
keyBroadToolbar: RichTextKeyboardToolBar(
|
||||
rootContext: context,
|
||||
titleBack: appLocalizations.titleFormat,
|
||||
backgroundKeyboardToolBarColor: PlatformInfo.isIOS
|
||||
? AppColor.colorBackgroundKeyboard
|
||||
: AppColor.colorBackgroundKeyboardAndroid,
|
||||
richTextController: richTextController,
|
||||
quickStyleLabel: appLocalizations.titleQuickStyles,
|
||||
backgroundLabel: appLocalizations.titleBackground,
|
||||
foregroundLabel: appLocalizations.titleForeground,
|
||||
formatLabel: appLocalizations.titleFormat,
|
||||
insertImage: () => controller.pickImage(context),
|
||||
),
|
||||
richTextController: richTextController,
|
||||
child: bodyWidget,
|
||||
);
|
||||
}
|
||||
|
||||
if (PlatformInfo.isMobile) {
|
||||
bodyWidget = SafeArea(child: bodyWidget);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black.withOpacity(0.2),
|
||||
body: GestureDetector(
|
||||
onTap: () => controller.clearFocusEditor(context),
|
||||
child: Center(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.08),
|
||||
blurRadius: 24,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.08),
|
||||
blurRadius: 2,
|
||||
),
|
||||
],
|
||||
),
|
||||
width: min(
|
||||
controller.responsiveUtils.getSizeScreenWidth(context) - 48,
|
||||
784,
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Obx(() {
|
||||
final actionType = controller.actionType.value;
|
||||
return IdentityCreatorFormTitleWidget(
|
||||
title: actionType.getTitle(appLocalizations),
|
||||
);
|
||||
}),
|
||||
Flexible(child: formView),
|
||||
const SizedBox(height: 24),
|
||||
IdentityCreatorFormBottomView(controller: controller),
|
||||
],
|
||||
),
|
||||
DefaultCloseButtonWidget(
|
||||
iconClose: controller.imagePaths.icCloseDialog,
|
||||
onTapActionCallback: () => controller.closeView(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Center(child: bodyWidget),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
+67
-33
@@ -1,5 +1,9 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/utils/platform_info.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rich_text_composer/rich_text_composer.dart';
|
||||
import 'package:rich_text_composer/views/widgets/rich_text_keyboard_toolbar.dart';
|
||||
import 'package:tmail_ui_user/features/base/widget/default_field/default_app_bar_widget.dart';
|
||||
import 'package:tmail_ui_user/features/identity_creator/presentation/identity_creator_controller.dart';
|
||||
import 'package:tmail_ui_user/features/identity_creator/presentation/widgets/identity_creator_form_bottom_view.dart';
|
||||
@@ -8,54 +12,84 @@ import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
class IdentityCreatorFormMobileBuilder extends StatelessWidget {
|
||||
final IdentityCreatorController controller;
|
||||
final Widget formView;
|
||||
final bool enableRichTextKeyboard;
|
||||
|
||||
const IdentityCreatorFormMobileBuilder({
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.formView,
|
||||
this.enableRichTextKeyboard = false,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final appLocalizations = AppLocalizations.of(context);
|
||||
|
||||
Widget bodyWidget = ColoredBox(
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Obx(() {
|
||||
final actionType = controller.actionType.value;
|
||||
return DefaultAppBarWidget(
|
||||
title: actionType.getTitle(appLocalizations),
|
||||
imagePaths: controller.imagePaths,
|
||||
responsiveUtils: controller.responsiveUtils,
|
||||
onBackAction: () => controller.closeView(context),
|
||||
);
|
||||
}),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
controller: controller.scrollController,
|
||||
physics: const ClampingScrollPhysics(),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(child: formView),
|
||||
IdentityCreatorFormBottomView(controller: controller),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
if (enableRichTextKeyboard) {
|
||||
final richTextController = controller
|
||||
.richTextMobileTabletController
|
||||
!.richTextController;
|
||||
|
||||
bodyWidget = KeyboardRichText(
|
||||
keyBroadToolbar: RichTextKeyboardToolBar(
|
||||
rootContext: context,
|
||||
titleBack: appLocalizations.titleFormat,
|
||||
backgroundKeyboardToolBarColor: PlatformInfo.isIOS
|
||||
? AppColor.colorBackgroundKeyboard
|
||||
: AppColor.colorBackgroundKeyboardAndroid,
|
||||
richTextController: richTextController,
|
||||
quickStyleLabel: appLocalizations.titleQuickStyles,
|
||||
backgroundLabel: appLocalizations.titleBackground,
|
||||
foregroundLabel: appLocalizations.titleForeground,
|
||||
formatLabel: appLocalizations.titleFormat,
|
||||
insertImage: () => controller.pickImage(context),
|
||||
),
|
||||
richTextController: richTextController,
|
||||
child: bodyWidget,
|
||||
);
|
||||
}
|
||||
|
||||
if (PlatformInfo.isMobile) {
|
||||
bodyWidget = SafeArea(child: bodyWidget);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: GestureDetector(
|
||||
onTap: () => controller.clearFocusEditor(context),
|
||||
child: SafeArea(
|
||||
child: ColoredBox(
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Obx(() {
|
||||
final actionType = controller.actionType.value;
|
||||
return DefaultAppBarWidget(
|
||||
title: actionType.getTitle(appLocalizations),
|
||||
imagePaths: controller.imagePaths,
|
||||
responsiveUtils: controller.responsiveUtils,
|
||||
onBackAction: () => controller.closeView(context),
|
||||
);
|
||||
}),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
controller: controller.scrollController,
|
||||
physics: const ClampingScrollPhysics(),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(child: formView),
|
||||
IdentityCreatorFormBottomView(controller: controller),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
child: bodyWidget,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user