diff --git a/app_flowy/.vscode/launch.json b/app_flowy/.vscode/launch.json index 0660f0d670..cfda11ed31 100644 --- a/app_flowy/.vscode/launch.json +++ b/app_flowy/.vscode/launch.json @@ -9,7 +9,7 @@ "request": "launch", "program": "${workspaceRoot}/lib/main.dart", "type": "dart", - "preLaunchTask": "BuildRust", + "preLaunchTask": "build_flowy_sdk", "cwd": "${workspaceRoot}" }, { diff --git a/app_flowy/.vscode/tasks.json b/app_flowy/.vscode/tasks.json index 98ce703ff7..f14c8da465 100644 --- a/app_flowy/.vscode/tasks.json +++ b/app_flowy/.vscode/tasks.json @@ -1,8 +1,6 @@ { "version": "2.0.0", - "tasks": [ - { - // https://code.visualstudio.com/docs/editor/tasks + // https://code.visualstudio.com/docs/editor/tasks //https://gist.github.com/deadalusai/9e13e36d61ec7fb72148 // ${workspaceRoot}: the root folder of the team @@ -11,7 +9,8 @@ // ${fileDirname}: the current opened file's dirname // ${fileExtname}: the current opened file's extension // ${cwd}: the current working directory of the spawned process - + "tasks": [ + { "type": "shell", "command": "sh ./scripts/build_sdk.sh", "group": "build", @@ -21,7 +20,19 @@ // "problemMatcher": [ // "$rustc" // ], - "label": "BuildRust" + "label": "build_flowy_sdk" + }, + { + "type": "shell", + "command": "sh ./scripts/code_gen.sh", + "group": "build", + "options": { + "cwd": "${workspaceFolder}/../" + }, + "problemMatcher": [ + "$rustc" + ], + "label": "generate events" } ] } \ No newline at end of file diff --git a/app_flowy/lib/workspace/presentation/app/app_widget.dart b/app_flowy/lib/workspace/presentation/app/app_widget.dart index a41193105b..59bee10de1 100644 --- a/app_flowy/lib/workspace/presentation/app/app_widget.dart +++ b/app_flowy/lib/workspace/presentation/app/app_widget.dart @@ -76,10 +76,7 @@ class AppWidget extends MenuItem { hasIcon: false, ), header: AppHeader(app), - expanded: Padding( - padding: EdgeInsets.only(left: AppWidgetSize.expandedPadding), - child: child, - ), + expanded: child, collapsed: const SizedBox(), ), ], diff --git a/app_flowy/lib/workspace/presentation/app/view_list.dart b/app_flowy/lib/workspace/presentation/app/view_list.dart index 0f81b64eaa..030a4bb22e 100644 --- a/app_flowy/lib/workspace/presentation/app/view_list.dart +++ b/app_flowy/lib/workspace/presentation/app/view_list.dart @@ -1,6 +1,7 @@ import 'package:app_flowy/workspace/presentation/view/view_widget.dart'; import 'package:flowy_infra/flowy_logger.dart'; import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart'; +import 'package:flowy_infra_ui/style_widget/styled_hover.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:dartz/dartz.dart'; @@ -26,11 +27,15 @@ class ViewList extends StatelessWidget { var targetViews = views.map((view) { return Padding( padding: const EdgeInsets.symmetric(vertical: 6), - child: ViewWidget( - view: view, + child: StyledHover( + color: Colors.red, + borderRadius: BorderRadius.circular(8), + child: ViewWidget( + view: view, + ), ), ); - }).toList(growable: true); + }).toList(growable: false); return targetViews; } diff --git a/app_flowy/lib/workspace/presentation/view/view_widget.dart b/app_flowy/lib/workspace/presentation/view/view_widget.dart index 50a730e7d0..0b75e406f9 100644 --- a/app_flowy/lib/workspace/presentation/view/view_widget.dart +++ b/app_flowy/lib/workspace/presentation/view/view_widget.dart @@ -1,6 +1,7 @@ import 'package:app_flowy/startup/startup.dart'; import 'package:app_flowy/workspace/domain/image.dart'; import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart'; +import 'package:app_flowy/workspace/presentation/app/app_widget.dart'; import 'package:flowy_infra_ui/widget/spacing.dart'; import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart'; import 'package:flutter/material.dart'; @@ -11,7 +12,15 @@ class ViewWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return InkWell(onTap: _openView(context), child: buildContent()); + final contentPadding = EdgeInsets.only( + left: AppWidgetSize.expandedPadding, top: 5, bottom: 5, right: 5); + return InkWell( + onTap: _openView(context), + child: Padding( + padding: contentPadding, + child: buildContent(), + ), + ); } Row buildContent() { diff --git a/app_flowy/packages/flowy_editor/lib/src/service/controller.dart b/app_flowy/packages/flowy_editor/lib/src/service/controller.dart index e9f9339fa6..1275740594 100644 --- a/app_flowy/packages/flowy_editor/lib/src/service/controller.dart +++ b/app_flowy/packages/flowy_editor/lib/src/service/controller.dart @@ -111,6 +111,7 @@ class EditorController extends ChangeNotifier { Delta? delta; if (length > 0 || data is! String || data.isNotEmpty) { delta = document.replace(index, length, data); + print(delta); var shouldRetainDelta = toggledStyle.isNotEmpty && delta.isNotEmpty && delta.length <= 2 && diff --git a/app_flowy/packages/flowy_infra_ui/lib/style_widget/styled_hover.dart b/app_flowy/packages/flowy_infra_ui/lib/style_widget/styled_hover.dart new file mode 100644 index 0000000000..64001583af --- /dev/null +++ b/app_flowy/packages/flowy_infra_ui/lib/style_widget/styled_hover.dart @@ -0,0 +1,59 @@ +import 'package:flowy_infra_ui/widget/mouse_hover_builder.dart'; +import 'package:flutter/material.dart'; +import 'package:flowy_infra/time/duration.dart'; + +class StyledHover extends StatelessWidget { + final Color color; + final Color borderColor; + final double borderWidth; + final Widget child; + final BorderRadius borderRadius; + + const StyledHover({ + Key? key, + required this.color, + required this.child, + this.borderColor = Colors.transparent, + this.borderWidth = 0, + this.borderRadius = BorderRadius.zero, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return MouseHoverBuilder( + builder: (_, isHovered) => AnimatedContainer( + decoration: BoxDecoration( + border: Border.all(color: borderColor, width: borderWidth), + color: isHovered ? color : Colors.transparent, + borderRadius: borderRadius, + ), + duration: .1.seconds, + child: child, + ), + ); + } +} + + +// @override +// Widget build(BuildContext context) { +// return GestureDetector( +// behavior: HitTestBehavior.translucent, +// onTap: () { +// context +// .read() +// .add(HomeEvent.setEditPannel(CellEditPannelContext())); +// }, +// child: MouseHoverBuilder( +// builder: (_, isHovered) => Container( +// width: width, +// decoration: CellDecoration.box( +// color: isHovered ? Colors.red.withOpacity(.1) : Colors.transparent, +// ), +// padding: EdgeInsets.symmetric( +// vertical: GridInsets.vertical, horizontal: GridInsets.horizontal), +// child: child, +// ), +// ), +// ); +// } \ No newline at end of file diff --git a/scripts/build_sdk.sh b/scripts/build_sdk.sh index f4939d0d24..69e8445df5 100755 --- a/scripts/build_sdk.sh +++ b/scripts/build_sdk.sh @@ -12,5 +12,4 @@ rustup show # 2. ~/.bashrc # 3. ~/.profile # 4. ~/.zshrc -cargo make desktop - +cargo make desktop \ No newline at end of file diff --git a/scripts/code_gen.sh b/scripts/code_gen.sh new file mode 100755 index 0000000000..21207f6fca --- /dev/null +++ b/scripts/code_gen.sh @@ -0,0 +1,3 @@ +#!/bin/sh +#!/usr/bin/env fish +cargo make gen_dart_event \ No newline at end of file