mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
rename folder
This commit is contained in:
parent
0bd768415e
commit
78af679626
@ -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)));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -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/launch.dart';
|
||||||
import 'package:app_flowy/startup/startup.dart';
|
import 'package:app_flowy/startup/startup.dart';
|
||||||
import 'package:app_flowy/user/infrastructure/deps_resolver.dart';
|
import 'package:app_flowy/user/infrastructure/deps_resolver.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/startup/startup.dart';
|
||||||
import 'package:app_flowy/user/application/sign_in/sign_in_bloc.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/user/presentation/sign_in/widgets/background.dart';
|
||||||
|
import 'package:app_flowy/workspace/presentation/home/home_screen.dart';
|
||||||
import 'package:dartz/dartz.dart';
|
import 'package:dartz/dartz.dart';
|
||||||
import 'package:flowy_infra_ui/widget/rounded_button.dart';
|
import 'package:flowy_infra_ui/widget/rounded_button.dart';
|
||||||
import 'package:flowy_infra_ui/widget/rounded_input_field.dart';
|
import 'package:flowy_infra_ui/widget/rounded_input_field.dart';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:app_flowy/home/application/edit_pannel/edit_pannel_bloc.dart';
|
import 'package:app_flowy/workspace/application/edit_pannel/edit_pannel_bloc.dart';
|
||||||
import 'package:app_flowy/home/application/home_bloc.dart';
|
import 'package:app_flowy/workspace/application/home_bloc.dart';
|
||||||
import 'package:app_flowy/home/application/watcher/home_watcher_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/application/welcome_bloc.dart';
|
||||||
import 'package:app_flowy/welcome/infrastructure/i_welcome_impl.dart';
|
import 'package:app_flowy/welcome/infrastructure/i_welcome_impl.dart';
|
||||||
import 'package:get_it/get_it.dart';
|
import 'package:get_it/get_it.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/user/presentation/sign_in/sign_in_screen.dart';
|
||||||
import 'package:app_flowy/welcome/domain/auth_state.dart';
|
import 'package:app_flowy/welcome/domain/auth_state.dart';
|
||||||
import 'package:app_flowy/welcome/domain/i_welcome.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/dispatch/dispatch.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart';
|
import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.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/errors.pb.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
@ -16,19 +16,30 @@ class AppBloc extends Bloc<AppEvent, AppState> {
|
|||||||
AppEvent event,
|
AppEvent event,
|
||||||
) async* {
|
) async* {
|
||||||
yield* event.map(
|
yield* event.map(
|
||||||
initial: (e) async* {},
|
initial: (e) async* {
|
||||||
viewsReceived: (e) async* {
|
yield* _fetchViews();
|
||||||
yield state;
|
|
||||||
},
|
},
|
||||||
|
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)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
abstract class AppEvent with _$AppEvent {
|
abstract class AppEvent with _$AppEvent {
|
||||||
const factory AppEvent.initial() = _Initial;
|
const factory AppEvent.initial() = Initial;
|
||||||
const factory AppEvent.viewsReceived(
|
const factory AppEvent.createView(
|
||||||
Either<List<View>, WorkspaceError> appsOrFail) = ViewsReceived;
|
String name, String desc, ViewType viewType) = CreateView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@freezed
|
@freezed
|
@ -16,13 +16,15 @@ final _privateConstructorUsedError = UnsupportedError(
|
|||||||
class _$AppEventTearOff {
|
class _$AppEventTearOff {
|
||||||
const _$AppEventTearOff();
|
const _$AppEventTearOff();
|
||||||
|
|
||||||
_Initial initial() {
|
Initial initial() {
|
||||||
return const _Initial();
|
return const Initial();
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewsReceived viewsReceived(Either<List<View>, WorkspaceError> appsOrFail) {
|
CreateView createView(String name, String desc, ViewType viewType) {
|
||||||
return ViewsReceived(
|
return CreateView(
|
||||||
appsOrFail,
|
name,
|
||||||
|
desc,
|
||||||
|
viewType,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -35,28 +37,27 @@ mixin _$AppEvent {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function(Either<List<View>, WorkspaceError> appsOrFail)
|
required TResult Function(String name, String desc, ViewType viewType)
|
||||||
viewsReceived,
|
createView,
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function(Either<List<View>, WorkspaceError> appsOrFail)?
|
TResult Function(String name, String desc, ViewType viewType)? createView,
|
||||||
viewsReceived,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult map<TResult extends Object?>({
|
TResult map<TResult extends Object?>({
|
||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(Initial value) initial,
|
||||||
required TResult Function(ViewsReceived value) viewsReceived,
|
required TResult Function(CreateView value) createView,
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeMap<TResult extends Object?>({
|
TResult maybeMap<TResult extends Object?>({
|
||||||
TResult Function(_Initial value)? initial,
|
TResult Function(Initial value)? initial,
|
||||||
TResult Function(ViewsReceived value)? viewsReceived,
|
TResult Function(CreateView value)? createView,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@ -78,25 +79,25 @@ class _$AppEventCopyWithImpl<$Res> implements $AppEventCopyWith<$Res> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
abstract class _$InitialCopyWith<$Res> {
|
abstract class $InitialCopyWith<$Res> {
|
||||||
factory _$InitialCopyWith(_Initial value, $Res Function(_Initial) then) =
|
factory $InitialCopyWith(Initial value, $Res Function(Initial) then) =
|
||||||
__$InitialCopyWithImpl<$Res>;
|
_$InitialCopyWithImpl<$Res>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
class __$InitialCopyWithImpl<$Res> extends _$AppEventCopyWithImpl<$Res>
|
class _$InitialCopyWithImpl<$Res> extends _$AppEventCopyWithImpl<$Res>
|
||||||
implements _$InitialCopyWith<$Res> {
|
implements $InitialCopyWith<$Res> {
|
||||||
__$InitialCopyWithImpl(_Initial _value, $Res Function(_Initial) _then)
|
_$InitialCopyWithImpl(Initial _value, $Res Function(Initial) _then)
|
||||||
: super(_value, (v) => _then(v as _Initial));
|
: super(_value, (v) => _then(v as Initial));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_Initial get _value => super._value as _Initial;
|
Initial get _value => super._value as Initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
|
|
||||||
class _$_Initial implements _Initial {
|
class _$Initial implements Initial {
|
||||||
const _$_Initial();
|
const _$Initial();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
@ -105,7 +106,7 @@ class _$_Initial implements _Initial {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(dynamic other) {
|
bool operator ==(dynamic other) {
|
||||||
return identical(this, other) || (other is _Initial);
|
return identical(this, other) || (other is Initial);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -115,8 +116,8 @@ class _$_Initial implements _Initial {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function(Either<List<View>, WorkspaceError> appsOrFail)
|
required TResult Function(String name, String desc, ViewType viewType)
|
||||||
viewsReceived,
|
createView,
|
||||||
}) {
|
}) {
|
||||||
return initial();
|
return initial();
|
||||||
}
|
}
|
||||||
@ -125,8 +126,7 @@ class _$_Initial implements _Initial {
|
|||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function(Either<List<View>, WorkspaceError> appsOrFail)?
|
TResult Function(String name, String desc, ViewType viewType)? createView,
|
||||||
viewsReceived,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (initial != null) {
|
if (initial != null) {
|
||||||
@ -138,8 +138,8 @@ class _$_Initial implements _Initial {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult map<TResult extends Object?>({
|
TResult map<TResult extends Object?>({
|
||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(Initial value) initial,
|
||||||
required TResult Function(ViewsReceived value) viewsReceived,
|
required TResult Function(CreateView value) createView,
|
||||||
}) {
|
}) {
|
||||||
return initial(this);
|
return initial(this);
|
||||||
}
|
}
|
||||||
@ -147,8 +147,8 @@ class _$_Initial implements _Initial {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeMap<TResult extends Object?>({
|
TResult maybeMap<TResult extends Object?>({
|
||||||
TResult Function(_Initial value)? initial,
|
TResult Function(Initial value)? initial,
|
||||||
TResult Function(ViewsReceived value)? viewsReceived,
|
TResult Function(CreateView value)? createView,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (initial != null) {
|
if (initial != null) {
|
||||||
@ -158,92 +158,111 @@ class _$_Initial implements _Initial {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class _Initial implements AppEvent {
|
abstract class Initial implements AppEvent {
|
||||||
const factory _Initial() = _$_Initial;
|
const factory Initial() = _$Initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
abstract class $ViewsReceivedCopyWith<$Res> {
|
abstract class $CreateViewCopyWith<$Res> {
|
||||||
factory $ViewsReceivedCopyWith(
|
factory $CreateViewCopyWith(
|
||||||
ViewsReceived value, $Res Function(ViewsReceived) then) =
|
CreateView value, $Res Function(CreateView) then) =
|
||||||
_$ViewsReceivedCopyWithImpl<$Res>;
|
_$CreateViewCopyWithImpl<$Res>;
|
||||||
$Res call({Either<List<View>, WorkspaceError> appsOrFail});
|
$Res call({String name, String desc, ViewType viewType});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
class _$ViewsReceivedCopyWithImpl<$Res> extends _$AppEventCopyWithImpl<$Res>
|
class _$CreateViewCopyWithImpl<$Res> extends _$AppEventCopyWithImpl<$Res>
|
||||||
implements $ViewsReceivedCopyWith<$Res> {
|
implements $CreateViewCopyWith<$Res> {
|
||||||
_$ViewsReceivedCopyWithImpl(
|
_$CreateViewCopyWithImpl(CreateView _value, $Res Function(CreateView) _then)
|
||||||
ViewsReceived _value, $Res Function(ViewsReceived) _then)
|
: super(_value, (v) => _then(v as CreateView));
|
||||||
: super(_value, (v) => _then(v as ViewsReceived));
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ViewsReceived get _value => super._value as ViewsReceived;
|
CreateView get _value => super._value as CreateView;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? appsOrFail = freezed,
|
Object? name = freezed,
|
||||||
|
Object? desc = freezed,
|
||||||
|
Object? viewType = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(ViewsReceived(
|
return _then(CreateView(
|
||||||
appsOrFail == freezed
|
name == freezed
|
||||||
? _value.appsOrFail
|
? _value.name
|
||||||
: appsOrFail // ignore: cast_nullable_to_non_nullable
|
: name // ignore: cast_nullable_to_non_nullable
|
||||||
as Either<List<View>, WorkspaceError>,
|
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
|
/// @nodoc
|
||||||
|
|
||||||
class _$ViewsReceived implements ViewsReceived {
|
class _$CreateView implements CreateView {
|
||||||
const _$ViewsReceived(this.appsOrFail);
|
const _$CreateView(this.name, this.desc, this.viewType);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Either<List<View>, WorkspaceError> appsOrFail;
|
final String name;
|
||||||
|
@override
|
||||||
|
final String desc;
|
||||||
|
@override
|
||||||
|
final ViewType viewType;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'AppEvent.viewsReceived(appsOrFail: $appsOrFail)';
|
return 'AppEvent.createView(name: $name, desc: $desc, viewType: $viewType)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(dynamic other) {
|
bool operator ==(dynamic other) {
|
||||||
return identical(this, other) ||
|
return identical(this, other) ||
|
||||||
(other is ViewsReceived &&
|
(other is CreateView &&
|
||||||
(identical(other.appsOrFail, appsOrFail) ||
|
(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()
|
const DeepCollectionEquality()
|
||||||
.equals(other.appsOrFail, appsOrFail)));
|
.equals(other.viewType, viewType)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
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)
|
@JsonKey(ignore: true)
|
||||||
@override
|
@override
|
||||||
$ViewsReceivedCopyWith<ViewsReceived> get copyWith =>
|
$CreateViewCopyWith<CreateView> get copyWith =>
|
||||||
_$ViewsReceivedCopyWithImpl<ViewsReceived>(this, _$identity);
|
_$CreateViewCopyWithImpl<CreateView>(this, _$identity);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function(Either<List<View>, WorkspaceError> appsOrFail)
|
required TResult Function(String name, String desc, ViewType viewType)
|
||||||
viewsReceived,
|
createView,
|
||||||
}) {
|
}) {
|
||||||
return viewsReceived(appsOrFail);
|
return createView(name, desc, viewType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function(Either<List<View>, WorkspaceError> appsOrFail)?
|
TResult Function(String name, String desc, ViewType viewType)? createView,
|
||||||
viewsReceived,
|
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (viewsReceived != null) {
|
if (createView != null) {
|
||||||
return viewsReceived(appsOrFail);
|
return createView(name, desc, viewType);
|
||||||
}
|
}
|
||||||
return orElse();
|
return orElse();
|
||||||
}
|
}
|
||||||
@ -251,34 +270,35 @@ class _$ViewsReceived implements ViewsReceived {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult map<TResult extends Object?>({
|
TResult map<TResult extends Object?>({
|
||||||
required TResult Function(_Initial value) initial,
|
required TResult Function(Initial value) initial,
|
||||||
required TResult Function(ViewsReceived value) viewsReceived,
|
required TResult Function(CreateView value) createView,
|
||||||
}) {
|
}) {
|
||||||
return viewsReceived(this);
|
return createView(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeMap<TResult extends Object?>({
|
TResult maybeMap<TResult extends Object?>({
|
||||||
TResult Function(_Initial value)? initial,
|
TResult Function(Initial value)? initial,
|
||||||
TResult Function(ViewsReceived value)? viewsReceived,
|
TResult Function(CreateView value)? createView,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (viewsReceived != null) {
|
if (createView != null) {
|
||||||
return viewsReceived(this);
|
return createView(this);
|
||||||
}
|
}
|
||||||
return orElse();
|
return orElse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class ViewsReceived implements AppEvent {
|
abstract class CreateView implements AppEvent {
|
||||||
const factory ViewsReceived(Either<List<View>, WorkspaceError> appsOrFail) =
|
const factory CreateView(String name, String desc, ViewType viewType) =
|
||||||
_$ViewsReceived;
|
_$CreateView;
|
||||||
|
|
||||||
Either<List<View>, WorkspaceError> get appsOrFail =>
|
String get name => throw _privateConstructorUsedError;
|
||||||
throw _privateConstructorUsedError;
|
String get desc => throw _privateConstructorUsedError;
|
||||||
|
ViewType get viewType => throw _privateConstructorUsedError;
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
$ViewsReceivedCopyWith<ViewsReceived> get copyWith =>
|
$CreateViewCopyWith<CreateView> get copyWith =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
|
|
@ -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/errors.pb.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.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:dartz/dartz.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.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:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:dartz/dartz.dart';
|
import 'package:dartz/dartz.dart';
|
@ -1,6 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:app_flowy/home/domain/i_workspace.dart';
|
import 'package:app_flowy/workspace/domain/i_workspace.dart';
|
||||||
import 'package:app_flowy/home/domain/page_stack/page_stack.dart';
|
import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';
|
||||||
import 'package:dartz/dartz.dart';
|
import 'package:dartz/dartz.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-workspace/app_create.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-workspace/app_create.pb.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.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/app_create.pb.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
@ -6,13 +6,10 @@ typedef AppAddViewCallback = void Function(
|
|||||||
Either<List<View>, WorkspaceError> viewsOrFailed);
|
Either<List<View>, WorkspaceError> viewsOrFailed);
|
||||||
|
|
||||||
abstract class IApp {
|
abstract class IApp {
|
||||||
Future<Either<List<View>, WorkspaceError>> getViews({required String appId});
|
Future<Either<List<View>, WorkspaceError>> getViews();
|
||||||
|
|
||||||
Future<Either<View, WorkspaceError>> createView(
|
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 {
|
abstract class IAppWatch {
|
@ -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 {
|
abstract class IPageStack {
|
||||||
void setPageContext(PageContext context);
|
void setPageContext(PageContext context);
|
@ -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:equatable/equatable.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:app_flowy/home/presentation/widgets/blank_page.dart';
|
import 'package:app_flowy/workspace/presentation/widgets/blank_page.dart';
|
||||||
import 'package:app_flowy/home/presentation/widgets/fading_index_stack.dart';
|
import 'package:app_flowy/workspace/presentation/widgets/fading_index_stack.dart';
|
||||||
import 'package:app_flowy/home/presentation/widgets/prelude.dart';
|
import 'package:app_flowy/workspace/presentation/widgets/prelude.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
List<PageType> pages = PageType.values.toList();
|
List<PageType> pages = PageType.values.toList();
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:app_flowy/home/domain/page_stack/page_stack.dart';
|
import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';
|
||||||
import 'package:app_flowy/home/presentation/widgets/blank_page.dart';
|
import 'package:app_flowy/workspace/presentation/widgets/blank_page.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
part 'page_stack_bloc.freezed.dart';
|
part 'page_stack_bloc.freezed.dart';
|
@ -1,12 +1,12 @@
|
|||||||
import 'package:app_flowy/home/application/app/app_bloc.dart';
|
import 'package:app_flowy/workspace/application/app/app_bloc.dart';
|
||||||
import 'package:app_flowy/home/application/app/app_watch_bloc.dart';
|
import 'package:app_flowy/workspace/application/app/app_watch_bloc.dart';
|
||||||
import 'package:app_flowy/home/application/menu/menu_bloc.dart';
|
import 'package:app_flowy/workspace/application/menu/menu_bloc.dart';
|
||||||
import 'package:app_flowy/home/application/menu/menu_watch.dart';
|
import 'package:app_flowy/workspace/application/menu/menu_watch.dart';
|
||||||
import 'package:app_flowy/home/domain/page_stack/page_stack.dart';
|
import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';
|
||||||
import 'package:app_flowy/home/infrastructure/i_app_impl.dart';
|
import 'package:app_flowy/workspace/infrastructure/i_app_impl.dart';
|
||||||
import 'package:app_flowy/home/infrastructure/i_workspace_impl.dart';
|
import 'package:app_flowy/workspace/infrastructure/i_workspace_impl.dart';
|
||||||
import 'package:app_flowy/home/infrastructure/repos/app_repo.dart';
|
import 'package:app_flowy/workspace/infrastructure/repos/app_repo.dart';
|
||||||
import 'package:app_flowy/home/infrastructure/repos/workspace_repo.dart';
|
import 'package:app_flowy/workspace/infrastructure/repos/workspace_repo.dart';
|
||||||
import 'package:get_it/get_it.dart';
|
import 'package:get_it/get_it.dart';
|
||||||
|
|
||||||
class HomeDepsResolver {
|
class HomeDepsResolver {
|
@ -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:dartz/dartz.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.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';
|
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 {
|
class IAppImpl extends IApp {
|
||||||
AppRepository repo;
|
AppRepository repo;
|
||||||
@ -13,17 +13,14 @@ class IAppImpl extends IApp {
|
|||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Either<List<View>, WorkspaceError>> getViews({required String appId}) {
|
Future<Either<List<View>, WorkspaceError>> getViews() {
|
||||||
return repo.getViews(appId: appId);
|
return repo.getViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Either<View, WorkspaceError>> createView(
|
Future<Either<View, WorkspaceError>> createView(
|
||||||
{required String appId,
|
{required String name, String? desc, required ViewType viewType}) {
|
||||||
required String name,
|
return repo.createView(name, desc ?? "", viewType);
|
||||||
String? desc,
|
|
||||||
required ViewType viewType}) {
|
|
||||||
return repo.createView(appId, name, desc ?? "", viewType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,10 +1,10 @@
|
|||||||
import 'package:app_flowy/home/domain/i_workspace.dart';
|
import 'package:app_flowy/workspace/domain/i_workspace.dart';
|
||||||
import 'package:app_flowy/home/infrastructure/repos/workspace_repo.dart';
|
import 'package:app_flowy/workspace/infrastructure/repos/workspace_repo.dart';
|
||||||
import 'package:dartz/dartz.dart';
|
import 'package:dartz/dartz.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-workspace/app_create.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-workspace/app_create.pb.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.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 {
|
class IWorkspaceImpl extends IWorkspace {
|
||||||
WorkspaceRepo repo;
|
WorkspaceRepo repo;
|
@ -1,5 +1,5 @@
|
|||||||
import 'dart:async';
|
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:dartz/dartz.dart';
|
||||||
import 'package:flowy_infra/flowy_logger.dart';
|
import 'package:flowy_infra/flowy_logger.dart';
|
||||||
import 'package:flowy_sdk/dispatch/dispatch.dart';
|
import 'package:flowy_sdk/dispatch/dispatch.dart';
|
||||||
@ -27,7 +27,7 @@ class AppRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Either<View, WorkspaceError>> createView(
|
Future<Either<View, WorkspaceError>> createView(
|
||||||
String appId, String name, String desc, ViewType viewType) {
|
String name, String desc, ViewType viewType) {
|
||||||
final request = CreateViewRequest.create()
|
final request = CreateViewRequest.create()
|
||||||
..appId = appId
|
..appId = appId
|
||||||
..name = name
|
..name = name
|
||||||
@ -37,7 +37,7 @@ class AppRepository {
|
|||||||
return WorkspaceEventCreateView(request).send();
|
return WorkspaceEventCreateView(request).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Either<List<View>, WorkspaceError>> getViews({required String appId}) {
|
Future<Either<List<View>, WorkspaceError>> getViews() {
|
||||||
final request = QueryAppRequest.create()
|
final request = QueryAppRequest.create()
|
||||||
..appId = appId
|
..appId = appId
|
||||||
..readViews = true;
|
..readViews = true;
|
||||||
@ -86,7 +86,7 @@ class AppWatchRepository {
|
|||||||
if (_addViewCallback == null) {
|
if (_addViewCallback == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_repo.getViews(appId: appId).then((result) {
|
_repo.getViews().then((result) {
|
||||||
result.fold(
|
result.fold(
|
||||||
(views) => _addViewCallback!(left(views)),
|
(views) => _addViewCallback!(left(views)),
|
||||||
(error) => _addViewCallback!(right(error)),
|
(error) => _addViewCallback!(right(error)),
|
@ -1,6 +1,6 @@
|
|||||||
import 'dart:async';
|
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:dartz/dartz.dart';
|
||||||
import 'package:flowy_infra/flowy_logger.dart';
|
import 'package:flowy_infra/flowy_logger.dart';
|
||||||
import 'package:flowy_sdk/dispatch/dispatch.dart';
|
import 'package:flowy_sdk/dispatch/dispatch.dart';
|
@ -1,6 +1,7 @@
|
|||||||
import 'package:app_flowy/home/application/app/app_bloc.dart';
|
import 'package:app_flowy/workspace/application/app/app_bloc.dart';
|
||||||
import 'package:app_flowy/home/application/app/app_watch_bloc.dart';
|
import 'package:app_flowy/workspace/application/app/app_watch_bloc.dart';
|
||||||
import 'package:app_flowy/home/presentation/widgets/menu/menu_size.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:app_flowy/startup/startup.dart';
|
||||||
import 'package:expandable/expandable.dart';
|
import 'package:expandable/expandable.dart';
|
||||||
import 'package:flowy_infra/size.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:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
|
||||||
class AppWidget extends StatelessWidget {
|
class AppWidget extends StatelessWidget {
|
||||||
final App app;
|
final App app;
|
||||||
@ -18,32 +20,27 @@ class AppWidget extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MultiBlocProvider(
|
return MultiBlocProvider(
|
||||||
providers: [
|
providers: [
|
||||||
BlocProvider<AppBloc>(
|
BlocProvider<AppBloc>(create: (context) {
|
||||||
create: (context) => getIt<AppBloc>(param1: app.id)),
|
final appBloc = getIt<AppBloc>(param1: app.id);
|
||||||
BlocProvider<AppWatchBloc>(
|
appBloc.add(const AppEvent.initial());
|
||||||
create: (context) => getIt<AppWatchBloc>(param1: app.id)),
|
return appBloc;
|
||||||
|
}),
|
||||||
|
BlocProvider<AppWatchBloc>(create: (context) {
|
||||||
|
final watchBloc = getIt<AppWatchBloc>(param1: app.id);
|
||||||
|
watchBloc.add(const AppWatchEvent.started());
|
||||||
|
return watchBloc;
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
child: BlocBuilder<AppWatchBloc, AppWatchState>(
|
child: BlocBuilder<AppWatchBloc, AppWatchState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final child = state.map(
|
final child = state.map(
|
||||||
initial: (_) => BlocBuilder<AppBloc, AppState>(
|
initial: (_) => BlocBuilder<AppBloc, AppState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return Container();
|
return ViewList(state.views);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
loadViews: (s) {
|
loadViews: (s) => ViewList(some(s.views)),
|
||||||
return Container();
|
loadFail: (s) => FlowyErrorPage(s.error.toString()),
|
||||||
// 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());
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return expandableWrapper(context, child);
|
return expandableWrapper(context, child);
|
||||||
@ -74,7 +71,7 @@ class AppWidget extends StatelessWidget {
|
|||||||
padding: EdgeInsets.only(left: Sizes.iconMed),
|
padding: EdgeInsets.only(left: Sizes.iconMed),
|
||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
collapsed: const Text("close"),
|
collapsed: const SizedBox(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -130,8 +127,7 @@ class AppHeader extends StatelessWidget {
|
|||||||
tooltip: 'create new view',
|
tooltip: 'create new view',
|
||||||
icon: const Icon(Icons.add),
|
icon: const Icon(Icons.add),
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
onSelected: (viewType) =>
|
onSelected: (viewType) => _createView(viewType as ViewType, context),
|
||||||
handleCreateView(viewType as ViewType, context),
|
|
||||||
itemBuilder: (context) => menuItemBuilder());
|
itemBuilder: (context) => menuItemBuilder());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,13 +143,7 @@ class AppHeader extends StatelessWidget {
|
|||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleCreateView(ViewType viewType, BuildContext context) {
|
void _createView(ViewType viewType, BuildContext context) {
|
||||||
switch (viewType) {
|
context.read<AppBloc>().add(AppEvent.createView("New view", "", viewType));
|
||||||
case ViewType.Docs:
|
|
||||||
// context
|
|
||||||
// .read<AppEditBloc>()
|
|
||||||
// .add(AppEditEvent.createView(app.id, 'Grid View'));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
45
app_flowy/lib/workspace/presentation/app/view_list.dart
Normal file
45
app_flowy/lib/workspace/presentation/app/view_list.dart
Normal file
@ -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)));
|
||||||
|
}
|
||||||
|
}
|
@ -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/size.dart';
|
||||||
import 'package:flowy_infra/time/duration.dart';
|
import 'package:flowy_infra/time/duration.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:app_flowy/home/application/home_bloc.dart';
|
import 'package:app_flowy/workspace/application/home_bloc.dart';
|
||||||
import 'package:app_flowy/home/application/watcher/home_watcher_bloc.dart';
|
import 'package:app_flowy/workspace/application/watcher/home_watcher_bloc.dart';
|
||||||
import 'package:app_flowy/home/domain/page_stack/page_stack.dart';
|
import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';
|
||||||
import 'package:app_flowy/home/presentation/widgets/prelude.dart';
|
import 'package:app_flowy/workspace/presentation/widgets/prelude.dart';
|
||||||
import 'package:app_flowy/startup/startup.dart';
|
import 'package:app_flowy/startup/startup.dart';
|
||||||
import 'package:flowy_infra/flowy_logger.dart';
|
import 'package:flowy_infra/flowy_logger.dart';
|
||||||
import 'package:flowy_infra_ui/style_widget/styled_container.dart';
|
import 'package:flowy_infra_ui/style_widget/styled_container.dart';
|
46
app_flowy/lib/workspace/presentation/view/view_widget.dart
Normal file
46
app_flowy/lib/workspace/presentation/view/view_widget.dart
Normal file
@ -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)));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -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';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class BlankPageContext extends PageContext {
|
class BlankPageContext extends PageContext {
|
@ -1,12 +1,12 @@
|
|||||||
import 'package:app_flowy/home/application/edit_pannel/edit_pannel_bloc.dart';
|
import 'package:app_flowy/workspace/application/edit_pannel/edit_pannel_bloc.dart';
|
||||||
import 'package:app_flowy/home/domain/edit_context.dart';
|
import 'package:app_flowy/workspace/domain/edit_context.dart';
|
||||||
import 'package:app_flowy/startup/startup.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:dartz/dartz.dart';
|
||||||
import 'package:flowy_infra_ui/style_widget/styled_bar_title.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:flowy_infra_ui/style_widget/styled_close_button.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import '../../home_sizes.dart';
|
|
||||||
|
|
||||||
class EditPannel extends StatelessWidget {
|
class EditPannel extends StatelessWidget {
|
||||||
late final EditPannelContext editContext;
|
late final EditPannelContext editContext;
|
@ -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';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
abstract class HomeStackPage extends StatefulWidget {
|
abstract class HomeStackPage extends StatefulWidget {
|
@ -1,5 +1,5 @@
|
|||||||
|
import 'package:app_flowy/workspace/presentation/home/home_sizes.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../home_sizes.dart';
|
|
||||||
|
|
||||||
class HomeTopBar extends StatelessWidget {
|
class HomeTopBar extends StatelessWidget {
|
||||||
final String title;
|
final String title;
|
@ -1,6 +1,6 @@
|
|||||||
|
import 'package:app_flowy/workspace/presentation/app/app_widget.dart';
|
||||||
import 'package:expandable/expandable.dart';
|
import 'package:expandable/expandable.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-workspace/app_create.pb.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:flutter/material.dart';
|
||||||
import 'package:dartz/dartz.dart';
|
import 'package:dartz/dartz.dart';
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
import 'package:app_flowy/home/application/menu/menu_bloc.dart';
|
import 'package:app_flowy/workspace/application/menu/menu_bloc.dart';
|
||||||
import 'package:app_flowy/home/application/menu/menu_watch.dart';
|
import 'package:app_flowy/workspace/application/menu/menu_watch.dart';
|
||||||
import 'package:app_flowy/home/domain/page_stack/page_stack.dart';
|
import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';
|
||||||
import 'package:app_flowy/home/presentation/home_sizes.dart';
|
|
||||||
import 'package:app_flowy/startup/startup.dart';
|
import 'package:app_flowy/startup/startup.dart';
|
||||||
import 'package:app_flowy/startup/tasks/application_task.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:dartz/dartz.dart';
|
||||||
import 'package:flowy_infra/size.dart';
|
import 'package:flowy_infra/size.dart';
|
||||||
import 'package:flowy_infra/text_style.dart';
|
import 'package:flowy_infra/text_style.dart';
|
Loading…
Reference in New Issue
Block a user