diff --git a/app_flowy/lib/home/presentation/widgets/app/view_list.dart b/app_flowy/lib/home/presentation/widgets/app/view_list.dart deleted file mode 100644 index 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 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 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 _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 _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('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().add(MenuEvent.openPage(DocPageContext(view))); - // return; - // } - - // context.read().add(MenuEvent.openPage(GridPageContext(view))); - }; - } -} diff --git a/app_flowy/lib/startup/deps_inject/prelude.dart b/app_flowy/lib/startup/deps_inject/prelude.dart index 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.dart index 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.dart index 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.dart index 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.dart similarity index 59% rename from app_flowy/lib/home/application/app/app_bloc.dart rename to app_flowy/lib/workspace/application/app/app_bloc.dart index 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 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 _fetchViews() async* { + final viewsOrFailed = await iAppImpl.getViews(); + yield viewsOrFailed.fold( + (apps) => state.copyWith(views: some(apps)), + (error) => state.copyWith(successOrFailure: right(error)), ); } } @freezed abstract class AppEvent with _$AppEvent { - const factory AppEvent.initial() = _Initial; - const factory AppEvent.viewsReceived( - Either, WorkspaceError> appsOrFail) = ViewsReceived; + const factory AppEvent.initial() = Initial; + const factory AppEvent.createView( + String name, String desc, ViewType viewType) = CreateView; } @freezed diff --git a/app_flowy/lib/home/application/app/app_bloc.freezed.dart b/app_flowy/lib/workspace/application/app/app_bloc.freezed.dart similarity index 67% rename from app_flowy/lib/home/application/app/app_bloc.freezed.dart rename to app_flowy/lib/workspace/application/app/app_bloc.freezed.dart index 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, WorkspaceError> appsOrFail) { - return ViewsReceived( - appsOrFail, + CreateView createView(String name, String desc, ViewType viewType) { + return CreateView( + name, + desc, + viewType, ); } } @@ -35,28 +37,27 @@ mixin _$AppEvent { @optionalTypeArgs TResult when({ required TResult Function() initial, - required TResult Function(Either, WorkspaceError> appsOrFail) - viewsReceived, + required TResult Function(String name, String desc, ViewType viewType) + createView, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen({ TResult Function()? initial, - TResult Function(Either, WorkspaceError> appsOrFail)? - viewsReceived, + TResult Function(String name, String desc, ViewType viewType)? createView, required TResult orElse(), }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult map({ - 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; @optionalTypeArgs TResult maybeMap({ - 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(); @override String toString() { @@ -105,7 +106,7 @@ class _$_Initial implements _Initial { @override bool 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 { @optionalTypeArgs TResult when({ required TResult Function() initial, - required TResult Function(Either, WorkspaceError> appsOrFail) - viewsReceived, + required TResult Function(String name, String desc, ViewType viewType) + createView, }) { return initial(); } @@ -125,8 +126,7 @@ class _$_Initial implements _Initial { @optionalTypeArgs TResult maybeWhen({ TResult Function()? initial, - TResult Function(Either, 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 @optionalTypeArgs TResult map({ - 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 @optionalTypeArgs TResult maybeMap({ - 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, 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, 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, WorkspaceError> appsOrFail; + final String name; + @override + final String desc; + @override + final ViewType viewType; @override String toString() { - return 'AppEvent.viewsReceived(appsOrFail: $appsOrFail)'; + return 'AppEvent.createView(name: $name, desc: $desc, viewType: $viewType)'; } @override bool 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))); } @override int 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 get copyWith => - _$ViewsReceivedCopyWithImpl(this, _$identity); + $CreateViewCopyWith get copyWith => + _$CreateViewCopyWithImpl(this, _$identity); @override @optionalTypeArgs TResult when({ required TResult Function() initial, - required TResult Function(Either, WorkspaceError> appsOrFail) - viewsReceived, + required TResult Function(String name, String desc, ViewType viewType) + createView, }) { - return viewsReceived(appsOrFail); + return createView(name, desc, viewType); } @override @optionalTypeArgs TResult maybeWhen({ TResult Function()? initial, - TResult Function(Either, 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 @optionalTypeArgs TResult map({ - 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 @optionalTypeArgs TResult maybeMap({ - 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, WorkspaceError> appsOrFail) = - _$ViewsReceived; +abstract class CreateView implements AppEvent { + const factory CreateView(String name, String desc, ViewType viewType) = + _$CreateView; - Either, WorkspaceError> get appsOrFail => - throw _privateConstructorUsedError; + String get name => throw _privateConstructorUsedError; + String get desc => throw _privateConstructorUsedError; + ViewType get viewType => throw _privateConstructorUsedError; @JsonKey(ignore: true) - $ViewsReceivedCopyWith get copyWith => + $CreateViewCopyWith 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.dart similarity index 96% rename from app_flowy/lib/home/application/app/app_watch_bloc.dart rename to app_flowy/lib/workspace/application/app/app_watch_bloc.dart index 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.dart similarity index 100% rename from app_flowy/lib/home/application/app/app_watch_bloc.freezed.dart rename to app_flowy/lib/workspace/application/app/app_watch_bloc.freezed.dart diff --git a/app_flowy/lib/home/application/edit_pannel/edit_pannel_bloc.dart b/app_flowy/lib/workspace/application/edit_pannel/edit_pannel_bloc.dart similarity index 95% rename from app_flowy/lib/home/application/edit_pannel/edit_pannel_bloc.dart rename to app_flowy/lib/workspace/application/edit_pannel/edit_pannel_bloc.dart index 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.dart similarity index 100% rename from app_flowy/lib/home/application/edit_pannel/edit_pannel_bloc.freezed.dart rename to app_flowy/lib/workspace/application/edit_pannel/edit_pannel_bloc.freezed.dart diff --git a/app_flowy/lib/home/application/home_bloc.dart b/app_flowy/lib/workspace/application/home_bloc.dart similarity index 96% rename from app_flowy/lib/home/application/home_bloc.dart rename to app_flowy/lib/workspace/application/home_bloc.dart index 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.dart similarity index 100% rename from app_flowy/lib/home/application/home_bloc.freezed.dart rename to app_flowy/lib/workspace/application/home_bloc.freezed.dart diff --git a/app_flowy/lib/home/application/menu/menu_bloc.dart b/app_flowy/lib/workspace/application/menu/menu_bloc.dart similarity index 94% rename from app_flowy/lib/home/application/menu/menu_bloc.dart rename to app_flowy/lib/workspace/application/menu/menu_bloc.dart index 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.dart similarity index 100% rename from app_flowy/lib/home/application/menu/menu_bloc.freezed.dart rename to app_flowy/lib/workspace/application/menu/menu_bloc.freezed.dart diff --git a/app_flowy/lib/home/application/menu/menu_watch.dart b/app_flowy/lib/workspace/application/menu/menu_watch.dart similarity index 96% rename from app_flowy/lib/home/application/menu/menu_watch.dart rename to app_flowy/lib/workspace/application/menu/menu_watch.dart index 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.dart similarity index 100% rename from app_flowy/lib/home/application/menu/menu_watch.freezed.dart rename to app_flowy/lib/workspace/application/menu/menu_watch.freezed.dart diff --git a/app_flowy/lib/home/application/view/view_bloc.dart b/app_flowy/lib/workspace/application/view/view_bloc.dart similarity index 100% rename from app_flowy/lib/home/application/view/view_bloc.dart rename to app_flowy/lib/workspace/application/view/view_bloc.dart diff --git a/app_flowy/lib/home/application/watcher/home_watcher_bloc.dart b/app_flowy/lib/workspace/application/watcher/home_watcher_bloc.dart similarity index 100% rename from app_flowy/lib/home/application/watcher/home_watcher_bloc.dart rename to app_flowy/lib/workspace/application/watcher/home_watcher_bloc.dart diff --git a/app_flowy/lib/home/application/watcher/home_watcher_bloc.freezed.dart b/app_flowy/lib/workspace/application/watcher/home_watcher_bloc.freezed.dart similarity index 100% rename from app_flowy/lib/home/application/watcher/home_watcher_bloc.freezed.dart rename to app_flowy/lib/workspace/application/watcher/home_watcher_bloc.freezed.dart diff --git a/app_flowy/lib/home/application/watcher/home_watcher_event.dart b/app_flowy/lib/workspace/application/watcher/home_watcher_event.dart similarity index 100% rename from app_flowy/lib/home/application/watcher/home_watcher_event.dart rename to app_flowy/lib/workspace/application/watcher/home_watcher_event.dart diff --git a/app_flowy/lib/home/application/watcher/home_watcher_state.dart b/app_flowy/lib/workspace/application/watcher/home_watcher_state.dart similarity index 100% rename from app_flowy/lib/home/application/watcher/home_watcher_state.dart rename to app_flowy/lib/workspace/application/watcher/home_watcher_state.dart diff --git a/app_flowy/lib/home/domain/edit_context.dart b/app_flowy/lib/workspace/domain/edit_context.dart similarity index 100% rename from app_flowy/lib/home/domain/edit_context.dart rename to app_flowy/lib/workspace/domain/edit_context.dart diff --git a/app_flowy/lib/home/domain/i_app.dart b/app_flowy/lib/workspace/domain/i_app.dart similarity index 72% rename from app_flowy/lib/home/domain/i_app.dart rename to app_flowy/lib/workspace/domain/i_app.dart index 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, WorkspaceError> viewsOrFailed); abstract class IApp { - Future, WorkspaceError>> getViews({required String appId}); + Future, WorkspaceError>> getViews(); Future> 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.dart similarity index 51% rename from app_flowy/lib/home/domain/i_page_stack.dart rename to app_flowy/lib/workspace/domain/i_page_stack.dart index 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.dart similarity index 100% rename from app_flowy/lib/home/domain/i_view.dart rename to app_flowy/lib/workspace/domain/i_view.dart diff --git a/app_flowy/lib/home/domain/i_workspace.dart b/app_flowy/lib/workspace/domain/i_workspace.dart similarity index 100% rename from app_flowy/lib/home/domain/i_workspace.dart rename to app_flowy/lib/workspace/domain/i_workspace.dart diff --git a/app_flowy/lib/home/domain/page_stack/page_stack.dart b/app_flowy/lib/workspace/domain/page_stack/page_stack.dart similarity index 87% rename from app_flowy/lib/home/domain/page_stack/page_stack.dart rename to app_flowy/lib/workspace/domain/page_stack/page_stack.dart index 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 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.dart similarity index 86% rename from app_flowy/lib/home/domain/page_stack/page_stack_bloc.dart rename to app_flowy/lib/workspace/domain/page_stack/page_stack_bloc.dart index 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.dart similarity index 100% rename from app_flowy/lib/home/domain/page_stack/page_stack_bloc.freezed.dart rename to app_flowy/lib/workspace/domain/page_stack/page_stack_bloc.freezed.dart diff --git a/app_flowy/lib/home/infrastructure/deps_resolver.dart b/app_flowy/lib/workspace/infrastructure/deps_resolver.dart similarity index 75% rename from app_flowy/lib/home/infrastructure/deps_resolver.dart rename to app_flowy/lib/workspace/infrastructure/deps_resolver.dart index 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.dart similarity index 62% rename from app_flowy/lib/home/infrastructure/i_app_impl.dart rename to app_flowy/lib/workspace/infrastructure/i_app_impl.dart index 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, WorkspaceError>> getViews({required String appId}) { - return repo.getViews(appId: appId); + Future, WorkspaceError>> getViews() { + return repo.getViews(); } @override Future> 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.dart similarity index 85% rename from app_flowy/lib/home/infrastructure/i_workspace_impl.dart rename to app_flowy/lib/workspace/infrastructure/i_workspace_impl.dart index 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.dart similarity index 92% rename from app_flowy/lib/home/infrastructure/repos/app_repo.dart rename to app_flowy/lib/workspace/infrastructure/repos/app_repo.dart index 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> 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, WorkspaceError>> getViews({required String appId}) { + Future, 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.dart similarity index 98% rename from app_flowy/lib/home/infrastructure/repos/workspace_repo.dart rename to app_flowy/lib/workspace/infrastructure/repos/workspace_repo.dart index 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.dart similarity index 72% rename from app_flowy/lib/home/presentation/widgets/app/app_widget.dart rename to app_flowy/lib/workspace/presentation/app/app_widget.dart index 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( - create: (context) => getIt(param1: app.id)), - BlocProvider( - create: (context) => getIt(param1: app.id)), + BlocProvider(create: (context) { + final appBloc = getIt(param1: app.id); + appBloc.add(const AppEvent.initial()); + return appBloc; + }), + BlocProvider(create: (context) { + final watchBloc = getIt(param1: app.id); + watchBloc.add(const AppWatchEvent.started()); + return watchBloc; + }), ], child: BlocBuilder( builder: (context, state) { final child = state.map( initial: (_) => BlocBuilder( 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() - // .add(AppEditEvent.createView(app.id, 'Grid View')); - break; - } + void _createView(ViewType viewType, BuildContext context) { + context.read().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.dart similarity index 100% rename from app_flowy/lib/home/presentation/widgets/app/new_app.dart rename to app_flowy/lib/workspace/presentation/app/new_app.dart diff --git a/app_flowy/lib/workspace/presentation/app/view_list.dart b/app_flowy/lib/workspace/presentation/app/view_list.dart new file mode 100644 index 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> 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 buildViewWidgets(List 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('views', views))); + } +} diff --git a/app_flowy/lib/home/presentation/home_layout.dart b/app_flowy/lib/workspace/presentation/home/home_layout.dart similarity index 94% rename from app_flowy/lib/home/presentation/home_layout.dart rename to app_flowy/lib/workspace/presentation/home/home_layout.dart index 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.dart similarity index 95% rename from app_flowy/lib/home/presentation/home_screen.dart rename to app_flowy/lib/workspace/presentation/home/home_screen.dart index 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.dart similarity index 100% rename from app_flowy/lib/home/presentation/home_sizes.dart rename to app_flowy/lib/workspace/presentation/home/home_sizes.dart diff --git a/app_flowy/lib/workspace/presentation/view/view_widget.dart b/app_flowy/lib/workspace/presentation/view/view_widget.dart new file mode 100644 index 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().add(MenuEvent.openPage(DocPageContext(view))); + // return; + // } + + // context.read().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.dart similarity index 91% rename from app_flowy/lib/home/presentation/widgets/blank_page.dart rename to app_flowy/lib/workspace/presentation/widgets/blank_page.dart index 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.dart similarity index 89% rename from app_flowy/lib/home/presentation/widgets/edit_pannel/edit_pannel.dart rename to app_flowy/lib/workspace/presentation/widgets/edit_pannel/edit_pannel.dart index 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.dart similarity index 100% rename from app_flowy/lib/home/presentation/widgets/edit_pannel/pannel_animation.dart rename to app_flowy/lib/workspace/presentation/widgets/edit_pannel/pannel_animation.dart diff --git a/app_flowy/lib/home/presentation/widgets/fading_index_stack.dart b/app_flowy/lib/workspace/presentation/widgets/fading_index_stack.dart similarity index 100% rename from app_flowy/lib/home/presentation/widgets/fading_index_stack.dart rename to app_flowy/lib/workspace/presentation/widgets/fading_index_stack.dart diff --git a/app_flowy/lib/home/presentation/widgets/home_stack_page.dart b/app_flowy/lib/workspace/presentation/widgets/home_stack_page.dart similarity index 74% rename from app_flowy/lib/home/presentation/widgets/home_stack_page.dart rename to app_flowy/lib/workspace/presentation/widgets/home_stack_page.dart index 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.dart similarity index 94% rename from app_flowy/lib/home/presentation/widgets/home_top_bar.dart rename to app_flowy/lib/workspace/presentation/widgets/home_top_bar.dart index 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.dart similarity index 92% rename from app_flowy/lib/home/presentation/widgets/menu/app_list.dart rename to app_flowy/lib/workspace/presentation/widgets/menu/app_list.dart index 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.dart similarity index 95% rename from app_flowy/lib/home/presentation/widgets/menu/menu.dart rename to app_flowy/lib/workspace/presentation/widgets/menu/menu.dart index 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.dart similarity index 100% rename from app_flowy/lib/home/presentation/widgets/menu/menu_size.dart rename to app_flowy/lib/workspace/presentation/widgets/menu/menu_size.dart diff --git a/app_flowy/lib/home/presentation/widgets/menu/prelude.dart b/app_flowy/lib/workspace/presentation/widgets/menu/prelude.dart similarity index 100% rename from app_flowy/lib/home/presentation/widgets/menu/prelude.dart rename to app_flowy/lib/workspace/presentation/widgets/menu/prelude.dart diff --git a/app_flowy/lib/home/presentation/widgets/prelude.dart b/app_flowy/lib/workspace/presentation/widgets/prelude.dart similarity index 100% rename from app_flowy/lib/home/presentation/widgets/prelude.dart rename to app_flowy/lib/workspace/presentation/widgets/prelude.dart