浏览代码

fix apps refresh issue and share button layout issue

appflowy 3 年之前
父节点
当前提交
5a3099e323

+ 1 - 1
frontend/app_flowy/assets/translations/en.json

@@ -36,7 +36,7 @@
   },
   "shareAction": {
     "buttonText": "Share",
-    "workInProgress": "Work in progress",
+    "workInProgress": "Coming soon",
     "markdown": "Markdown",
     "copyLink": "Copy Link"
   },

+ 1 - 1
frontend/app_flowy/assets/translations/fr-CA.json

@@ -36,7 +36,7 @@
   },
   "shareAction": {
     "buttonText": "Partager",
-    "workInProgress": "À venir",
+    "workInProgress": "Bientôt disponible",
     "markdown": "Markdown",
     "copyLink": "Copier le liens"
   },

+ 1 - 1
frontend/app_flowy/assets/translations/it-IT.json

@@ -36,7 +36,7 @@
   },
   "shareAction": {
     "buttonText": "Condividi",
-    "workInProgress": "In corso",
+    "workInProgress": "Prossimamente",
     "markdown": "Markdown",
     "copyLink": "Copia Link"
   },

+ 1 - 1
frontend/app_flowy/assets/translations/zh-CN.json

@@ -36,7 +36,7 @@
   },
   "shareAction": {
     "buttonText": "分享",
-    "workInProgress": "进行中",
+    "workInProgress": "敬请期待",
     "markdown": "Markdown",
     "copyLink": "复制链接"
   },

+ 4 - 4
frontend/app_flowy/lib/workspace/application/menu/menu_bloc.dart

@@ -49,13 +49,13 @@ class MenuBloc extends Bloc<MenuEvent, MenuState> {
 
   Future<void> _performActionOnCreateApp(CreateApp event, Emitter<MenuState> emit) async {
     final result = await workspaceManager.createApp(name: event.name, desc: event.desc);
-    emit(result.fold(
-      (app) => state.copyWith(apps: some([app])),
+    result.fold(
+      (app) => {},
       (error) {
         Log.error(error);
-        return state.copyWith(successOrFailure: right(error));
+        emit(state.copyWith(successOrFailure: right(error)));
       },
-    ));
+    );
   }
 
   // ignore: unused_element

+ 2 - 2
frontend/app_flowy/lib/workspace/infrastructure/repos/workspace_repo.dart

@@ -123,7 +123,7 @@ class WorkspaceListenerRepo {
 
   Future<void> close() async {
     await _subscription?.cancel();
-    _appsChanged = null;
-    _update = null;
+    // _appsChanged = null;
+    // _update = null;
   }
 }

+ 18 - 11
frontend/app_flowy/lib/workspace/presentation/stack_page/doc/doc_stack_page.dart

@@ -49,7 +49,7 @@ class DocStackContext extends HomeStackContext<int, ShareActionWrapper> {
   Widget get leftBarItem => DocumentLeftBarItem(view: _view);
 
   @override
-  Widget? get rightBarItem => DococumentShareButton(view: _view);
+  Widget? get rightBarItem => DocumentShareButton(view: _view);
 
   @override
   String get identifier => _view.id;
@@ -150,9 +150,9 @@ class _DocumentLeftBarItemState extends State<DocumentLeftBarItem> {
   }
 }
 
-class DococumentShareButton extends StatelessWidget {
+class DocumentShareButton extends StatelessWidget {
   final View view;
-  DococumentShareButton({Key? key, required this.view}) : super(key: ValueKey(view.hashCode));
+  DocumentShareButton({Key? key, required this.view}) : super(key: ValueKey(view.hashCode));
 
   @override
   Widget build(BuildContext context) {
@@ -178,14 +178,21 @@ class DococumentShareButton extends StatelessWidget {
               value: Provider.of<AppearanceSettingModel>(context, listen: true),
               child: Selector<AppearanceSettingModel, AppLanguage>(
                 selector: (ctx, notifier) => notifier.language,
-                builder: (ctx, _, child) => RoundedTextButton(
-                  title: LocaleKeys.shareAction_buttonText.tr(),
-                  height: 30,
-                  width: buttonWidth,
-                  fontSize: 12,
-                  borderRadius: Corners.s6Border,
-                  color: Colors.lightBlue,
-                  onPressed: () => _showActionList(context, Offset(-(buttonWidth / 2), 10)),
+                builder: (ctx, _, child) => ConstrainedBox(
+                  constraints: BoxConstraints(
+                    maxHeight: 30,
+                    minWidth: buttonWidth,
+                    maxWidth: 100,
+                  ),
+                  child: RoundedTextButton(
+                    title: LocaleKeys.shareAction_buttonText.tr(),
+                    // height: 30,
+                    // width: buttonWidth,
+                    fontSize: 12,
+                    borderRadius: Corners.s6Border,
+                    color: Colors.lightBlue,
+                    onPressed: () => _showActionList(context, Offset(-(buttonWidth / 2), 10)),
+                  ),
                 ),
               ),
             );

+ 3 - 1
frontend/app_flowy/lib/workspace/presentation/widgets/menu/menu.dart

@@ -77,7 +77,9 @@ class HomeMenu extends StatelessWidget {
           ),
           BlocListener<MenuBloc, MenuState>(
             listenWhen: (p, c) => p.isCollapse != c.isCollapse,
-            listener: (context, state) => _collapsedNotifier.value = state.isCollapse,
+            listener: (context, state) {
+              _collapsedNotifier.value = state.isCollapse;
+            },
           )
         ],
         child: BlocBuilder<MenuBloc, MenuState>(

+ 3 - 3
frontend/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/menu_app.dart

@@ -41,13 +41,13 @@ class _MenuAppState extends State<MenuApp> {
       ],
       child: BlocSelector<AppBloc, AppState, AppDataNotifier>(
         selector: (state) {
-          final menuState = Provider.of<MenuSharedState>(context, listen: false);
+          final menuSharedState = Provider.of<MenuSharedState>(context, listen: false);
           if (state.latestCreatedView != null) {
-            menuState.forcedOpenView.value = state.latestCreatedView!;
+            menuSharedState.forcedOpenView.value = state.latestCreatedView!;
           }
 
           notifier.views = state.views;
-          notifier.selectedView = menuState.selectedView.value;
+          notifier.selectedView = menuSharedState.selectedView.value;
           return notifier;
         },
         builder: (context, notifier) => ChangeNotifierProvider.value(