Skip to content

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.

chore: copy property to pasteboard

appflowy10365217caea
diff --git a/frontend/app_flowy/assets/translations/en.json b/frontend/app_flowy/assets/translations/en.json
index 4e6c8f3420..e465e79607 100644
--- a/frontend/app_flowy/assets/translations/en.json
+++ b/frontend/app_flowy/assets/translations/en.json
@@ -180,7 +180,8 @@
"row": {
"duplicate": "Duplicate",
"delete": "Delete",
- "textPlaceholder": "Empty"
+ "textPlaceholder": "Empty",
+ "copyProperty": "Copied property to clipboard"
},
"selectOption": {
"create": "Create",
diff --git a/frontend/app_flowy/lib/startup/deps_resolver.dart b/frontend/app_flowy/lib/startup/deps_resolver.dart
index 9be9420fb5..b378d6ee7b 100644
--- a/frontend/app_flowy/lib/startup/deps_resolver.dart
+++ b/frontend/app_flowy/lib/startup/deps_resolver.dart
@@ -16,6 +16,7 @@ import 'package:app_flowy/workspace/presentation/home/menu/menu.dart';
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/app.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/view.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-user-data-model/user_profile.pb.dart';
+import 'package:fluttertoast/fluttertoast.dart';
import 'package:get_it/get_it.dart';
class DependencyResolver {
@@ -46,6 +47,8 @@ void _resolveUserDeps(GetIt getIt) {
}
void _resolveHomeDeps(GetIt getIt) {
+ getIt.registerSingleton(FToast());
+
getIt.registerSingleton(MenuSharedState());
getIt.registerFactoryParam<UserListener, UserProfile, void>(
diff --git a/frontend/app_flowy/lib/startup/tasks/app_widget.dart b/frontend/app_flowy/lib/startup/tasks/app_widget.dart
index 1747cfd8ec..9961142c6d 100644
--- a/frontend/app_flowy/lib/startup/tasks/app_widget.dart
+++ b/frontend/app_flowy/lib/startup/tasks/app_widget.dart
@@ -67,40 +67,42 @@ class ApplicationWidget extends StatelessWidget {
}) : super(key: key);
@override
- Widget build(BuildContext context) => ChangeNotifierProvider.value(
- value: settingModel,
- builder: (context, _) {
- const ratio = 1.73;
- const minWidth = 600.0;
- setWindowMinSize(const Size(minWidth, minWidth / ratio));
- settingModel.readLocaleWhenAppLaunch(context);
- AppTheme theme = context.select<AppearanceSettingModel, AppTheme>(
- (value) => value.theme,
- );
- Locale locale = context.select<AppearanceSettingModel, Locale>(
- (value) => value.locale,
- );
+ Widget build(BuildContext context) {
+ return ChangeNotifierProvider.value(
+ value: settingModel,
+ builder: (context, _) {
+ const ratio = 1.73;
+ const minWidth = 600.0;
+ setWindowMinSize(const Size(minWidth, minWidth / ratio));
+ settingModel.readLocaleWhenAppLaunch(context);
+ AppTheme theme = context.select<AppearanceSettingModel, AppTheme>(
+ (value) => value.theme,
+ );
+ Locale locale = context.select<AppearanceSettingModel, Locale>(
+ (value) => value.locale,
+ );
- return MultiProvider(
- providers: [
- Provider.value(value: theme),
- Provider.value(value: locale),
- ],
- builder: (context, _) {
- return MaterialApp(
- builder: overlayManagerBuilder(),
- debugShowCheckedModeBanner: false,
- theme: theme.themeData,
- localizationsDelegates: context.localizationDelegates,
- supportedLocales: context.supportedLocales,
- locale: locale,
- navigatorKey: AppGlobals.rootNavKey,
- home: child,
- );
- },
- );
- },
- );
+ return MultiProvider(
+ providers: [
+ Provider.value(value: theme),
+ Provider.value(value: locale),
+ ],
+ builder: (context, _) {
+ return MaterialApp(
+ builder: overlayManagerBuilder(),
+ debugShowCheckedModeBanner: false,
+ theme: theme.themeData,
+ localizationsDelegates: context.localizationDelegates,
+ supportedLocales: context.supportedLocales,
+ locale: locale,
+ navigatorKey: AppGlobals.rootNavKey,
+ home: child,
+ );
+ },
+ );
+ },
+ );
+ }
}
class AppGlobals {
diff --git a/frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/context_builder.dart b/frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/context_builder.dart
index e4141c3e16..6c0fb560e8 100644
--- a/frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/context_builder.dart
+++ b/frontend/app_flowy/lib/workspace/application/grid/cell/cell_service/context_builder.dart
@@ -105,7 +105,7 @@ class _GridCellContext<T, D> extends Equatable {
final FieldService _fieldService;
late final CellListener _cellListener;
- late final ValueNotifier<T?> _cellDataNotifier;
+ late final ValueNotifier<T?>? _cellDataNotifier;
bool isListening = false;
VoidCallback? _onFieldChangedFn;
Timer? _loadDataOperation;
@@ -163,19 +163,19 @@ class _GridCellContext<T, D> extends Equatable {
}
onCellChangedFn() {
- onCellChanged(_cellDataNotifier.value);
+ onCellChanged(_cellDataNotifier?.value);
if (cellDataLoader.config.reloadOnCellChanged) {
_loadData();
}
}
- _cellDataNotifier.addListener(onCellChangedFn);
+ _cellDataNotifier?.addListener(onCellChangedFn);
return onCellChangedFn;
}
void removeListener(VoidCallback fn) {
- _cellDataNotifier.removeListener(fn);
+ _cellDataNotifier?.removeListener(fn);
}
T? getCellData({bool loadIfNoCache = true}) {
@@ -211,7 +211,7 @@ class _GridCellContext<T, D> extends Equatable {
_loadDataOperation?.cancel();
_loadDataOperation = Timer(const Duration(milliseconds: 10), () {
cellDataLoader.loadData().then((data) {
- _cellDataNotifier.value = data;
+ _cellDataNotifier?.value = data;
cellCache.insert(GridCellCacheData(key: _cacheKey, object: data));
});
});
diff --git a/frontend/app_flowy/lib/workspace/presentation/home/home_stack.dart b/frontend/app_flowy/lib/workspace/presentation/home/home_stack.dart
index c16c965a82..c9c210ab35 100644
--- a/frontend/app_flowy/lib/workspace/presentation/home/home_stack.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/home/home_stack.dart
@@ -2,15 +2,13 @@ import 'dart:io' show Platform;
import 'package:app_flowy/startup/startup.dart';
import 'package:app_flowy/workspace/application/home/home_bloc.dart';
-import 'package:app_flowy/workspace/presentation/home/home_screen.dart';
+import 'package:app_flowy/workspace/presentation/home/toast.dart';
import 'package:flowy_infra/theme.dart';
import 'package:flowy_sdk/log.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:provider/provider.dart';
import 'package:time/time.dart';
-import 'package:fluttertoast/fluttertoast.dart';
-
import 'package:app_flowy/plugin/plugin.dart';
import 'package:app_flowy/workspace/presentation/plugins/blank/blank.dart';
import 'package:app_flowy/workspace/presentation/home/home_sizes.dart';
@@ -22,8 +20,6 @@ import 'package:flowy_infra/notifier.dart';
typedef NavigationCallback = void Function(String id);
-late FToast fToast;
-
class HomeStack extends StatelessWidget {
static GlobalKey<ScaffoldState> scaffoldKey = GlobalKey();
// final Size size;
@@ -74,8 +70,7 @@ class _FadingIndexedStackState extends State<FadingIndexedStack> {
@override
void initState() {
super.initState();
- fToast = FToast();
- fToast.init(HomeScreen.scaffoldKey.currentState!.context);
+ initToastWithContext(context);
}
@override
diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/url_cell/url_cell.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/url_cell/url_cell.dart
index 8ba089b6a5..e823aedbfc 100644
--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/url_cell/url_cell.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/url_cell/url_cell.dart
@@ -1,6 +1,9 @@
import 'dart:async';
+import 'package:app_flowy/generated/locale_keys.g.dart';
import 'package:app_flowy/workspace/application/grid/cell/url_cell_bloc.dart';
+import 'package:app_flowy/workspace/presentation/home/toast.dart';
import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/cell/cell_accessory.dart';
+import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra/image.dart';
import 'package:flowy_infra/theme.dart';
import 'package:flutter/material.dart';
@@ -176,7 +179,9 @@ class _CopyURLAccessory extends StatelessWidget with GridCellAccessory {
@override
void onTap(BuildContext context) {
- final content = cellContext.getCellData()?.content ?? "";
+ final content = cellContext.getCellData(loadIfNoCache: false)?.content ?? "";
Clipboard.setData(ClipboardData(text: content));
+
+ showMessageToast(LocaleKeys.grid_row_copyProperty.tr());
}
}
diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart
index 87fc0594c4..029f3f61ea 100644
--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart
@@ -11,7 +11,6 @@ import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/header
import 'package:flowy_infra/image.dart';
import 'package:flowy_infra/theme.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
-import 'package:flowy_infra_ui/style_widget/hover.dart';
import 'package:flowy_infra_ui/style_widget/icon_button.dart';
import 'package:flowy_infra_ui/style_widget/scrolling/styled_scroll_bar.dart';
import 'package:flowy_infra_ui/widget/spacing.dart';
diff --git a/frontend/app_flowy/lib/workspace/presentation/widgets/float_bubble/question_bubble.dart b/frontend/app_flowy/lib/workspace/presentation/widgets/float_bubble/question_bubble.dart
index 762a978693..8fecbc9489 100644
--- a/frontend/app_flowy/lib/workspace/presentation/widgets/float_bubble/question_bubble.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/widgets/float_bubble/question_bubble.dart
@@ -1,5 +1,5 @@
+import 'package:app_flowy/startup/startup.dart';
import 'package:app_flowy/startup/tasks/rust_sdk.dart';
-import 'package:app_flowy/workspace/presentation/home/home_stack.dart';
import 'package:app_flowy/workspace/presentation/widgets/pop_up_action.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra/theme.dart';
@@ -115,7 +115,7 @@ class _DebugToast extends StatelessWidget {
}
void show() {
- fToast.showToast(
+ getIt<FToast>().showToast(
child: this,
gravity: ToastGravity.BOTTOM,
toastDuration: const Duration(seconds: 3),
diff --git a/frontend/app_flowy/pubspec.yaml b/frontend/app_flowy/pubspec.yaml
index eb7b17dc21..8dbc3b4c70 100644
--- a/frontend/app_flowy/pubspec.yaml
+++ b/frontend/app_flowy/pubspec.yaml
@@ -72,7 +72,7 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
device_info_plus: ^3.2.1
- fluttertoast: ^8.0.8
+ fluttertoast: ^8.0.9
table_calendar: ^3.0.5
reorderables: ^0.5.0
linked_scroll_controller: ^0.2.0