Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
chore: adjust Toggle widget's onChanged callback (#6556)
Richard Shiue6cc8c81e3d9d
diff --git a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/toolbar/calendar_layout_setting.dart b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/toolbar/calendar_layout_setting.dartindex e23b0cd552..c72ddea576 100644--- a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/toolbar/calendar_layout_setting.dart+++ b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/toolbar/calendar_layout_setting.dart@@ -335,7 +335,7 @@ Widget _toggleItem({const Spacer(),Toggle(value: value,- onChanged: (value) => onToggle(!value),+ onChanged: (value) => onToggle(value),padding: EdgeInsets.zero,),],diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell_editor/date_editor.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell_editor/date_editor.dartindex e0d7c3944f..54ef8ec177 100644--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell_editor/date_editor.dart+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell_editor/date_editor.dart@@ -52,12 +52,12 @@ class _DateCellEditor extends State<DateCellEditor> {includeTime: state.includeTime,rebuildOnDaySelected: false,onIncludeTimeChanged: (value) =>- dateCellBloc.add(DateCellEditorEvent.setIncludeTime(!value)),+ dateCellBloc.add(DateCellEditorEvent.setIncludeTime(value)),isRange: state.isRange,startDay: state.isRange ? state.startDay : null,endDay: state.isRange ? state.endDay : null,onIsRangeChanged: (value) =>- dateCellBloc.add(DateCellEditorEvent.setIsRange(!value)),+ dateCellBloc.add(DateCellEditorEvent.setIsRange(value)),dateFormat: state.dateTypeOptionPB.dateFormat,timeFormat: state.dateTypeOptionPB.timeFormat,selectedDay: state.dateTime,diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/field/type_option_editor/media.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/field/type_option_editor/media.dartindex 991210fba1..ba4fe5736a 100644--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/field/type_option_editor/media.dart+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/field/type_option_editor/media.dart@@ -41,7 +41,7 @@ class MediaTypeOptionEditorFactory implements TypeOptionEditorFactory {value: typeOption.hideFileNames,onChanged: (value) {onTypeOptionUpdated(- _toggleHideFiles(typeOption, !value).writeToBuffer(),+ _toggleHideFiles(typeOption, value).writeToBuffer(),);},padding: EdgeInsets.zero,diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/field/type_option_editor/timestamp.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/field/type_option_editor/timestamp.dartindex e3f50cc857..7eed322bc8 100644--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/field/type_option_editor/timestamp.dart+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/field/type_option_editor/timestamp.dart@@ -34,7 +34,7 @@ class TimestampTypeOptionEditorFactory implements TypeOptionEditorFactory {onChanged: (value) {final newTypeOption = _updateTypeOption(typeOption: typeOption,- includeTime: !value,+ includeTime: value,);onTypeOptionUpdated(newTypeOption.writeToBuffer());},diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/group/database_group.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/group/database_group.dartindex 6b27fc9c70..7a888b96ed 100644--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/group/database_group.dart+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/group/database_group.dart@@ -72,7 +72,7 @@ class DatabaseGroupList extends StatelessWidget {Toggle(value: !state.layoutSettings.hideUngroupedColumn,onChanged: (value) =>- _updateLayoutSettings(state.layoutSettings, value),+ _updateLayoutSettings(state.layoutSettings, !value),padding: EdgeInsets.zero,),],diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/local_ai_chat_setting.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/local_ai_chat_setting.dartindex fb66dad7a5..9cb3a17d88 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/local_ai_chat_setting.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/local_ai_chat_setting.dart@@ -155,7 +155,7 @@ class LocalAIChatSettingHeader extends StatelessWidget {const Spacer(),Toggle(value: isEnabled,- onChanged: (value) {+ onChanged: (_) {context.read<LocalAIChatToggleBloc>().add(const LocalAIChatToggleEvent.toggle());diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/local_ai_setting.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/local_ai_setting.dartindex 041dd117e0..f9dc6fa4d8 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/local_ai_setting.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/local_ai_setting.dart@@ -106,7 +106,7 @@ class LocalAISettingHeader extends StatelessWidget {const Spacer(),Toggle(value: isEnabled,- onChanged: (value) {+ onChanged: (_) {if (isEnabled) {showConfirmDialog(context: context,diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_workspace_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_workspace_view.dartindex 569768a96e..047b2480b7 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_workspace_view.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_workspace_view.dart@@ -437,7 +437,7 @@ class EnableRTLItemsSwitcher extends StatelessWidget {.enableRtlToolbarItems,onChanged: (value) => context.read<AppearanceSettingsCubit>()- .setEnableRTLToolbarItems(!value),+ .setEnableRTLToolbarItems(value),),],);@@ -582,8 +582,8 @@ class _TimeFormatSwitcher extends StatelessWidget {onChanged: (value) =>context.read<AppearanceSettingsCubit>().setTimeFormat(value- ? UserTimeFormatPB.TwelveHour- : UserTimeFormatPB.TwentyFourHour,+ ? UserTimeFormatPB.TwentyFourHour+ : UserTimeFormatPB.TwelveHour,),),],diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dartindex 4ef6e068b4..081cb88f5f 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart@@ -322,7 +322,7 @@ class AppFlowyCloudEnableSync extends StatelessWidget {value: state.setting.enableSync,onChanged: (value) => context.read<AppFlowyCloudSettingBloc>()- .add(AppFlowyCloudSettingEvent.enableSync(!value)),+ .add(AppFlowyCloudSettingEvent.enableSync(value)),),],);diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_notifications_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_notifications_view.dartindex bdeb288ec6..29ba2baf5c 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_notifications_view.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_notifications_view.dart@@ -26,7 +26,7 @@ class SettingsNotificationsView extends StatelessWidget {trailing: [Toggle(value: state.isNotificationsEnabled,- onChanged: (value) => context+ onChanged: (_) => context.read<NotificationSettingsCubit>().toggleNotificationsEnabled(),),diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/date_picker_dialog.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/date_picker_dialog.dartindex 10eb499292..ceeb0d2832 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/date_picker_dialog.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/date_picker_dialog.dart@@ -186,8 +186,8 @@ class _AnimatedDatePickerState extends State<_AnimatedDatePicker> {child: AppFlowyDatePicker(includeTime: _includeTime,onIncludeTimeChanged: (includeTime) {- widget.options.onIncludeTimeChanged.call(!includeTime);- setState(() => _includeTime = !includeTime);+ widget.options.onIncludeTimeChanged.call(includeTime);+ setState(() => _includeTime = includeTime);},enableRanges: widget.options.enableRanges,isRange: widget.options.isRange,diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/toggle/toggle.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/toggle/toggle.dartindex 4bdeb2521b..673f08c668 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/toggle/toggle.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/toggle/toggle.dart@@ -56,7 +56,7 @@ class Toggle extends StatelessWidget {: inactiveBackgroundColor ??AFThemeExtension.of(context).toggleButtonBGColor;return GestureDetector(- onTap: () => onChanged(value),+ onTap: () => onChanged(!value),child: Padding(padding: padding,child: Stack(