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
feat: use appflowy styled toggle widget in date settings (#1192)
Richard Shiuecff24581a4c1
diff --git a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/date_cell/date_editor.dart b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/date_cell/date_editor.dartindex 63917da8f9..4018c0acb6 100644--- a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/date_cell/date_editor.dart+++ b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/date_cell/date_editor.dart@@ -1,6 +1,8 @@import 'package:app_flowy/generated/locale_keys.g.dart';import 'package:app_flowy/plugins/grid/application/cell/date_cal_bloc.dart';import 'package:app_flowy/plugins/grid/application/field/type_option/type_option_context.dart';+import 'package:app_flowy/workspace/presentation/widgets/toggle/toggle.dart';+import 'package:app_flowy/workspace/presentation/widgets/toggle/toggle_style.dart';import 'package:appflowy_popover/appflowy_popover.dart';import 'package:dartz/dartz.dart' show Either;import 'package:easy_localization/easy_localization.dart';@@ -167,6 +169,18 @@ class _CellCalendarWidgetState extends State<_CellCalendarWidget> {rightChevronMargin: EdgeInsets.zero,rightChevronIcon: svgWidget("home/arrow_right"),),+ daysOfWeekStyle: DaysOfWeekStyle(+ dowTextFormatter: (date, locale) =>+ DateFormat.E(locale).format(date).toUpperCase(),+ weekdayStyle: TextStyle(+ fontSize: 13,+ color: theme.shader3,+ ),+ weekendStyle: TextStyle(+ fontSize: 13,+ color: theme.shader3,+ ),+ ),calendarStyle: CalendarStyle(selectedDecoration: BoxDecoration(color: theme.main1,@@ -230,11 +244,13 @@ class _IncludeTimeButton extends StatelessWidget {FlowyText.medium(LocaleKeys.grid_field_includeTime.tr(),fontSize: 14),const Spacer(),- Switch(+ Toggle(value: includeTime,- onChanged: (newValue) => context+ onChanged: (value) => context.read<DateCalBloc>()- .add(DateCalEvent.setIncludeTime(newValue)),+ .add(DateCalEvent.setIncludeTime(!value)),+ style: ToggleStyle.big(theme),+ padding: EdgeInsets.zero,),],),@@ -350,7 +366,7 @@ class _DateTypeOptionButton extends StatelessWidget {offset: const Offset(20, 0),constraints: BoxConstraints.loose(const Size(140, 100)),child: FlowyButton(- text: FlowyText.medium(title, fontSize: 12),+ text: FlowyText.medium(title, fontSize: 14),hoverColor: theme.hover,margin: kMargin,rightIcon: svgWidget("grid/more", color: theme.iconColor),diff --git a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/type_option/date.dart b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/type_option/date.dartindex 1cebba9911..954c933511 100644--- a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/type_option/date.dart+++ b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/type_option/date.dart@@ -1,5 +1,7 @@import 'package:app_flowy/plugins/grid/application/field/type_option/date_bloc.dart';import 'package:app_flowy/plugins/grid/application/field/type_option/type_option_context.dart';+import 'package:app_flowy/workspace/presentation/widgets/toggle/toggle.dart';+import 'package:app_flowy/workspace/presentation/widgets/toggle/toggle_style.dart';import 'package:easy_localization/easy_localization.dart' hide DateFormat;import 'package:app_flowy/generated/locale_keys.g.dart';import 'package:flowy_infra/image.dart';@@ -161,6 +163,7 @@ class _IncludeTimeButton extends StatelessWidget {@overrideWidget build(BuildContext context) {+ final theme = context.watch<AppTheme>();return BlocSelector<DateTypeOptionBloc, DateTypeOptionState, bool>(selector: (state) => state.typeOption.includeTime,builder: (context, includeTime) {@@ -173,13 +176,15 @@ class _IncludeTimeButton extends StatelessWidget {FlowyText.medium(LocaleKeys.grid_field_includeTime.tr(),fontSize: 12),const Spacer(),- Switch(+ Toggle(value: includeTime,- onChanged: (newValue) {+ onChanged: (value) {context.read<DateTypeOptionBloc>()- .add(DateTypeOptionEvent.includeTime(newValue));+ .add(DateTypeOptionEvent.includeTime(!value));},+ style: ToggleStyle.big(theme),+ padding: EdgeInsets.zero,),],),