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.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
rename folder
appflowy78af679626fb
diff --git a/app_flowy/lib/home/presentation/widgets/app/view_list.dart b/app_flowy/lib/home/presentation/widgets/app/view_list.dartdeleted file mode 100644index 0b916336e8..0000000000--- a/app_flowy/lib/home/presentation/widgets/app/view_list.dart+++ /dev/null@@ -1,110 +0,0 @@-import 'package:flowy_infra/flowy_logger.dart';-import 'package:flowy_infra/size.dart';-import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';-import 'package:flutter/foundation.dart';-import 'package:flutter/material.dart';-import 'package:flutter_bloc/flutter_bloc.dart';-import 'package:styled_widget/styled_widget.dart';--class ViewList extends StatelessWidget {- final List<View> views;- const ViewList(this.views, {Key? key}) : super(key: key);-- @override- Widget build(BuildContext context) {- Log.info('ViewList build');- if (views.isEmpty) {- return const SizedBox(- height: 30,- );- } else {- return Column(- children: buildViewWidgets(),- ).padding(vertical: Insets.sm);- }- }-- List<ViewWidget> buildViewWidgets() {- var targetViews = views.map((view) {- return ViewWidget(- icon: const Icon(Icons.file_copy),- view: view,- );- }).toList(growable: true);- targetViews.addAll(_mockViewWidgets());- return targetViews;- }-- // TODO: junlin - remove view mocker after integrate docs storage to db- List<ViewWidget> _mockViewWidgets() {- // Stub doc views- final docViews = _mockDocsViews();- return docViews.map((view) {- return ViewWidget(- icon: Icon(Icons.edit_sharp),- view: view,- );- }).toList(growable: false);- }-- // TODO: junlin - remove view mocker after integrate docs storage to db- List<View> _mockDocsViews() {- // plain text doc- var plainTextView = View();- plainTextView.id = 'doc_plain_text_document';- plainTextView.name = 'Plain Text Doc';- // code blocks doc-- return [plainTextView];- }-- @override- void debugFillProperties(DiagnosticPropertiesBuilder properties) {- super.debugFillProperties(properties);- properties.add(IterableProperty<View>('views', views));- }-}--class ViewWidget extends StatelessWidget {- final View view;- final Widget icon;- const ViewWidget({Key? key, required this.view, required this.icon})- : super(key: key);-- @override- Widget build(BuildContext context) {- return InkWell(- onTap: _handleTapOnView(context),- child: Container(- height: 30,- child: buildContent(),- ));- }-- Row buildContent() {- return Row(- children: [- icon,- const SizedBox(- width: 4,- ),- Text(- view.name,- textAlign: TextAlign.start,- style: const TextStyle(fontSize: 15),- )- ],- );- }-- Function() _handleTapOnView(BuildContext context) {- return () {- // if (view.id.startsWith('doc')) {- // context.read<MenuBloc>().add(MenuEvent.openPage(DocPageContext(view)));- // return;- // }-- // context.read<MenuBloc>().add(MenuEvent.openPage(GridPageContext(view)));- };- }-}diff --git a/app_flowy/lib/startup/deps_inject/prelude.dart b/app_flowy/lib/startup/deps_inject/prelude.dartindex 06f7f54a68..8727cba4a2 100644--- a/app_flowy/lib/startup/deps_inject/prelude.dart+++ b/app_flowy/lib/startup/deps_inject/prelude.dart@@ -1,4 +1,4 @@-import 'package:app_flowy/home/infrastructure/deps_resolver.dart';+import 'package:app_flowy/workspace/infrastructure/deps_resolver.dart';import 'package:app_flowy/startup/launch.dart';import 'package:app_flowy/startup/startup.dart';import 'package:app_flowy/user/infrastructure/deps_resolver.dart';diff --git a/app_flowy/lib/user/presentation/sign_in/widgets/body.dart b/app_flowy/lib/user/presentation/sign_in/widgets/body.dartindex 7021dd740b..be49b3f7b9 100644--- a/app_flowy/lib/user/presentation/sign_in/widgets/body.dart+++ b/app_flowy/lib/user/presentation/sign_in/widgets/body.dart@@ -1,7 +1,7 @@-import 'package:app_flowy/home/presentation/home_screen.dart';import 'package:app_flowy/startup/startup.dart';import 'package:app_flowy/user/application/sign_in/sign_in_bloc.dart';import 'package:app_flowy/user/presentation/sign_in/widgets/background.dart';+import 'package:app_flowy/workspace/presentation/home/home_screen.dart';import 'package:dartz/dartz.dart';import 'package:flowy_infra_ui/widget/rounded_button.dart';import 'package:flowy_infra_ui/widget/rounded_input_field.dart';diff --git a/app_flowy/lib/welcome/infrastructure/deps_resolver.dart b/app_flowy/lib/welcome/infrastructure/deps_resolver.dartindex 9ac3f0a0b7..070301e799 100644--- a/app_flowy/lib/welcome/infrastructure/deps_resolver.dart+++ b/app_flowy/lib/welcome/infrastructure/deps_resolver.dart@@ -1,6 +1,6 @@-import 'package:app_flowy/home/application/edit_pannel/edit_pannel_bloc.dart';-import 'package:app_flowy/home/application/home_bloc.dart';-import 'package:app_flowy/home/application/watcher/home_watcher_bloc.dart';+import 'package:app_flowy/workspace/application/edit_pannel/edit_pannel_bloc.dart';+import 'package:app_flowy/workspace/application/home_bloc.dart';+import 'package:app_flowy/workspace/application/watcher/home_watcher_bloc.dart';import 'package:app_flowy/welcome/application/welcome_bloc.dart';import 'package:app_flowy/welcome/infrastructure/i_welcome_impl.dart';import 'package:get_it/get_it.dart';diff --git a/app_flowy/lib/welcome/infrastructure/i_welcome_impl.dart b/app_flowy/lib/welcome/infrastructure/i_welcome_impl.dartindex dfc9b1e127..671c8427f6 100644--- a/app_flowy/lib/welcome/infrastructure/i_welcome_impl.dart+++ b/app_flowy/lib/welcome/infrastructure/i_welcome_impl.dart@@ -1,7 +1,7 @@-import 'package:app_flowy/home/presentation/home_screen.dart';import 'package:app_flowy/user/presentation/sign_in/sign_in_screen.dart';import 'package:app_flowy/welcome/domain/auth_state.dart';import 'package:app_flowy/welcome/domain/i_welcome.dart';+import 'package:app_flowy/workspace/presentation/home/home_screen.dart';import 'package:flowy_sdk/dispatch/dispatch.dart';import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart';import 'package:flutter/material.dart';diff --git a/app_flowy/lib/home/application/app/app_bloc.dart b/app_flowy/lib/workspace/application/app/app_bloc.dartsimilarity index 59%rename from app_flowy/lib/home/application/app/app_bloc.dartrename to app_flowy/lib/workspace/application/app/app_bloc.dartindex 81929a6540..45200aa8d3 100644--- a/app_flowy/lib/home/application/app/app_bloc.dart+++ b/app_flowy/lib/workspace/application/app/app_bloc.dart@@ -1,4 +1,4 @@-import 'package:app_flowy/home/domain/i_app.dart';+import 'package:app_flowy/workspace/domain/i_app.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';import 'package:freezed_annotation/freezed_annotation.dart';@@ -16,19 +16,30 @@ class AppBloc extends Bloc<AppEvent, AppState> {AppEvent event,) async* {yield* event.map(- initial: (e) async* {},- viewsReceived: (e) async* {- yield state;+ initial: (e) async* {+ yield* _fetchViews();},+ createView: (CreateView value) async* {+ iAppImpl.createView(+ name: value.name, desc: value.desc, viewType: value.viewType);+ },+ );+ }++ Stream<AppState> _fetchViews() async* {+ final viewsOrFailed = await iAppImpl.getViews();+ yield viewsOrFailed.fold(+ (apps) => state.copyWith(views: some(apps)),+ (error) => state.copyWith(successOrFailure: right(error)),);}}@freezedabstract class AppEvent with _$AppEvent {- const factory AppEvent.initial() = _Initial;- const factory AppEvent.viewsReceived(- Either<List<View>, WorkspaceError> appsOrFail) = ViewsReceived;+ const factory AppEvent.initial() = Initial;+ const factory AppEvent.createView(+ String name, String desc, ViewType viewType) = CreateView;}@freezeddiff --git a/app_flowy/lib/home/application/app/app_bloc.freezed.dart b/app_flowy/lib/workspace/application/app/app_bloc.freezed.dartsimilarity index 67%rename from app_flowy/lib/home/application/app/app_bloc.freezed.dartrename to app_flowy/lib/workspace/application/app/app_bloc.freezed.dartindex 82645f0456..eb75305a1b 100644--- a/app_flowy/lib/home/application/app/app_bloc.freezed.dart+++ b/app_flowy/lib/workspace/application/app/app_bloc.freezed.dart@@ -16,13 +16,15 @@ final _privateConstructorUsedError = UnsupportedError(class _$AppEventTearOff {const _$AppEventTearOff();- _Initial initial() {- return const _Initial();+ Initial initial() {+ return const Initial();}- ViewsReceived viewsReceived(Either<List<View>, WorkspaceError> appsOrFail) {- return ViewsReceived(- appsOrFail,+ CreateView createView(String name, String desc, ViewType viewType) {+ return CreateView(+ name,+ desc,+ viewType,);}}@@ -35,28 +37,27 @@ mixin _$AppEvent {@optionalTypeArgsTResult when<TResult extends Object?>({required TResult Function() initial,- required TResult Function(Either<List<View>, WorkspaceError> appsOrFail)- viewsReceived,+ required TResult Function(String name, String desc, ViewType viewType)+ createView,}) =>throw _privateConstructorUsedError;@optionalTypeArgsTResult maybeWhen<TResult extends Object?>({TResult Function()? initial,- TResult Function(Either<List<View>, WorkspaceError> appsOrFail)?- viewsReceived,+ TResult Function(String name, String desc, ViewType viewType)? createView,required TResult orElse(),}) =>throw _privateConstructorUsedError;@optionalTypeArgsTResult map<TResult extends Object?>({- required TResult Function(_Initial value) initial,- required TResult Function(ViewsReceived value) viewsReceived,+ required TResult Function(Initial value) initial,+ required TResult Function(CreateView value) createView,}) =>throw _privateConstructorUsedError;@optionalTypeArgsTResult maybeMap<TResult extends Object?>({- TResult Function(_Initial value)? initial,- TResult Function(ViewsReceived value)? viewsReceived,+ TResult Function(Initial value)? initial,+ TResult Function(CreateView value)? createView,required TResult orElse(),}) =>throw _privateConstructorUsedError;@@ -78,25 +79,25 @@ class _$AppEventCopyWithImpl<$Res> implements $AppEventCopyWith<$Res> {}/// @nodoc-abstract class _$InitialCopyWith<$Res> {- factory _$InitialCopyWith(_Initial value, $Res Function(_Initial) then) =- __$InitialCopyWithImpl<$Res>;+abstract class $InitialCopyWith<$Res> {+ factory $InitialCopyWith(Initial value, $Res Function(Initial) then) =+ _$InitialCopyWithImpl<$Res>;}/// @nodoc-class __$InitialCopyWithImpl<$Res> extends _$AppEventCopyWithImpl<$Res>- implements _$InitialCopyWith<$Res> {- __$InitialCopyWithImpl(_Initial _value, $Res Function(_Initial) _then)- : super(_value, (v) => _then(v as _Initial));+class _$InitialCopyWithImpl<$Res> extends _$AppEventCopyWithImpl<$Res>+ implements $InitialCopyWith<$Res> {+ _$InitialCopyWithImpl(Initial _value, $Res Function(Initial) _then)+ : super(_value, (v) => _then(v as Initial));@override- _Initial get _value => super._value as _Initial;+ Initial get _value => super._value as Initial;}/// @nodoc-class _$_Initial implements _Initial {- const _$_Initial();+class _$Initial implements Initial {+ const _$Initial();@overrideString toString() {@@ -105,7 +106,7 @@ class _$_Initial implements _Initial {@overridebool operator ==(dynamic other) {- return identical(this, other) || (other is _Initial);+ return identical(this, other) || (other is Initial);}@override@@ -115,8 +116,8 @@ class _$_Initial implements _Initial {@optionalTypeArgsTResult when<TResult extends Object?>({required TResult Function() initial,- required TResult Function(Either<List<View>, WorkspaceError> appsOrFail)- viewsReceived,+ required TResult Function(String name, String desc, ViewType viewType)+ createView,}) {return initial();}@@ -125,8 +126,7 @@ class _$_Initial implements _Initial {@optionalTypeArgsTResult maybeWhen<TResult extends Object?>({TResult Function()? initial,- TResult Function(Either<List<View>, WorkspaceError> appsOrFail)?- viewsReceived,+ TResult Function(String name, String desc, ViewType viewType)? createView,required TResult orElse(),}) {if (initial != null) {@@ -138,8 +138,8 @@ class _$_Initial implements _Initial {@override@optionalTypeArgsTResult map<TResult extends Object?>({- required TResult Function(_Initial value) initial,- required TResult Function(ViewsReceived value) viewsReceived,+ required TResult Function(Initial value) initial,+ required TResult Function(CreateView value) createView,}) {return initial(this);}@@ -147,8 +147,8 @@ class _$_Initial implements _Initial {@override@optionalTypeArgsTResult maybeMap<TResult extends Object?>({- TResult Function(_Initial value)? initial,- TResult Function(ViewsReceived value)? viewsReceived,+ TResult Function(Initial value)? initial,+ TResult Function(CreateView value)? createView,required TResult orElse(),}) {if (initial != null) {@@ -158,92 +158,111 @@ class _$_Initial implements _Initial {}}-abstract class _Initial implements AppEvent {- const factory _Initial() = _$_Initial;+abstract class Initial implements AppEvent {+ const factory Initial() = _$Initial;}/// @nodoc-abstract class $ViewsReceivedCopyWith<$Res> {- factory $ViewsReceivedCopyWith(- ViewsReceived value, $Res Function(ViewsReceived) then) =- _$ViewsReceivedCopyWithImpl<$Res>;- $Res call({Either<List<View>, WorkspaceError> appsOrFail});+abstract class $CreateViewCopyWith<$Res> {+ factory $CreateViewCopyWith(+ CreateView value, $Res Function(CreateView) then) =+ _$CreateViewCopyWithImpl<$Res>;+ $Res call({String name, String desc, ViewType viewType});}/// @nodoc-class _$ViewsReceivedCopyWithImpl<$Res> extends _$AppEventCopyWithImpl<$Res>- implements $ViewsReceivedCopyWith<$Res> {- _$ViewsReceivedCopyWithImpl(- ViewsReceived _value, $Res Function(ViewsReceived) _then)- : super(_value, (v) => _then(v as ViewsReceived));+class _$CreateViewCopyWithImpl<$Res> extends _$AppEventCopyWithImpl<$Res>+ implements $CreateViewCopyWith<$Res> {+ _$CreateViewCopyWithImpl(CreateView _value, $Res Function(CreateView) _then)+ : super(_value, (v) => _then(v as CreateView));@override- ViewsReceived get _value => super._value as ViewsReceived;+ CreateView get _value => super._value as CreateView;@override$Res call({- Object? appsOrFail = freezed,+ Object? name = freezed,+ Object? desc = freezed,+ Object? viewType = freezed,}) {- return _then(ViewsReceived(- appsOrFail == freezed- ? _value.appsOrFail- : appsOrFail // ignore: cast_nullable_to_non_nullable- as Either<List<View>, WorkspaceError>,+ return _then(CreateView(+ name == freezed+ ? _value.name+ : name // ignore: cast_nullable_to_non_nullable+ as String,+ desc == freezed+ ? _value.desc+ : desc // ignore: cast_nullable_to_non_nullable+ as String,+ viewType == freezed+ ? _value.viewType+ : viewType // ignore: cast_nullable_to_non_nullable+ as ViewType,));}}/// @nodoc-class _$ViewsReceived implements ViewsReceived {- const _$ViewsReceived(this.appsOrFail);+class _$CreateView implements CreateView {+ const _$CreateView(this.name, this.desc, this.viewType);@override- final Either<List<View>, WorkspaceError> appsOrFail;+ final String name;+ @override+ final String desc;+ @override+ final ViewType viewType;@overrideString toString() {- return 'AppEvent.viewsReceived(appsOrFail: $appsOrFail)';+ return 'AppEvent.createView(name: $name, desc: $desc, viewType: $viewType)';}@overridebool operator ==(dynamic other) {return identical(this, other) ||- (other is ViewsReceived &&- (identical(other.appsOrFail, appsOrFail) ||+ (other is CreateView &&+ (identical(other.name, name) ||+ const DeepCollectionEquality().equals(other.name, name)) &&+ (identical(other.desc, desc) ||+ const DeepCollectionEquality().equals(other.desc, desc)) &&+ (identical(other.viewType, viewType) ||const DeepCollectionEquality()- .equals(other.appsOrFail, appsOrFail)));+ .equals(other.viewType, viewType)));}@overrideint get hashCode =>- runtimeType.hashCode ^ const DeepCollectionEquality().hash(appsOrFail);+ runtimeType.hashCode ^+ const DeepCollectionEquality().hash(name) ^+ const DeepCollectionEquality().hash(desc) ^+ const DeepCollectionEquality().hash(viewType);@JsonKey(ignore: true)@override- $ViewsReceivedCopyWith<ViewsReceived> get copyWith =>- _$ViewsReceivedCopyWithImpl<ViewsReceived>(this, _$identity);+ $CreateViewCopyWith<CreateView> get copyWith =>+ _$CreateViewCopyWithImpl<CreateView>(this, _$identity);@override@optionalTypeArgsTResult when<TResult extends Object?>({required TResult Function() initial,- required TResult Function(Either<List<View>, WorkspaceError> appsOrFail)- viewsReceived,+ required TResult Function(String name, String desc, ViewType viewType)+ createView,}) {- return viewsReceived(appsOrFail);+ return createView(name, desc, viewType);}@override@optionalTypeArgsTResult maybeWhen<TResult extends Object?>({TResult Function()? initial,- TResult Function(Either<List<View>, WorkspaceError> appsOrFail)?- viewsReceived,+ TResult Function(String name, String desc, ViewType viewType)? createView,required TResult orElse(),}) {- if (viewsReceived != null) {- return viewsReceived(appsOrFail);+ if (createView != null) {+ return createView(name, desc, viewType);}return orElse();}@@ -251,34 +270,35 @@ class _$ViewsReceived implements ViewsReceived {@override@optionalTypeArgsTResult map<TResult extends Object?>({- required TResult Function(_Initial value) initial,- required TResult Function(ViewsReceived value) viewsReceived,+ required TResult Function(Initial value) initial,+ required TResult Function(CreateView value) createView,}) {- return viewsReceived(this);+ return createView(this);}@override@optionalTypeArgsTResult maybeMap<TResult extends Object?>({- TResult Function(_Initial value)? initial,- TResult Function(ViewsReceived value)? viewsReceived,+ TResult Function(Initial value)? initial,+ TResult Function(CreateView value)? createView,required TResult orElse(),}) {- if (viewsReceived != null) {- return viewsReceived(this);+ if (createView != null) {+ return createView(this);}return orElse();}}-abstract class ViewsReceived implements AppEvent {- const factory ViewsReceived(Either<List<View>, WorkspaceError> appsOrFail) =- _$ViewsReceived;+abstract class CreateView implements AppEvent {+ const factory CreateView(String name, String desc, ViewType viewType) =+ _$CreateView;- Either<List<View>, WorkspaceError> get appsOrFail =>- throw _privateConstructorUsedError;+ String get name => throw _privateConstructorUsedError;+ String get desc => throw _privateConstructorUsedError;+ ViewType get viewType => throw _privateConstructorUsedError;@JsonKey(ignore: true)- $ViewsReceivedCopyWith<ViewsReceived> get copyWith =>+ $CreateViewCopyWith<CreateView> get copyWith =>throw _privateConstructorUsedError;}diff --git a/app_flowy/lib/home/application/app/app_watch_bloc.dart b/app_flowy/lib/workspace/application/app/app_watch_bloc.dartsimilarity index 96%rename from app_flowy/lib/home/application/app/app_watch_bloc.dartrename to app_flowy/lib/workspace/application/app/app_watch_bloc.dartindex 345d8984e0..4cabff5a96 100644--- a/app_flowy/lib/home/application/app/app_watch_bloc.dart+++ b/app_flowy/lib/workspace/application/app/app_watch_bloc.dart@@ -1,4 +1,4 @@-import 'package:app_flowy/home/domain/i_app.dart';+import 'package:app_flowy/workspace/domain/i_app.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';import 'package:freezed_annotation/freezed_annotation.dart';diff --git a/app_flowy/lib/home/application/app/app_watch_bloc.freezed.dart b/app_flowy/lib/workspace/application/app/app_watch_bloc.freezed.dartsimilarity index 100%rename from app_flowy/lib/home/application/app/app_watch_bloc.freezed.dartrename to app_flowy/lib/workspace/application/app/app_watch_bloc.freezed.dartdiff --git a/app_flowy/lib/home/application/edit_pannel/edit_pannel_bloc.dart b/app_flowy/lib/workspace/application/edit_pannel/edit_pannel_bloc.dartsimilarity index 95%rename from app_flowy/lib/home/application/edit_pannel/edit_pannel_bloc.dartrename to app_flowy/lib/workspace/application/edit_pannel/edit_pannel_bloc.dartindex 1f45df8e22..ecaf26bc63 100644--- a/app_flowy/lib/home/application/edit_pannel/edit_pannel_bloc.dart+++ b/app_flowy/lib/workspace/application/edit_pannel/edit_pannel_bloc.dart@@ -1,4 +1,4 @@-import 'package:app_flowy/home/domain/edit_context.dart';+import 'package:app_flowy/workspace/domain/edit_context.dart';import 'package:dartz/dartz.dart';import 'package:flutter/material.dart';import 'package:freezed_annotation/freezed_annotation.dart';diff --git a/app_flowy/lib/home/application/edit_pannel/edit_pannel_bloc.freezed.dart b/app_flowy/lib/workspace/application/edit_pannel/edit_pannel_bloc.freezed.dartsimilarity index 100%rename from app_flowy/lib/home/application/edit_pannel/edit_pannel_bloc.freezed.dartrename to app_flowy/lib/workspace/application/edit_pannel/edit_pannel_bloc.freezed.dartdiff --git a/app_flowy/lib/home/application/home_bloc.dart b/app_flowy/lib/workspace/application/home_bloc.dartsimilarity index 96%rename from app_flowy/lib/home/application/home_bloc.dartrename to app_flowy/lib/workspace/application/home_bloc.dartindex d4a6c6ed92..df985d9261 100644--- a/app_flowy/lib/home/application/home_bloc.dart+++ b/app_flowy/lib/workspace/application/home_bloc.dart@@ -1,4 +1,4 @@-import 'package:app_flowy/home/domain/edit_context.dart';+import 'package:app_flowy/workspace/domain/edit_context.dart';import 'package:flutter_bloc/flutter_bloc.dart';import 'package:freezed_annotation/freezed_annotation.dart';import 'package:dartz/dartz.dart';diff --git a/app_flowy/lib/home/application/home_bloc.freezed.dart b/app_flowy/lib/workspace/application/home_bloc.freezed.dartsimilarity index 100%rename from app_flowy/lib/home/application/home_bloc.freezed.dartrename to app_flowy/lib/workspace/application/home_bloc.freezed.dartdiff --git a/app_flowy/lib/home/application/menu/menu_bloc.dart b/app_flowy/lib/workspace/application/menu/menu_bloc.dartsimilarity index 94%rename from app_flowy/lib/home/application/menu/menu_bloc.dartrename to app_flowy/lib/workspace/application/menu/menu_bloc.dartindex 0807db602f..b581723c57 100644--- a/app_flowy/lib/home/application/menu/menu_bloc.dart+++ b/app_flowy/lib/workspace/application/menu/menu_bloc.dart@@ -1,6 +1,6 @@import 'dart:async';-import 'package:app_flowy/home/domain/i_workspace.dart';-import 'package:app_flowy/home/domain/page_stack/page_stack.dart';+import 'package:app_flowy/workspace/domain/i_workspace.dart';+import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';import 'package:dartz/dartz.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/app_create.pb.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';diff --git a/app_flowy/lib/home/application/menu/menu_bloc.freezed.dart b/app_flowy/lib/workspace/application/menu/menu_bloc.freezed.dartsimilarity index 100%rename from app_flowy/lib/home/application/menu/menu_bloc.freezed.dartrename to app_flowy/lib/workspace/application/menu/menu_bloc.freezed.dartdiff --git a/app_flowy/lib/home/application/menu/menu_watch.dart b/app_flowy/lib/workspace/application/menu/menu_watch.dartsimilarity index 96%rename from app_flowy/lib/home/application/menu/menu_watch.dartrename to app_flowy/lib/workspace/application/menu/menu_watch.dartindex b2e0d12fb1..2e0f5f2f93 100644--- a/app_flowy/lib/home/application/menu/menu_watch.dart+++ b/app_flowy/lib/workspace/application/menu/menu_watch.dart@@ -1,4 +1,4 @@-import 'package:app_flowy/home/domain/i_workspace.dart';+import 'package:app_flowy/workspace/domain/i_workspace.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/app_create.pb.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';import 'package:flutter/material.dart';diff --git a/app_flowy/lib/home/application/menu/menu_watch.freezed.dart b/app_flowy/lib/workspace/application/menu/menu_watch.freezed.dartsimilarity index 100%rename from app_flowy/lib/home/application/menu/menu_watch.freezed.dartrename to app_flowy/lib/workspace/application/menu/menu_watch.freezed.dartdiff --git a/app_flowy/lib/home/application/view/view_bloc.dart b/app_flowy/lib/workspace/application/view/view_bloc.dartsimilarity index 100%rename from app_flowy/lib/home/application/view/view_bloc.dartrename to app_flowy/lib/workspace/application/view/view_bloc.dartdiff --git a/app_flowy/lib/home/application/watcher/home_watcher_bloc.dart b/app_flowy/lib/workspace/application/watcher/home_watcher_bloc.dartsimilarity index 100%rename from app_flowy/lib/home/application/watcher/home_watcher_bloc.dartrename to app_flowy/lib/workspace/application/watcher/home_watcher_bloc.dartdiff --git a/app_flowy/lib/home/application/watcher/home_watcher_bloc.freezed.dart b/app_flowy/lib/workspace/application/watcher/home_watcher_bloc.freezed.dartsimilarity index 100%rename from app_flowy/lib/home/application/watcher/home_watcher_bloc.freezed.dartrename to app_flowy/lib/workspace/application/watcher/home_watcher_bloc.freezed.dartdiff --git a/app_flowy/lib/home/application/watcher/home_watcher_event.dart b/app_flowy/lib/workspace/application/watcher/home_watcher_event.dartsimilarity index 100%rename from app_flowy/lib/home/application/watcher/home_watcher_event.dartrename to app_flowy/lib/workspace/application/watcher/home_watcher_event.dartdiff --git a/app_flowy/lib/home/application/watcher/home_watcher_state.dart b/app_flowy/lib/workspace/application/watcher/home_watcher_state.dartsimilarity index 100%rename from app_flowy/lib/home/application/watcher/home_watcher_state.dartrename to app_flowy/lib/workspace/application/watcher/home_watcher_state.dartdiff --git a/app_flowy/lib/home/domain/edit_context.dart b/app_flowy/lib/workspace/domain/edit_context.dartsimilarity index 100%rename from app_flowy/lib/home/domain/edit_context.dartrename to app_flowy/lib/workspace/domain/edit_context.dartdiff --git a/app_flowy/lib/home/domain/i_app.dart b/app_flowy/lib/workspace/domain/i_app.dartsimilarity index 72%rename from app_flowy/lib/home/domain/i_app.dartrename to app_flowy/lib/workspace/domain/i_app.dartindex 53a9d54eda..3114cd3f0b 100644--- a/app_flowy/lib/home/domain/i_app.dart+++ b/app_flowy/lib/workspace/domain/i_app.dart@@ -6,13 +6,10 @@ typedef AppAddViewCallback = void Function(Either<List<View>, WorkspaceError> viewsOrFailed);abstract class IApp {- Future<Either<List<View>, WorkspaceError>> getViews({required String appId});+ Future<Either<List<View>, WorkspaceError>> getViews();Future<Either<View, WorkspaceError>> createView(- {required String appId,- required String name,- String? desc,- required ViewType viewType});+ {required String name, String? desc, required ViewType viewType});}abstract class IAppWatch {diff --git a/app_flowy/lib/home/domain/i_page_stack.dart b/app_flowy/lib/workspace/domain/i_page_stack.dartsimilarity index 51%rename from app_flowy/lib/home/domain/i_page_stack.dartrename to app_flowy/lib/workspace/domain/i_page_stack.dartindex 58132635b5..9d425bc9a3 100644--- a/app_flowy/lib/home/domain/i_page_stack.dart+++ b/app_flowy/lib/workspace/domain/i_page_stack.dart@@ -1,4 +1,4 @@-import 'package:app_flowy/home/domain/page_stack/page_stack.dart';+import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';abstract class IPageStack {void setPageContext(PageContext context);diff --git a/app_flowy/lib/home/domain/i_view.dart b/app_flowy/lib/workspace/domain/i_view.dartsimilarity index 100%rename from app_flowy/lib/home/domain/i_view.dartrename to app_flowy/lib/workspace/domain/i_view.dartdiff --git a/app_flowy/lib/home/domain/i_workspace.dart b/app_flowy/lib/workspace/domain/i_workspace.dartsimilarity index 100%rename from app_flowy/lib/home/domain/i_workspace.dartrename to app_flowy/lib/workspace/domain/i_workspace.dartdiff --git a/app_flowy/lib/home/domain/page_stack/page_stack.dart b/app_flowy/lib/workspace/domain/page_stack/page_stack.dartsimilarity index 87%rename from app_flowy/lib/home/domain/page_stack/page_stack.dartrename to app_flowy/lib/workspace/domain/page_stack/page_stack.dartindex 819a6b14b5..4ffd56cef1 100644--- a/app_flowy/lib/home/domain/page_stack/page_stack.dart+++ b/app_flowy/lib/workspace/domain/page_stack/page_stack.dart@@ -1,9 +1,9 @@-import 'package:app_flowy/home/domain/page_stack/page_stack_bloc.dart';+import 'package:app_flowy/workspace/domain/page_stack/page_stack_bloc.dart';import 'package:equatable/equatable.dart';import 'package:flutter/material.dart';-import 'package:app_flowy/home/presentation/widgets/blank_page.dart';-import 'package:app_flowy/home/presentation/widgets/fading_index_stack.dart';-import 'package:app_flowy/home/presentation/widgets/prelude.dart';+import 'package:app_flowy/workspace/presentation/widgets/blank_page.dart';+import 'package:app_flowy/workspace/presentation/widgets/fading_index_stack.dart';+import 'package:app_flowy/workspace/presentation/widgets/prelude.dart';import 'package:flutter_bloc/flutter_bloc.dart';List<PageType> pages = PageType.values.toList();diff --git a/app_flowy/lib/home/domain/page_stack/page_stack_bloc.dart b/app_flowy/lib/workspace/domain/page_stack/page_stack_bloc.dartsimilarity index 86%rename from app_flowy/lib/home/domain/page_stack/page_stack_bloc.dartrename to app_flowy/lib/workspace/domain/page_stack/page_stack_bloc.dartindex 1a460b1bef..a10f8f744d 100644--- a/app_flowy/lib/home/domain/page_stack/page_stack_bloc.dart+++ b/app_flowy/lib/workspace/domain/page_stack/page_stack_bloc.dart@@ -1,5 +1,5 @@-import 'package:app_flowy/home/domain/page_stack/page_stack.dart';-import 'package:app_flowy/home/presentation/widgets/blank_page.dart';+import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';+import 'package:app_flowy/workspace/presentation/widgets/blank_page.dart';import 'package:freezed_annotation/freezed_annotation.dart';import 'package:flutter_bloc/flutter_bloc.dart';part 'page_stack_bloc.freezed.dart';diff --git a/app_flowy/lib/home/domain/page_stack/page_stack_bloc.freezed.dart b/app_flowy/lib/workspace/domain/page_stack/page_stack_bloc.freezed.dartsimilarity index 100%rename from app_flowy/lib/home/domain/page_stack/page_stack_bloc.freezed.dartrename to app_flowy/lib/workspace/domain/page_stack/page_stack_bloc.freezed.dartdiff --git a/app_flowy/lib/home/infrastructure/deps_resolver.dart b/app_flowy/lib/workspace/infrastructure/deps_resolver.dartsimilarity index 75%rename from app_flowy/lib/home/infrastructure/deps_resolver.dartrename to app_flowy/lib/workspace/infrastructure/deps_resolver.dartindex e2b147a47c..02b235ff65 100644--- a/app_flowy/lib/home/infrastructure/deps_resolver.dart+++ b/app_flowy/lib/workspace/infrastructure/deps_resolver.dart@@ -1,12 +1,12 @@-import 'package:app_flowy/home/application/app/app_bloc.dart';-import 'package:app_flowy/home/application/app/app_watch_bloc.dart';-import 'package:app_flowy/home/application/menu/menu_bloc.dart';-import 'package:app_flowy/home/application/menu/menu_watch.dart';-import 'package:app_flowy/home/domain/page_stack/page_stack.dart';-import 'package:app_flowy/home/infrastructure/i_app_impl.dart';-import 'package:app_flowy/home/infrastructure/i_workspace_impl.dart';-import 'package:app_flowy/home/infrastructure/repos/app_repo.dart';-import 'package:app_flowy/home/infrastructure/repos/workspace_repo.dart';+import 'package:app_flowy/workspace/application/app/app_bloc.dart';+import 'package:app_flowy/workspace/application/app/app_watch_bloc.dart';+import 'package:app_flowy/workspace/application/menu/menu_bloc.dart';+import 'package:app_flowy/workspace/application/menu/menu_watch.dart';+import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';+import 'package:app_flowy/workspace/infrastructure/i_app_impl.dart';+import 'package:app_flowy/workspace/infrastructure/i_workspace_impl.dart';+import 'package:app_flowy/workspace/infrastructure/repos/app_repo.dart';+import 'package:app_flowy/workspace/infrastructure/repos/workspace_repo.dart';import 'package:get_it/get_it.dart';class HomeDepsResolver {diff --git a/app_flowy/lib/home/infrastructure/i_app_impl.dart b/app_flowy/lib/workspace/infrastructure/i_app_impl.dartsimilarity index 62%rename from app_flowy/lib/home/infrastructure/i_app_impl.dartrename to app_flowy/lib/workspace/infrastructure/i_app_impl.dartindex 88a2ea8955..fe51bc8790 100644--- a/app_flowy/lib/home/infrastructure/i_app_impl.dart+++ b/app_flowy/lib/workspace/infrastructure/i_app_impl.dart@@ -1,10 +1,10 @@-import 'package:app_flowy/home/infrastructure/repos/app_repo.dart';+import 'package:app_flowy/workspace/infrastructure/repos/app_repo.dart';import 'package:dartz/dartz.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';-import 'package:app_flowy/home/domain/i_app.dart';+import 'package:app_flowy/workspace/domain/i_app.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';-export 'package:app_flowy/home/domain/i_app.dart';+export 'package:app_flowy/workspace/domain/i_app.dart';class IAppImpl extends IApp {AppRepository repo;@@ -13,17 +13,14 @@ class IAppImpl extends IApp {});@override- Future<Either<List<View>, WorkspaceError>> getViews({required String appId}) {- return repo.getViews(appId: appId);+ Future<Either<List<View>, WorkspaceError>> getViews() {+ return repo.getViews();}@overrideFuture<Either<View, WorkspaceError>> createView(- {required String appId,- required String name,- String? desc,- required ViewType viewType}) {- return repo.createView(appId, name, desc ?? "", viewType);+ {required String name, String? desc, required ViewType viewType}) {+ return repo.createView(name, desc ?? "", viewType);}}diff --git a/app_flowy/lib/home/infrastructure/i_workspace_impl.dart b/app_flowy/lib/workspace/infrastructure/i_workspace_impl.dartsimilarity index 85%rename from app_flowy/lib/home/infrastructure/i_workspace_impl.dartrename to app_flowy/lib/workspace/infrastructure/i_workspace_impl.dartindex ff2afabccc..748ae3538d 100644--- a/app_flowy/lib/home/infrastructure/i_workspace_impl.dart+++ b/app_flowy/lib/workspace/infrastructure/i_workspace_impl.dart@@ -1,10 +1,10 @@-import 'package:app_flowy/home/domain/i_workspace.dart';-import 'package:app_flowy/home/infrastructure/repos/workspace_repo.dart';+import 'package:app_flowy/workspace/domain/i_workspace.dart';+import 'package:app_flowy/workspace/infrastructure/repos/workspace_repo.dart';import 'package:dartz/dartz.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/app_create.pb.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';-export 'package:app_flowy/home/domain/i_workspace.dart';+export 'package:app_flowy/workspace/domain/i_workspace.dart';class IWorkspaceImpl extends IWorkspace {WorkspaceRepo repo;diff --git a/app_flowy/lib/home/infrastructure/repos/app_repo.dart b/app_flowy/lib/workspace/infrastructure/repos/app_repo.dartsimilarity index 92%rename from app_flowy/lib/home/infrastructure/repos/app_repo.dartrename to app_flowy/lib/workspace/infrastructure/repos/app_repo.dartindex 740f0751ec..5457c5e9ce 100644--- a/app_flowy/lib/home/infrastructure/repos/app_repo.dart+++ b/app_flowy/lib/workspace/infrastructure/repos/app_repo.dart@@ -1,5 +1,5 @@import 'dart:async';-import 'package:app_flowy/home/domain/i_app.dart';+import 'package:app_flowy/workspace/domain/i_app.dart';import 'package:dartz/dartz.dart';import 'package:flowy_infra/flowy_logger.dart';import 'package:flowy_sdk/dispatch/dispatch.dart';@@ -27,7 +27,7 @@ class AppRepository {}Future<Either<View, WorkspaceError>> createView(- String appId, String name, String desc, ViewType viewType) {+ String name, String desc, ViewType viewType) {final request = CreateViewRequest.create()..appId = appId..name = name@@ -37,7 +37,7 @@ class AppRepository {return WorkspaceEventCreateView(request).send();}- Future<Either<List<View>, WorkspaceError>> getViews({required String appId}) {+ Future<Either<List<View>, WorkspaceError>> getViews() {final request = QueryAppRequest.create()..appId = appId..readViews = true;@@ -86,7 +86,7 @@ class AppWatchRepository {if (_addViewCallback == null) {return;}- _repo.getViews(appId: appId).then((result) {+ _repo.getViews().then((result) {result.fold((views) => _addViewCallback!(left(views)),(error) => _addViewCallback!(right(error)),diff --git a/app_flowy/lib/home/infrastructure/repos/workspace_repo.dart b/app_flowy/lib/workspace/infrastructure/repos/workspace_repo.dartsimilarity index 98%rename from app_flowy/lib/home/infrastructure/repos/workspace_repo.dartrename to app_flowy/lib/workspace/infrastructure/repos/workspace_repo.dartindex ed61e622e4..6484108870 100644--- a/app_flowy/lib/home/infrastructure/repos/workspace_repo.dart+++ b/app_flowy/lib/workspace/infrastructure/repos/workspace_repo.dart@@ -1,6 +1,6 @@import 'dart:async';-import 'package:app_flowy/home/domain/i_workspace.dart';+import 'package:app_flowy/workspace/domain/i_workspace.dart';import 'package:dartz/dartz.dart';import 'package:flowy_infra/flowy_logger.dart';import 'package:flowy_sdk/dispatch/dispatch.dart';diff --git a/app_flowy/lib/home/presentation/widgets/app/app_widget.dart b/app_flowy/lib/workspace/presentation/app/app_widget.dartsimilarity index 72%rename from app_flowy/lib/home/presentation/widgets/app/app_widget.dartrename to app_flowy/lib/workspace/presentation/app/app_widget.dartindex ef63c602aa..a11ea61b85 100644--- a/app_flowy/lib/home/presentation/widgets/app/app_widget.dart+++ b/app_flowy/lib/workspace/presentation/app/app_widget.dart@@ -1,6 +1,7 @@-import 'package:app_flowy/home/application/app/app_bloc.dart';-import 'package:app_flowy/home/application/app/app_watch_bloc.dart';-import 'package:app_flowy/home/presentation/widgets/menu/menu_size.dart';+import 'package:app_flowy/workspace/application/app/app_bloc.dart';+import 'package:app_flowy/workspace/application/app/app_watch_bloc.dart';+import 'package:app_flowy/workspace/presentation/app/view_list.dart';+import 'package:app_flowy/workspace/presentation/widgets/menu/menu_size.dart';import 'package:app_flowy/startup/startup.dart';import 'package:expandable/expandable.dart';import 'package:flowy_infra/size.dart';@@ -9,6 +10,7 @@ import 'package:flowy_sdk/protobuf/flowy-workspace/app_create.pb.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';import 'package:flutter/material.dart';import 'package:flutter_bloc/flutter_bloc.dart';+import 'package:dartz/dartz.dart';class AppWidget extends StatelessWidget {final App app;@@ -18,32 +20,27 @@ class AppWidget extends StatelessWidget {Widget build(BuildContext context) {return MultiBlocProvider(providers: [- BlocProvider<AppBloc>(- create: (context) => getIt<AppBloc>(param1: app.id)),- BlocProvider<AppWatchBloc>(- create: (context) => getIt<AppWatchBloc>(param1: app.id)),+ BlocProvider<AppBloc>(create: (context) {+ final appBloc = getIt<AppBloc>(param1: app.id);+ appBloc.add(const AppEvent.initial());+ return appBloc;+ }),+ BlocProvider<AppWatchBloc>(create: (context) {+ final watchBloc = getIt<AppWatchBloc>(param1: app.id);+ watchBloc.add(const AppWatchEvent.started());+ return watchBloc;+ }),],child: BlocBuilder<AppWatchBloc, AppWatchState>(builder: (context, state) {final child = state.map(initial: (_) => BlocBuilder<AppBloc, AppState>(builder: (context, state) {- return Container();+ return ViewList(state.views);},),- loadViews: (s) {- return Container();- // final child = state.map(- // initial: (_) => const CircularProgressIndicator.adaptive(),- // loadViews: (s) => ViewList(s.views),- // successOrFailure: (s) => FlowyErrorPage(s.error),- // );-- // return expandableWrapper(context, Container());- },- loadFail: (s) {- return FlowyErrorPage(s.error.toString());- },+ loadViews: (s) => ViewList(some(s.views)),+ loadFail: (s) => FlowyErrorPage(s.error.toString()),);return expandableWrapper(context, child);@@ -74,7 +71,7 @@ class AppWidget extends StatelessWidget {padding: EdgeInsets.only(left: Sizes.iconMed),child: child,),- collapsed: const Text("close"),+ collapsed: const SizedBox(),),],),@@ -130,8 +127,7 @@ class AppHeader extends StatelessWidget {tooltip: 'create new view',icon: const Icon(Icons.add),padding: EdgeInsets.zero,- onSelected: (viewType) =>- handleCreateView(viewType as ViewType, context),+ onSelected: (viewType) => _createView(viewType as ViewType, context),itemBuilder: (context) => menuItemBuilder());}@@ -147,13 +143,7 @@ class AppHeader extends StatelessWidget {}).toList();}- void handleCreateView(ViewType viewType, BuildContext context) {- switch (viewType) {- case ViewType.Docs:- // context- // .read<AppEditBloc>()- // .add(AppEditEvent.createView(app.id, 'Grid View'));- break;- }+ void _createView(ViewType viewType, BuildContext context) {+ context.read<AppBloc>().add(AppEvent.createView("New view", "", viewType));}}diff --git a/app_flowy/lib/home/presentation/widgets/app/new_app.dart b/app_flowy/lib/workspace/presentation/app/new_app.dartsimilarity index 100%rename from app_flowy/lib/home/presentation/widgets/app/new_app.dartrename to app_flowy/lib/workspace/presentation/app/new_app.dartdiff --git a/app_flowy/lib/workspace/presentation/app/view_list.dart b/app_flowy/lib/workspace/presentation/app/view_list.dartnew file mode 100644index 0000000000..d4dde80159--- /dev/null+++ b/app_flowy/lib/workspace/presentation/app/view_list.dart@@ -0,0 +1,45 @@+import 'package:app_flowy/workspace/presentation/view/view_widget.dart';+import 'package:flowy_infra/flowy_logger.dart';+import 'package:flowy_infra/size.dart';+import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';+import 'package:flutter/foundation.dart';+import 'package:flutter/material.dart';+import 'package:dartz/dartz.dart';+import 'package:styled_widget/styled_widget.dart';++class ViewList extends StatelessWidget {+ final Option<List<View>> views;+ const ViewList(this.views, {Key? key}) : super(key: key);++ @override+ Widget build(BuildContext context) {+ Log.info('ViewList build');+ return views.fold(+ () => const SizedBox(+ height: 10,+ ),+ (views) {+ return Column(+ children: buildViewWidgets(views),+ ).padding(vertical: Insets.sm);+ },+ );+ }++ List<ViewWidget> buildViewWidgets(List<View> views) {+ var targetViews = views.map((view) {+ return ViewWidget(+ icon: const Icon(Icons.file_copy),+ view: view,+ );+ }).toList(growable: true);+ return targetViews;+ }++ @override+ void debugFillProperties(DiagnosticPropertiesBuilder properties) {+ super.debugFillProperties(properties);+ views.fold(() => {},+ (views) => properties.add(IterableProperty<View>('views', views)));+ }+}diff --git a/app_flowy/lib/home/presentation/home_layout.dart b/app_flowy/lib/workspace/presentation/home/home_layout.dartsimilarity index 94%rename from app_flowy/lib/home/presentation/home_layout.dartrename to app_flowy/lib/workspace/presentation/home/home_layout.dartindex 46cf1ea333..c16adb3b0d 100644--- a/app_flowy/lib/home/presentation/home_layout.dart+++ b/app_flowy/lib/workspace/presentation/home/home_layout.dart@@ -1,4 +1,4 @@-import 'package:app_flowy/home/application/home_bloc.dart';+import 'package:app_flowy/workspace/application/home_bloc.dart';import 'package:flowy_infra/size.dart';import 'package:flowy_infra/time/duration.dart';import 'package:flutter/material.dart';diff --git a/app_flowy/lib/home/presentation/home_screen.dart b/app_flowy/lib/workspace/presentation/home/home_screen.dartsimilarity index 95%rename from app_flowy/lib/home/presentation/home_screen.dartrename to app_flowy/lib/workspace/presentation/home/home_screen.dartindex 5da6c76778..a828c8d3e6 100644--- a/app_flowy/lib/home/presentation/home_screen.dart+++ b/app_flowy/lib/workspace/presentation/home/home_screen.dart@@ -1,7 +1,7 @@-import 'package:app_flowy/home/application/home_bloc.dart';-import 'package:app_flowy/home/application/watcher/home_watcher_bloc.dart';-import 'package:app_flowy/home/domain/page_stack/page_stack.dart';-import 'package:app_flowy/home/presentation/widgets/prelude.dart';+import 'package:app_flowy/workspace/application/home_bloc.dart';+import 'package:app_flowy/workspace/application/watcher/home_watcher_bloc.dart';+import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';+import 'package:app_flowy/workspace/presentation/widgets/prelude.dart';import 'package:app_flowy/startup/startup.dart';import 'package:flowy_infra/flowy_logger.dart';import 'package:flowy_infra_ui/style_widget/styled_container.dart';diff --git a/app_flowy/lib/home/presentation/home_sizes.dart b/app_flowy/lib/workspace/presentation/home/home_sizes.dartsimilarity index 100%rename from app_flowy/lib/home/presentation/home_sizes.dartrename to app_flowy/lib/workspace/presentation/home/home_sizes.dartdiff --git a/app_flowy/lib/workspace/presentation/view/view_widget.dart b/app_flowy/lib/workspace/presentation/view/view_widget.dartnew file mode 100644index 0000000000..16d6d65a93--- /dev/null+++ b/app_flowy/lib/workspace/presentation/view/view_widget.dart@@ -0,0 +1,46 @@+import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';+import 'package:flutter/material.dart';++class ViewWidget extends StatelessWidget {+ final View view;+ final Widget icon;+ const ViewWidget({Key? key, required this.view, required this.icon})+ : super(key: key);++ @override+ Widget build(BuildContext context) {+ return InkWell(+ onTap: _handleTapOnView(context),+ child: Container(+ height: 30,+ child: buildContent(),+ ));+ }++ Row buildContent() {+ return Row(+ children: [+ icon,+ const SizedBox(+ width: 4,+ ),+ Text(+ view.name,+ textAlign: TextAlign.start,+ style: const TextStyle(fontSize: 15),+ )+ ],+ );+ }++ Function() _handleTapOnView(BuildContext context) {+ return () {+ // if (view.id.startsWith('doc')) {+ // context.read<MenuBloc>().add(MenuEvent.openPage(DocPageContext(view)));+ // return;+ // }++ // context.read<MenuBloc>().add(MenuEvent.openPage(GridPageContext(view)));+ };+ }+}diff --git a/app_flowy/lib/home/presentation/widgets/blank_page.dart b/app_flowy/lib/workspace/presentation/widgets/blank_page.dartsimilarity index 91%rename from app_flowy/lib/home/presentation/widgets/blank_page.dartrename to app_flowy/lib/workspace/presentation/widgets/blank_page.dartindex 1277cb3ace..a3e8d520b0 100644--- a/app_flowy/lib/home/presentation/widgets/blank_page.dart+++ b/app_flowy/lib/workspace/presentation/widgets/blank_page.dart@@ -1,4 +1,4 @@-import 'package:app_flowy/home/domain/page_stack/page_stack.dart';+import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';import 'package:flutter/material.dart';class BlankPageContext extends PageContext {diff --git a/app_flowy/lib/home/presentation/widgets/edit_pannel/edit_pannel.dart b/app_flowy/lib/workspace/presentation/widgets/edit_pannel/edit_pannel.dartsimilarity index 89%rename from app_flowy/lib/home/presentation/widgets/edit_pannel/edit_pannel.dartrename to app_flowy/lib/workspace/presentation/widgets/edit_pannel/edit_pannel.dartindex 0d561151fc..3b7b40ee7b 100644--- a/app_flowy/lib/home/presentation/widgets/edit_pannel/edit_pannel.dart+++ b/app_flowy/lib/workspace/presentation/widgets/edit_pannel/edit_pannel.dart@@ -1,12 +1,12 @@-import 'package:app_flowy/home/application/edit_pannel/edit_pannel_bloc.dart';-import 'package:app_flowy/home/domain/edit_context.dart';+import 'package:app_flowy/workspace/application/edit_pannel/edit_pannel_bloc.dart';+import 'package:app_flowy/workspace/domain/edit_context.dart';import 'package:app_flowy/startup/startup.dart';+import 'package:app_flowy/workspace/presentation/home/home_sizes.dart';import 'package:dartz/dartz.dart';import 'package:flowy_infra_ui/style_widget/styled_bar_title.dart';import 'package:flowy_infra_ui/style_widget/styled_close_button.dart';import 'package:flutter/material.dart';import 'package:flutter_bloc/flutter_bloc.dart';-import '../../home_sizes.dart';class EditPannel extends StatelessWidget {late final EditPannelContext editContext;diff --git a/app_flowy/lib/home/presentation/widgets/edit_pannel/pannel_animation.dart b/app_flowy/lib/workspace/presentation/widgets/edit_pannel/pannel_animation.dartsimilarity index 100%rename from app_flowy/lib/home/presentation/widgets/edit_pannel/pannel_animation.dartrename to app_flowy/lib/workspace/presentation/widgets/edit_pannel/pannel_animation.dartdiff --git a/app_flowy/lib/home/presentation/widgets/fading_index_stack.dart b/app_flowy/lib/workspace/presentation/widgets/fading_index_stack.dartsimilarity index 100%rename from app_flowy/lib/home/presentation/widgets/fading_index_stack.dartrename to app_flowy/lib/workspace/presentation/widgets/fading_index_stack.dartdiff --git a/app_flowy/lib/home/presentation/widgets/home_stack_page.dart b/app_flowy/lib/workspace/presentation/widgets/home_stack_page.dartsimilarity index 74%rename from app_flowy/lib/home/presentation/widgets/home_stack_page.dartrename to app_flowy/lib/workspace/presentation/widgets/home_stack_page.dartindex 90481974a8..84ad664b57 100644--- a/app_flowy/lib/home/presentation/widgets/home_stack_page.dart+++ b/app_flowy/lib/workspace/presentation/widgets/home_stack_page.dart@@ -1,4 +1,4 @@-import 'package:app_flowy/home/domain/page_stack/page_stack.dart';+import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';import 'package:flutter/material.dart';abstract class HomeStackPage extends StatefulWidget {diff --git a/app_flowy/lib/home/presentation/widgets/home_top_bar.dart b/app_flowy/lib/workspace/presentation/widgets/home_top_bar.dartsimilarity index 94%rename from app_flowy/lib/home/presentation/widgets/home_top_bar.dartrename to app_flowy/lib/workspace/presentation/widgets/home_top_bar.dartindex 58ee107035..6c9d91a4e5 100644--- a/app_flowy/lib/home/presentation/widgets/home_top_bar.dart+++ b/app_flowy/lib/workspace/presentation/widgets/home_top_bar.dart@@ -1,5 +1,5 @@+import 'package:app_flowy/workspace/presentation/home/home_sizes.dart';import 'package:flutter/material.dart';-import '../home_sizes.dart';class HomeTopBar extends StatelessWidget {final String title;diff --git a/app_flowy/lib/home/presentation/widgets/menu/app_list.dart b/app_flowy/lib/workspace/presentation/widgets/menu/app_list.dartsimilarity index 92%rename from app_flowy/lib/home/presentation/widgets/menu/app_list.dartrename to app_flowy/lib/workspace/presentation/widgets/menu/app_list.dartindex 412d5d5952..4f302b4886 100644--- a/app_flowy/lib/home/presentation/widgets/menu/app_list.dart+++ b/app_flowy/lib/workspace/presentation/widgets/menu/app_list.dart@@ -1,6 +1,6 @@+import 'package:app_flowy/workspace/presentation/app/app_widget.dart';import 'package:expandable/expandable.dart';import 'package:flowy_sdk/protobuf/flowy-workspace/app_create.pb.dart';-import 'package:app_flowy/home/presentation/widgets/app/app_widget.dart';import 'package:flutter/material.dart';import 'package:dartz/dartz.dart';diff --git a/app_flowy/lib/home/presentation/widgets/menu/menu.dart b/app_flowy/lib/workspace/presentation/widgets/menu/menu.dartsimilarity index 95%rename from app_flowy/lib/home/presentation/widgets/menu/menu.dartrename to app_flowy/lib/workspace/presentation/widgets/menu/menu.dartindex 56d9048961..166b2413ba 100644--- a/app_flowy/lib/home/presentation/widgets/menu/menu.dart+++ b/app_flowy/lib/workspace/presentation/widgets/menu/menu.dart@@ -1,9 +1,9 @@-import 'package:app_flowy/home/application/menu/menu_bloc.dart';-import 'package:app_flowy/home/application/menu/menu_watch.dart';-import 'package:app_flowy/home/domain/page_stack/page_stack.dart';-import 'package:app_flowy/home/presentation/home_sizes.dart';+import 'package:app_flowy/workspace/application/menu/menu_bloc.dart';+import 'package:app_flowy/workspace/application/menu/menu_watch.dart';+import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';import 'package:app_flowy/startup/startup.dart';import 'package:app_flowy/startup/tasks/application_task.dart';+import 'package:app_flowy/workspace/presentation/home/home_sizes.dart';import 'package:dartz/dartz.dart';import 'package:flowy_infra/size.dart';import 'package:flowy_infra/text_style.dart';diff --git a/app_flowy/lib/home/presentation/widgets/menu/menu_size.dart b/app_flowy/lib/workspace/presentation/widgets/menu/menu_size.dartsimilarity index 100%rename from app_flowy/lib/home/presentation/widgets/menu/menu_size.dartrename to app_flowy/lib/workspace/presentation/widgets/menu/menu_size.dartdiff --git a/app_flowy/lib/home/presentation/widgets/menu/prelude.dart b/app_flowy/lib/workspace/presentation/widgets/menu/prelude.dartsimilarity index 100%rename from app_flowy/lib/home/presentation/widgets/menu/prelude.dartrename to app_flowy/lib/workspace/presentation/widgets/menu/prelude.dartdiff --git a/app_flowy/lib/home/presentation/widgets/prelude.dart b/app_flowy/lib/workspace/presentation/widgets/prelude.dartsimilarity index 100%rename from app_flowy/lib/home/presentation/widgets/prelude.dartrename to app_flowy/lib/workspace/presentation/widgets/prelude.dart