TF-888 Change size back button and add title in setting first level view

This commit is contained in:
dab246
2022-09-09 19:39:08 +07:00
committed by Dat H. Pham
parent 8d23606e98
commit 6692b73b8f
6 changed files with 82 additions and 16 deletions
@@ -45,7 +45,7 @@ extension ValicatorFailureExtension on VerifyNameFailure {
String getMessageVacation(BuildContext context) { String getMessageVacation(BuildContext context) {
if (exception is EmptyNameException) { if (exception is EmptyNameException) {
return AppLocalizations.of(context).this_field_cannot_be_blank; return AppLocalizations.of(context).messageIsRequired;
} else { } else {
return ''; return '';
} }
@@ -34,7 +34,7 @@ class SettingsFirstLevelView extends GetWidget<SettingsController> {
endIndent: SettingsUtils.getHorizontalPadding(context, _responsiveUtils) endIndent: SettingsUtils.getHorizontalPadding(context, _responsiveUtils)
), ),
SettingFirstLevelTileBuilder( SettingFirstLevelTileBuilder(
AppLocalizations.of(context).identities, AppLocalizations.of(context).profiles,
AccountMenuItem.profiles.getIcon(_imagePaths), AccountMenuItem.profiles.getIcon(_imagePaths),
() => controller.selectSettings(AccountMenuItem.profiles) () => controller.selectSettings(AccountMenuItem.profiles)
), ),
@@ -39,7 +39,7 @@ class SettingsView extends GetWidget<SettingsController> {
SizedBox.fromSize( SizedBox.fromSize(
size: const Size.fromHeight(52), size: const Size.fromHeight(52),
child: Padding( child: Padding(
padding: SettingsUtils.getPaddingInFirstLevel(context, _responsiveUtils), padding: SettingsUtils.getPaddingAppBar(context, _responsiveUtils),
child: _buildAppbar(context))), child: _buildAppbar(context))),
const Divider(color: AppColor.colorDividerComposer, height: 1), const Divider(color: AppColor.colorDividerComposer, height: 1),
Obx(() { Obx(() {
@@ -109,24 +109,69 @@ class SettingsView extends GetWidget<SettingsController> {
} }
Widget _buildSettingLevel1AppBar(BuildContext context) { Widget _buildSettingLevel1AppBar(BuildContext context) {
return Row(children: [ return Stack(children: [
_buildBackButton(context), if (_responsiveUtils.isPortraitMobile(context))
Expanded( _buildBackButton(context)
else
Align(
alignment: Alignment.centerLeft,
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: controller.backToUniversalSettings,
borderRadius: BorderRadius.circular(15),
child: Tooltip(
message: AppLocalizations.of(context).back,
child: Container(
color: Colors.transparent,
height: 40,
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Row(mainAxisSize: MainAxisSize.min, children: [
SvgPicture.asset(
_imagePaths.icBack,
width: 18,
height: 18,
color: AppColor.colorTextButton,
fit: BoxFit.fill),
Container(
margin: const EdgeInsets.only(left: 8),
constraints: const BoxConstraints(maxWidth: 100),
child: Text(
AppLocalizations.of(context).settings,
maxLines: 1,
overflow: CommonTextStyle.defaultTextOverFlow,
softWrap: CommonTextStyle.defaultSoftWrap,
style: const TextStyle(fontSize: 17, color: AppColor.colorTextButton)),
),
]),
),
),
),
),
),
Align(
alignment: Alignment.center,
child: Text( child: Text(
AppLocalizations.of(context).settings, controller.manageAccountDashboardController.accountMenuItemSelected.value.getName(context),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: CommonTextStyle.defaultTextOverFlow,
style: const TextStyle(fontSize: 21, color: Colors.black, fontWeight: FontWeight.bold) softWrap: CommonTextStyle.defaultSoftWrap,
) style: const TextStyle(fontSize: 20, color: Colors.black, fontWeight: FontWeight.bold)))
)
]); ]);
} }
Widget _buildBackButton(BuildContext context) { Widget _buildBackButton(BuildContext context) {
return buildIconWeb( return Align(
icon: SvgPicture.asset(_imagePaths.icBack, width: 9, height: 16, color: AppColor.colorTextButton, fit: BoxFit.fill), alignment: Alignment.centerLeft,
tooltip: AppLocalizations.of(context).back, child: buildIconWeb(
onTap: controller.backToUniversalSettings icon: SvgPicture.asset(_imagePaths.icBack,
width: 18,
height: 18,
color: AppColor.colorTextButton,
fit: BoxFit.fill),
tooltip: AppLocalizations.of(context).back,
onTap: controller.backToUniversalSettings
),
); );
} }
@@ -19,6 +19,14 @@ class SettingsUtils {
} }
} }
static EdgeInsets getPaddingAppBar(BuildContext context, ResponsiveUtils responsiveUtils) {
if (responsiveUtils.isMobile(context)) {
return const EdgeInsets.symmetric(horizontal: 16);
} else {
return const EdgeInsets.symmetric(horizontal: 32);
}
}
static EdgeInsets getMarginViewForSettingDetails(BuildContext context, ResponsiveUtils responsiveUtils) { static EdgeInsets getMarginViewForSettingDetails(BuildContext context, ResponsiveUtils responsiveUtils) {
if (BuildUtils.isWeb) { if (BuildUtils.isWeb) {
if (responsiveUtils.isDesktop(context)) { if (responsiveUtils.isDesktop(context)) {
+7 -1
View File
@@ -1,5 +1,5 @@
{ {
"@@last_modified": "2022-09-09T19:10:45.099202", "@@last_modified": "2022-09-09T19:44:24.604383",
"initializing_data": "Initializing data...", "initializing_data": "Initializing data...",
"@initializing_data": { "@initializing_data": {
"type": "text", "type": "text",
@@ -2161,5 +2161,11 @@
"type": "text", "type": "text",
"placeholders_order": [], "placeholders_order": [],
"placeholders": {} "placeholders": {}
},
"messageIsRequired": "Message is required",
"@messageIsRequired": {
"type": "text",
"placeholders_order": [],
"placeholders": {}
} }
} }
@@ -2230,4 +2230,11 @@ class AppLocalizations {
name: 'saveChanges', name: 'saveChanges',
); );
} }
String get messageIsRequired {
return Intl.message(
'Message is required',
name: 'messageIsRequired',
);
}
} }