From efc1adecdfa26b54af96c976dee070320d86696f Mon Sep 17 00:00:00 2001 From: appflowy Date: Wed, 27 Oct 2021 23:56:41 +0800 Subject: [PATCH] [flutter]: modify action item's gesture behaviour --- app_flowy/lib/startup/tasks/sdk_task.dart | 2 +- .../presentation/stack_page/doc/styles.dart | 5 ++++- .../menu/widget/app/section/action.dart | 1 + .../src/services/doc/edit/doc_actor.rs | 19 +++++++++---------- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app_flowy/lib/startup/tasks/sdk_task.dart b/app_flowy/lib/startup/tasks/sdk_task.dart index df695241af..ce0dd1284b 100644 --- a/app_flowy/lib/startup/tasks/sdk_task.dart +++ b/app_flowy/lib/startup/tasks/sdk_task.dart @@ -40,7 +40,7 @@ class ApplicationBlocObserver extends BlocObserver { @override // ignore: unnecessary_overrides void onTransition(Bloc bloc, Transition transition) { - Log.debug("[current]: ${transition.currentState} \n[next]: ${transition.nextState}"); + // Log.debug("[current]: ${transition.currentState} \n[next]: ${transition.nextState}"); super.onTransition(bloc, transition); } diff --git a/app_flowy/lib/workspace/presentation/stack_page/doc/styles.dart b/app_flowy/lib/workspace/presentation/stack_page/doc/styles.dart index cd143c97d9..7ee0b40438 100644 --- a/app_flowy/lib/workspace/presentation/stack_page/doc/styles.dart +++ b/app_flowy/lib/workspace/presentation/stack_page/doc/styles.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_quill/flutter_quill.dart'; +import 'package:provider/provider.dart'; import 'package:tuple/tuple.dart'; import 'package:flowy_infra/theme.dart'; @@ -7,8 +8,10 @@ DefaultStyles customStyles(BuildContext context) { const baseSpacing = Tuple2(6, 0); final defaultTextStyle = DefaultTextStyle.of(context); final baseStyle = defaultTextStyle.style.copyWith( - fontSize: 16, + fontSize: 18, height: 1.3, + fontWeight: FontWeight.w400, + letterSpacing: 0.6, ); final theme = context.watch(); final themeData = theme.themeData; diff --git a/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/section/action.dart b/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/section/action.dart index a3f941fc04..9cd4db5922 100644 --- a/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/section/action.dart +++ b/app_flowy/lib/workspace/presentation/widgets/menu/widget/app/section/action.dart @@ -63,6 +63,7 @@ class ActionItem extends StatelessWidget { config: HoverDisplayConfig(hoverColor: theme.hover), builder: (context, onHover) { return GestureDetector( + behavior: HitTestBehavior.opaque, onTap: () => onSelected(action), child: Row( children: [ diff --git a/rust-lib/flowy-document/src/services/doc/edit/doc_actor.rs b/rust-lib/flowy-document/src/services/doc/edit/doc_actor.rs index c9d49b611a..90e67a5b71 100644 --- a/rust-lib/flowy-document/src/services/doc/edit/doc_actor.rs +++ b/rust-lib/flowy-document/src/services/doc/edit/doc_actor.rs @@ -2,16 +2,14 @@ use crate::{ entities::doc::{RevId, Revision}, errors::DocResult, services::doc::{ - edit::{ - message::{DocumentMsg, TransformDeltas}, - }, + edit::message::{DocumentMsg, TransformDeltas}, Document, }, }; use async_stream::stream; use flowy_ot::core::{Delta, OperationTransformable}; use futures::stream::StreamExt; -use std::{convert::TryFrom, sync::Arc}; +use std::{convert::TryFrom, sync::Arc, thread}; use tokio::sync::{mpsc, RwLock}; pub struct DocumentActor { @@ -20,10 +18,7 @@ pub struct DocumentActor { } impl DocumentActor { - pub fn new( - delta: Delta, - receiver: mpsc::UnboundedReceiver, - ) -> Self { + pub fn new(delta: Delta, receiver: mpsc::UnboundedReceiver) -> Self { let document = Arc::new(RwLock::new(Document::from_delta(delta))); Self { document, @@ -116,12 +111,16 @@ impl DocumentActor { } async fn compose_delta(&self, delta: Delta) -> DocResult<()> { - let result = self.document.write().await.compose_delta(&delta); + // log::debug!("{:?} thread handle_message", thread::current(),); + let mut document = self.document.write().await; + let result = document.compose_delta(&delta); log::debug!( "Client compose push delta: {}. result: {}", delta.to_json(), - self.document.read().await.to_json() + document.to_json() ); + drop(document); + result } }