TF-3998 Reduce size of toggle in vacation settings
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class DefaultSwitchIconWidget extends StatelessWidget {
|
||||
|
||||
final ImagePaths imagePaths;
|
||||
final bool isEnabled;
|
||||
|
||||
const DefaultSwitchIconWidget({
|
||||
super.key,
|
||||
required this.imagePaths,
|
||||
required this.isEnabled,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SvgPicture.asset(
|
||||
key: key,
|
||||
isEnabled ? imagePaths.icSwitchOn : imagePaths.icSwitchOff,
|
||||
fit: BoxFit.fill,
|
||||
width: 44,
|
||||
height: 28,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/theme_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:tmail_ui_user/features/base/widget/default_switch_icon_widget.dart';
|
||||
|
||||
class SwitchLabelButtonWidget extends StatelessWidget {
|
||||
final ImagePaths imagePaths;
|
||||
@@ -25,11 +25,9 @@ class SwitchLabelButtonWidget extends StatelessWidget {
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: onSwitchAction,
|
||||
child: SvgPicture.asset(
|
||||
isActive ? imagePaths.icSwitchOn : imagePaths.icSwitchOff,
|
||||
fit: BoxFit.fill,
|
||||
width: 52,
|
||||
height: 32,
|
||||
child: DefaultSwitchIconWidget(
|
||||
imagePaths: imagePaths,
|
||||
isEnabled: isActive,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
|
||||
+4
-6
@@ -2,7 +2,7 @@ import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/theme_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:tmail_ui_user/features/base/widget/default_switch_icon_widget.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/recipient_forward.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
@@ -35,11 +35,9 @@ class KeepCopyInInboxWidget extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(vertical: 6),
|
||||
child: InkWell(
|
||||
onTap: onToggleLocalCopy,
|
||||
child: SvgPicture.asset(
|
||||
localCopyState ? imagePaths.icSwitchOn : imagePaths.icSwitchOff,
|
||||
fit: BoxFit.fill,
|
||||
width: 52,
|
||||
height: 32,
|
||||
child: DefaultSwitchIconWidget(
|
||||
imagePaths: imagePaths,
|
||||
isEnabled: localCopyState,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/state/get_notification_setting_state.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_notification_setting_interactor.dart';
|
||||
@@ -14,6 +15,7 @@ class NotificationController extends FullLifeCycleController with FullLifeCycleM
|
||||
|
||||
final notificationSettingEnabled = Rxn<bool>();
|
||||
final settingsController = Get.find<SettingsController>();
|
||||
final imagePaths = Get.find<ImagePaths>();
|
||||
|
||||
@override
|
||||
Future<void> onInit() async {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/presentation/utils/theme_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/base/widget/default_switch_icon_widget.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings_utils.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/notification/notification_controller.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
@@ -53,13 +52,10 @@ class NotificationView extends GetWidget<NotificationController> {
|
||||
onTap: controller.toggleNotificationSetting,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: SvgPicture.asset(
|
||||
controller.notificationSettingEnabled.value!
|
||||
? Get.find<ImagePaths>().icSwitchOn
|
||||
: Get.find<ImagePaths>().icSwitchOff,
|
||||
fit: BoxFit.contain,
|
||||
width: 52,
|
||||
height: 32),
|
||||
child: DefaultSwitchIconWidget(
|
||||
imagePaths: controller.imagePaths,
|
||||
isEnabled: controller.notificationSettingEnabled.value == true,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
+4
-8
@@ -2,8 +2,8 @@ import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/theme_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:server_settings/server_settings/tmail_server_settings.dart';
|
||||
import 'package:tmail_ui_user/features/base/widget/default_switch_icon_widget.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/local_setting_options.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/setting_option_type.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
@@ -64,18 +64,14 @@ class SettingOptionItem extends StatelessWidget {
|
||||
optionType,
|
||||
optionType.isEnabled(settingOption, localSettings),
|
||||
),
|
||||
child: SvgPicture.asset(
|
||||
child: DefaultSwitchIconWidget(
|
||||
key: ValueKey(
|
||||
optionType.isEnabled(settingOption, localSettings)
|
||||
? 'setting_option_switch_on'
|
||||
: 'setting_option_switch_off',
|
||||
),
|
||||
optionType.isEnabled(settingOption, localSettings)
|
||||
? imagePaths.icSwitchOn
|
||||
: imagePaths.icSwitchOff,
|
||||
fit: BoxFit.fill,
|
||||
width: 44,
|
||||
height: 28,
|
||||
imagePaths: imagePaths,
|
||||
isEnabled: optionType.isEnabled(settingOption, localSettings),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
|
||||
+2
@@ -1,3 +1,4 @@
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:dartz/dartz.dart' hide State;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -39,6 +40,7 @@ void main() {
|
||||
|
||||
setUpAll(() {
|
||||
Get.put<SettingsController>(settingsController);
|
||||
Get.put(ImagePaths());
|
||||
});
|
||||
|
||||
setUp(() {
|
||||
|
||||
Reference in New Issue
Block a user