[flutter]: modify action item's gesture behaviour

This commit is contained in:
appflowy 2021-10-27 23:56:41 +08:00
parent d8487fcc16
commit efc1adecdf
4 changed files with 15 additions and 12 deletions

View File

@ -40,7 +40,7 @@ class ApplicationBlocObserver extends BlocObserver {
@override @override
// ignore: unnecessary_overrides // ignore: unnecessary_overrides
void onTransition(Bloc bloc, Transition transition) { 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); super.onTransition(bloc, transition);
} }

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart'; import 'package:flutter_quill/flutter_quill.dart';
import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
import 'package:flowy_infra/theme.dart'; import 'package:flowy_infra/theme.dart';
@ -7,8 +8,10 @@ DefaultStyles customStyles(BuildContext context) {
const baseSpacing = Tuple2<double, double>(6, 0); const baseSpacing = Tuple2<double, double>(6, 0);
final defaultTextStyle = DefaultTextStyle.of(context); final defaultTextStyle = DefaultTextStyle.of(context);
final baseStyle = defaultTextStyle.style.copyWith( final baseStyle = defaultTextStyle.style.copyWith(
fontSize: 16, fontSize: 18,
height: 1.3, height: 1.3,
fontWeight: FontWeight.w400,
letterSpacing: 0.6,
); );
final theme = context.watch<AppTheme>(); final theme = context.watch<AppTheme>();
final themeData = theme.themeData; final themeData = theme.themeData;

View File

@ -63,6 +63,7 @@ class ActionItem extends StatelessWidget {
config: HoverDisplayConfig(hoverColor: theme.hover), config: HoverDisplayConfig(hoverColor: theme.hover),
builder: (context, onHover) { builder: (context, onHover) {
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => onSelected(action), onTap: () => onSelected(action),
child: Row( child: Row(
children: [ children: [

View File

@ -2,16 +2,14 @@ use crate::{
entities::doc::{RevId, Revision}, entities::doc::{RevId, Revision},
errors::DocResult, errors::DocResult,
services::doc::{ services::doc::{
edit::{ edit::message::{DocumentMsg, TransformDeltas},
message::{DocumentMsg, TransformDeltas},
},
Document, Document,
}, },
}; };
use async_stream::stream; use async_stream::stream;
use flowy_ot::core::{Delta, OperationTransformable}; use flowy_ot::core::{Delta, OperationTransformable};
use futures::stream::StreamExt; use futures::stream::StreamExt;
use std::{convert::TryFrom, sync::Arc}; use std::{convert::TryFrom, sync::Arc, thread};
use tokio::sync::{mpsc, RwLock}; use tokio::sync::{mpsc, RwLock};
pub struct DocumentActor { pub struct DocumentActor {
@ -20,10 +18,7 @@ pub struct DocumentActor {
} }
impl DocumentActor { impl DocumentActor {
pub fn new( pub fn new(delta: Delta, receiver: mpsc::UnboundedReceiver<DocumentMsg>) -> Self {
delta: Delta,
receiver: mpsc::UnboundedReceiver<DocumentMsg>,
) -> Self {
let document = Arc::new(RwLock::new(Document::from_delta(delta))); let document = Arc::new(RwLock::new(Document::from_delta(delta)));
Self { Self {
document, document,
@ -116,12 +111,16 @@ impl DocumentActor {
} }
async fn compose_delta(&self, delta: Delta) -> DocResult<()> { 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!( log::debug!(
"Client compose push delta: {}. result: {}", "Client compose push delta: {}. result: {}",
delta.to_json(), delta.to_json(),
self.document.read().await.to_json() document.to_json()
); );
drop(document);
result result
} }
} }