mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
open doc view
This commit is contained in:
parent
959545c4b1
commit
a6033e3359
@ -36,7 +36,7 @@ class MenuBloc extends Bloc<MenuEvent, MenuState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Stream<MenuState> _performActionOnOpenPage(OpenPage e) async* {
|
Stream<MenuState> _performActionOnOpenPage(OpenPage e) async* {
|
||||||
yield state.copyWith(pageContext: e.context);
|
yield state.copyWith(stackView: e.stackView);
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<MenuState> _performActionOnCreateApp(CreateApp event) async* {
|
Stream<MenuState> _performActionOnCreateApp(CreateApp event) async* {
|
||||||
@ -65,7 +65,7 @@ class MenuBloc extends Bloc<MenuEvent, MenuState> {
|
|||||||
abstract class MenuEvent with _$MenuEvent {
|
abstract class MenuEvent with _$MenuEvent {
|
||||||
const factory MenuEvent.initial() = _Initial;
|
const factory MenuEvent.initial() = _Initial;
|
||||||
const factory MenuEvent.collapse() = Collapse;
|
const factory MenuEvent.collapse() = Collapse;
|
||||||
const factory MenuEvent.openPage(HomeStackContext context) = OpenPage;
|
const factory MenuEvent.openPage(HomeStackView stackView) = OpenPage;
|
||||||
const factory MenuEvent.createApp(String name, {String? desc}) = CreateApp;
|
const factory MenuEvent.createApp(String name, {String? desc}) = CreateApp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ abstract class MenuState implements _$MenuState {
|
|||||||
required bool isCollapse,
|
required bool isCollapse,
|
||||||
required Option<List<App>> apps,
|
required Option<List<App>> apps,
|
||||||
required Either<Unit, WorkspaceError> successOrFailure,
|
required Either<Unit, WorkspaceError> successOrFailure,
|
||||||
HomeStackContext? pageContext,
|
HomeStackView? stackView,
|
||||||
}) = _MenuState;
|
}) = _MenuState;
|
||||||
|
|
||||||
factory MenuState.initial() => MenuState(
|
factory MenuState.initial() => MenuState(
|
||||||
|
@ -24,9 +24,9 @@ class _$MenuEventTearOff {
|
|||||||
return const Collapse();
|
return const Collapse();
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenPage openPage(HomeStackContext context) {
|
OpenPage openPage(HomeStackView stackView) {
|
||||||
return OpenPage(
|
return OpenPage(
|
||||||
context,
|
stackView,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ mixin _$MenuEvent {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() collapse,
|
required TResult Function() collapse,
|
||||||
required TResult Function(HomeStackContext context) openPage,
|
required TResult Function(HomeStackView stackView) openPage,
|
||||||
required TResult Function(String name, String? desc) createApp,
|
required TResult Function(String name, String? desc) createApp,
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@ -55,7 +55,7 @@ mixin _$MenuEvent {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? collapse,
|
TResult Function()? collapse,
|
||||||
TResult Function(HomeStackContext context)? openPage,
|
TResult Function(HomeStackView stackView)? openPage,
|
||||||
TResult Function(String name, String? desc)? createApp,
|
TResult Function(String name, String? desc)? createApp,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
@ -133,7 +133,7 @@ class _$_Initial implements _Initial {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() collapse,
|
required TResult Function() collapse,
|
||||||
required TResult Function(HomeStackContext context) openPage,
|
required TResult Function(HomeStackView stackView) openPage,
|
||||||
required TResult Function(String name, String? desc) createApp,
|
required TResult Function(String name, String? desc) createApp,
|
||||||
}) {
|
}) {
|
||||||
return initial();
|
return initial();
|
||||||
@ -144,7 +144,7 @@ class _$_Initial implements _Initial {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? collapse,
|
TResult Function()? collapse,
|
||||||
TResult Function(HomeStackContext context)? openPage,
|
TResult Function(HomeStackView stackView)? openPage,
|
||||||
TResult Function(String name, String? desc)? createApp,
|
TResult Function(String name, String? desc)? createApp,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
@ -224,7 +224,7 @@ class _$Collapse implements Collapse {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() collapse,
|
required TResult Function() collapse,
|
||||||
required TResult Function(HomeStackContext context) openPage,
|
required TResult Function(HomeStackView stackView) openPage,
|
||||||
required TResult Function(String name, String? desc) createApp,
|
required TResult Function(String name, String? desc) createApp,
|
||||||
}) {
|
}) {
|
||||||
return collapse();
|
return collapse();
|
||||||
@ -235,7 +235,7 @@ class _$Collapse implements Collapse {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? collapse,
|
TResult Function()? collapse,
|
||||||
TResult Function(HomeStackContext context)? openPage,
|
TResult Function(HomeStackView stackView)? openPage,
|
||||||
TResult Function(String name, String? desc)? createApp,
|
TResult Function(String name, String? desc)? createApp,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
@ -280,7 +280,7 @@ abstract class Collapse implements MenuEvent {
|
|||||||
abstract class $OpenPageCopyWith<$Res> {
|
abstract class $OpenPageCopyWith<$Res> {
|
||||||
factory $OpenPageCopyWith(OpenPage value, $Res Function(OpenPage) then) =
|
factory $OpenPageCopyWith(OpenPage value, $Res Function(OpenPage) then) =
|
||||||
_$OpenPageCopyWithImpl<$Res>;
|
_$OpenPageCopyWithImpl<$Res>;
|
||||||
$Res call({HomeStackContext context});
|
$Res call({HomeStackView stackView});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@ -294,13 +294,13 @@ class _$OpenPageCopyWithImpl<$Res> extends _$MenuEventCopyWithImpl<$Res>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? context = freezed,
|
Object? stackView = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(OpenPage(
|
return _then(OpenPage(
|
||||||
context == freezed
|
stackView == freezed
|
||||||
? _value.context
|
? _value.stackView
|
||||||
: context // ignore: cast_nullable_to_non_nullable
|
: stackView // ignore: cast_nullable_to_non_nullable
|
||||||
as HomeStackContext,
|
as HomeStackView,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -308,27 +308,28 @@ class _$OpenPageCopyWithImpl<$Res> extends _$MenuEventCopyWithImpl<$Res>
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
|
|
||||||
class _$OpenPage implements OpenPage {
|
class _$OpenPage implements OpenPage {
|
||||||
const _$OpenPage(this.context);
|
const _$OpenPage(this.stackView);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final HomeStackContext context;
|
final HomeStackView stackView;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'MenuEvent.openPage(context: $context)';
|
return 'MenuEvent.openPage(stackView: $stackView)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(dynamic other) {
|
bool operator ==(dynamic other) {
|
||||||
return identical(this, other) ||
|
return identical(this, other) ||
|
||||||
(other is OpenPage &&
|
(other is OpenPage &&
|
||||||
(identical(other.context, context) ||
|
(identical(other.stackView, stackView) ||
|
||||||
const DeepCollectionEquality().equals(other.context, context)));
|
const DeepCollectionEquality()
|
||||||
|
.equals(other.stackView, stackView)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
runtimeType.hashCode ^ const DeepCollectionEquality().hash(context);
|
runtimeType.hashCode ^ const DeepCollectionEquality().hash(stackView);
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@override
|
@override
|
||||||
@ -340,10 +341,10 @@ class _$OpenPage implements OpenPage {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() collapse,
|
required TResult Function() collapse,
|
||||||
required TResult Function(HomeStackContext context) openPage,
|
required TResult Function(HomeStackView stackView) openPage,
|
||||||
required TResult Function(String name, String? desc) createApp,
|
required TResult Function(String name, String? desc) createApp,
|
||||||
}) {
|
}) {
|
||||||
return openPage(context);
|
return openPage(stackView);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -351,12 +352,12 @@ class _$OpenPage implements OpenPage {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? collapse,
|
TResult Function()? collapse,
|
||||||
TResult Function(HomeStackContext context)? openPage,
|
TResult Function(HomeStackView stackView)? openPage,
|
||||||
TResult Function(String name, String? desc)? createApp,
|
TResult Function(String name, String? desc)? createApp,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (openPage != null) {
|
if (openPage != null) {
|
||||||
return openPage(context);
|
return openPage(stackView);
|
||||||
}
|
}
|
||||||
return orElse();
|
return orElse();
|
||||||
}
|
}
|
||||||
@ -389,9 +390,9 @@ class _$OpenPage implements OpenPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract class OpenPage implements MenuEvent {
|
abstract class OpenPage implements MenuEvent {
|
||||||
const factory OpenPage(HomeStackContext context) = _$OpenPage;
|
const factory OpenPage(HomeStackView stackView) = _$OpenPage;
|
||||||
|
|
||||||
HomeStackContext get context => throw _privateConstructorUsedError;
|
HomeStackView get stackView => throw _privateConstructorUsedError;
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
$OpenPageCopyWith<OpenPage> get copyWith =>
|
$OpenPageCopyWith<OpenPage> get copyWith =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@ -472,7 +473,7 @@ class _$CreateApp implements CreateApp {
|
|||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function() initial,
|
required TResult Function() initial,
|
||||||
required TResult Function() collapse,
|
required TResult Function() collapse,
|
||||||
required TResult Function(HomeStackContext context) openPage,
|
required TResult Function(HomeStackView stackView) openPage,
|
||||||
required TResult Function(String name, String? desc) createApp,
|
required TResult Function(String name, String? desc) createApp,
|
||||||
}) {
|
}) {
|
||||||
return createApp(name, desc);
|
return createApp(name, desc);
|
||||||
@ -483,7 +484,7 @@ class _$CreateApp implements CreateApp {
|
|||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function()? initial,
|
TResult Function()? initial,
|
||||||
TResult Function()? collapse,
|
TResult Function()? collapse,
|
||||||
TResult Function(HomeStackContext context)? openPage,
|
TResult Function(HomeStackView stackView)? openPage,
|
||||||
TResult Function(String name, String? desc)? createApp,
|
TResult Function(String name, String? desc)? createApp,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
@ -538,12 +539,12 @@ class _$MenuStateTearOff {
|
|||||||
{required bool isCollapse,
|
{required bool isCollapse,
|
||||||
required Option<List<App>> apps,
|
required Option<List<App>> apps,
|
||||||
required Either<Unit, WorkspaceError> successOrFailure,
|
required Either<Unit, WorkspaceError> successOrFailure,
|
||||||
HomeStackContext? pageContext}) {
|
HomeStackView? stackView}) {
|
||||||
return _MenuState(
|
return _MenuState(
|
||||||
isCollapse: isCollapse,
|
isCollapse: isCollapse,
|
||||||
apps: apps,
|
apps: apps,
|
||||||
successOrFailure: successOrFailure,
|
successOrFailure: successOrFailure,
|
||||||
pageContext: pageContext,
|
stackView: stackView,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -557,7 +558,7 @@ mixin _$MenuState {
|
|||||||
Option<List<App>> get apps => throw _privateConstructorUsedError;
|
Option<List<App>> get apps => throw _privateConstructorUsedError;
|
||||||
Either<Unit, WorkspaceError> get successOrFailure =>
|
Either<Unit, WorkspaceError> get successOrFailure =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
HomeStackContext? get pageContext => throw _privateConstructorUsedError;
|
HomeStackView? get stackView => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
$MenuStateCopyWith<MenuState> get copyWith =>
|
$MenuStateCopyWith<MenuState> get copyWith =>
|
||||||
@ -572,7 +573,7 @@ abstract class $MenuStateCopyWith<$Res> {
|
|||||||
{bool isCollapse,
|
{bool isCollapse,
|
||||||
Option<List<App>> apps,
|
Option<List<App>> apps,
|
||||||
Either<Unit, WorkspaceError> successOrFailure,
|
Either<Unit, WorkspaceError> successOrFailure,
|
||||||
HomeStackContext? pageContext});
|
HomeStackView? stackView});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@ -588,7 +589,7 @@ class _$MenuStateCopyWithImpl<$Res> implements $MenuStateCopyWith<$Res> {
|
|||||||
Object? isCollapse = freezed,
|
Object? isCollapse = freezed,
|
||||||
Object? apps = freezed,
|
Object? apps = freezed,
|
||||||
Object? successOrFailure = freezed,
|
Object? successOrFailure = freezed,
|
||||||
Object? pageContext = freezed,
|
Object? stackView = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(_value.copyWith(
|
return _then(_value.copyWith(
|
||||||
isCollapse: isCollapse == freezed
|
isCollapse: isCollapse == freezed
|
||||||
@ -603,10 +604,10 @@ class _$MenuStateCopyWithImpl<$Res> implements $MenuStateCopyWith<$Res> {
|
|||||||
? _value.successOrFailure
|
? _value.successOrFailure
|
||||||
: successOrFailure // ignore: cast_nullable_to_non_nullable
|
: successOrFailure // ignore: cast_nullable_to_non_nullable
|
||||||
as Either<Unit, WorkspaceError>,
|
as Either<Unit, WorkspaceError>,
|
||||||
pageContext: pageContext == freezed
|
stackView: stackView == freezed
|
||||||
? _value.pageContext
|
? _value.stackView
|
||||||
: pageContext // ignore: cast_nullable_to_non_nullable
|
: stackView // ignore: cast_nullable_to_non_nullable
|
||||||
as HomeStackContext?,
|
as HomeStackView?,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -621,7 +622,7 @@ abstract class _$MenuStateCopyWith<$Res> implements $MenuStateCopyWith<$Res> {
|
|||||||
{bool isCollapse,
|
{bool isCollapse,
|
||||||
Option<List<App>> apps,
|
Option<List<App>> apps,
|
||||||
Either<Unit, WorkspaceError> successOrFailure,
|
Either<Unit, WorkspaceError> successOrFailure,
|
||||||
HomeStackContext? pageContext});
|
HomeStackView? stackView});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@ -638,7 +639,7 @@ class __$MenuStateCopyWithImpl<$Res> extends _$MenuStateCopyWithImpl<$Res>
|
|||||||
Object? isCollapse = freezed,
|
Object? isCollapse = freezed,
|
||||||
Object? apps = freezed,
|
Object? apps = freezed,
|
||||||
Object? successOrFailure = freezed,
|
Object? successOrFailure = freezed,
|
||||||
Object? pageContext = freezed,
|
Object? stackView = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(_MenuState(
|
return _then(_MenuState(
|
||||||
isCollapse: isCollapse == freezed
|
isCollapse: isCollapse == freezed
|
||||||
@ -653,10 +654,10 @@ class __$MenuStateCopyWithImpl<$Res> extends _$MenuStateCopyWithImpl<$Res>
|
|||||||
? _value.successOrFailure
|
? _value.successOrFailure
|
||||||
: successOrFailure // ignore: cast_nullable_to_non_nullable
|
: successOrFailure // ignore: cast_nullable_to_non_nullable
|
||||||
as Either<Unit, WorkspaceError>,
|
as Either<Unit, WorkspaceError>,
|
||||||
pageContext: pageContext == freezed
|
stackView: stackView == freezed
|
||||||
? _value.pageContext
|
? _value.stackView
|
||||||
: pageContext // ignore: cast_nullable_to_non_nullable
|
: stackView // ignore: cast_nullable_to_non_nullable
|
||||||
as HomeStackContext?,
|
as HomeStackView?,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -668,7 +669,7 @@ class _$_MenuState implements _MenuState {
|
|||||||
{required this.isCollapse,
|
{required this.isCollapse,
|
||||||
required this.apps,
|
required this.apps,
|
||||||
required this.successOrFailure,
|
required this.successOrFailure,
|
||||||
this.pageContext});
|
this.stackView});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final bool isCollapse;
|
final bool isCollapse;
|
||||||
@ -677,11 +678,11 @@ class _$_MenuState implements _MenuState {
|
|||||||
@override
|
@override
|
||||||
final Either<Unit, WorkspaceError> successOrFailure;
|
final Either<Unit, WorkspaceError> successOrFailure;
|
||||||
@override
|
@override
|
||||||
final HomeStackContext? pageContext;
|
final HomeStackView? stackView;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'MenuState(isCollapse: $isCollapse, apps: $apps, successOrFailure: $successOrFailure, pageContext: $pageContext)';
|
return 'MenuState(isCollapse: $isCollapse, apps: $apps, successOrFailure: $successOrFailure, stackView: $stackView)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -696,9 +697,9 @@ class _$_MenuState implements _MenuState {
|
|||||||
(identical(other.successOrFailure, successOrFailure) ||
|
(identical(other.successOrFailure, successOrFailure) ||
|
||||||
const DeepCollectionEquality()
|
const DeepCollectionEquality()
|
||||||
.equals(other.successOrFailure, successOrFailure)) &&
|
.equals(other.successOrFailure, successOrFailure)) &&
|
||||||
(identical(other.pageContext, pageContext) ||
|
(identical(other.stackView, stackView) ||
|
||||||
const DeepCollectionEquality()
|
const DeepCollectionEquality()
|
||||||
.equals(other.pageContext, pageContext)));
|
.equals(other.stackView, stackView)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -707,7 +708,7 @@ class _$_MenuState implements _MenuState {
|
|||||||
const DeepCollectionEquality().hash(isCollapse) ^
|
const DeepCollectionEquality().hash(isCollapse) ^
|
||||||
const DeepCollectionEquality().hash(apps) ^
|
const DeepCollectionEquality().hash(apps) ^
|
||||||
const DeepCollectionEquality().hash(successOrFailure) ^
|
const DeepCollectionEquality().hash(successOrFailure) ^
|
||||||
const DeepCollectionEquality().hash(pageContext);
|
const DeepCollectionEquality().hash(stackView);
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@override
|
@override
|
||||||
@ -720,7 +721,7 @@ abstract class _MenuState implements MenuState {
|
|||||||
{required bool isCollapse,
|
{required bool isCollapse,
|
||||||
required Option<List<App>> apps,
|
required Option<List<App>> apps,
|
||||||
required Either<Unit, WorkspaceError> successOrFailure,
|
required Either<Unit, WorkspaceError> successOrFailure,
|
||||||
HomeStackContext? pageContext}) = _$_MenuState;
|
HomeStackView? stackView}) = _$_MenuState;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get isCollapse => throw _privateConstructorUsedError;
|
bool get isCollapse => throw _privateConstructorUsedError;
|
||||||
@ -730,7 +731,7 @@ abstract class _MenuState implements MenuState {
|
|||||||
Either<Unit, WorkspaceError> get successOrFailure =>
|
Either<Unit, WorkspaceError> get successOrFailure =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@override
|
@override
|
||||||
HomeStackContext? get pageContext => throw _privateConstructorUsedError;
|
HomeStackView? get stackView => throw _privateConstructorUsedError;
|
||||||
@override
|
@override
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
_$MenuStateCopyWith<_MenuState> get copyWith =>
|
_$MenuStateCopyWith<_MenuState> get copyWith =>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:app_flowy/workspace/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(HomeStackContext context);
|
void setPageContext(HomeStackView context);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:app_flowy/workspace/domain/page_stack/page_stack_bloc.dart';
|
import 'package:app_flowy/workspace/domain/page_stack/page_stack_bloc.dart';
|
||||||
|
import 'package:app_flowy/workspace/presentation/doc/doc_widget.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.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';
|
||||||
@ -7,12 +8,10 @@ import 'package:app_flowy/workspace/presentation/widgets/fading_index_stack.dart
|
|||||||
import 'package:app_flowy/workspace/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<ViewType> pages = ViewType.values.toList();
|
abstract class HomeStackView extends Equatable {
|
||||||
|
|
||||||
abstract class HomeStackContext extends Equatable {
|
|
||||||
final ViewType type;
|
final ViewType type;
|
||||||
final String title;
|
final String title;
|
||||||
const HomeStackContext({required this.type, required this.title});
|
const HomeStackView({required this.type, required this.title});
|
||||||
}
|
}
|
||||||
|
|
||||||
class HomePageStack {
|
class HomePageStack {
|
||||||
@ -20,11 +19,11 @@ class HomePageStack {
|
|||||||
HomePageStack();
|
HomePageStack();
|
||||||
|
|
||||||
String title() {
|
String title() {
|
||||||
return _bloc.state.pageContext.title;
|
return _bloc.state.stackView.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPageContext(HomeStackContext? newContext) {
|
void setStackView(HomeStackView? stackView) {
|
||||||
_bloc.add(PageStackEvent.setContext(newContext ?? BlankPageContext()));
|
_bloc.add(PageStackEvent.setStackView(stackView ?? const BlankStackView()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget stackTopBar() {
|
Widget stackTopBar() {
|
||||||
@ -33,7 +32,7 @@ class HomePageStack {
|
|||||||
child: BlocBuilder<PageStackBloc, PageStackState>(
|
child: BlocBuilder<PageStackBloc, PageStackState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return HomeTopBar(
|
return HomeTopBar(
|
||||||
title: state.pageContext.title,
|
title: state.stackView.title,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -45,10 +44,9 @@ class HomePageStack {
|
|||||||
create: (context) => _bloc,
|
create: (context) => _bloc,
|
||||||
child: BlocBuilder<PageStackBloc, PageStackState>(
|
child: BlocBuilder<PageStackBloc, PageStackState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final pageContext = state.pageContext;
|
|
||||||
return FadingIndexedStack(
|
return FadingIndexedStack(
|
||||||
index: pages.indexOf(pageContext.type),
|
index: pages.indexOf(state.stackView.type),
|
||||||
children: buildPagesWidget(pageContext),
|
children: _buildStackWidget(state.stackView),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -56,31 +54,37 @@ class HomePageStack {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> buildPagesWidget(HomeStackContext pageContext) {
|
List<ViewType> pages = ViewType.values.toList();
|
||||||
|
|
||||||
|
List<Widget> _buildStackWidget(HomeStackView stackView) {
|
||||||
return ViewType.values.map((viewType) {
|
return ViewType.values.map((viewType) {
|
||||||
if (viewType == pageContext.type) {
|
if (viewType == stackView.type) {
|
||||||
return viewType.builderDisplayWidget(pageContext);
|
switch (stackView.type) {
|
||||||
|
case ViewType.Blank:
|
||||||
|
return BlankPage(stackView: stackView as BlankStackView);
|
||||||
|
case ViewType.Doc:
|
||||||
|
return DocPage(stackView: stackView as DocPageContext);
|
||||||
|
default:
|
||||||
|
return BlankPage(stackView: stackView as BlankStackView);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return const BlankPage(context: BlankPageContext());
|
return const BlankPage(stackView: BlankStackView());
|
||||||
}
|
}
|
||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
extension PageTypeExtension on ViewType {
|
HomeStackView stackViewFromView(View view) {
|
||||||
HomeStackWidget builderDisplayWidget(HomeStackContext context) {
|
switch (view.viewType) {
|
||||||
switch (this) {
|
|
||||||
case ViewType.Blank:
|
case ViewType.Blank:
|
||||||
return BlankPage(context: context as BlankPageContext);
|
return const BlankStackView();
|
||||||
case ViewType.Doc:
|
case ViewType.Doc:
|
||||||
return BlankPage(context: context as BlankPageContext);
|
return DocPageContext(view);
|
||||||
default:
|
default:
|
||||||
return BlankPage(context: context as BlankPageContext);
|
return const BlankStackView();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class HomeStackWidget extends StatefulWidget {
|
abstract class HomeStackWidget extends StatefulWidget {
|
||||||
final HomeStackContext pageContext;
|
final HomeStackView stackView;
|
||||||
const HomeStackWidget({Key? key, required this.pageContext})
|
const HomeStackWidget({Key? key, required this.stackView}) : super(key: key);
|
||||||
: super(key: key);
|
|
||||||
}
|
}
|
||||||
|
@ -11,25 +11,25 @@ class PageStackBloc extends Bloc<PageStackEvent, PageStackState> {
|
|||||||
Stream<PageStackState> mapEventToState(
|
Stream<PageStackState> mapEventToState(
|
||||||
PageStackEvent event,
|
PageStackEvent event,
|
||||||
) async* {
|
) async* {
|
||||||
yield* event.map(setContext: (NewPageContext value) async* {
|
yield* event.map(setStackView: (NewPageContext value) async* {
|
||||||
yield state.copyWith(pageContext: value.newContext);
|
yield state.copyWith(stackView: value.newStackView);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
abstract class PageStackEvent with _$PageStackEvent {
|
abstract class PageStackEvent with _$PageStackEvent {
|
||||||
const factory PageStackEvent.setContext(HomeStackContext newContext) =
|
const factory PageStackEvent.setStackView(HomeStackView newStackView) =
|
||||||
NewPageContext;
|
NewPageContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
abstract class PageStackState implements _$PageStackState {
|
abstract class PageStackState implements _$PageStackState {
|
||||||
const factory PageStackState({
|
const factory PageStackState({
|
||||||
required HomeStackContext pageContext,
|
required HomeStackView stackView,
|
||||||
}) = _PageStackState;
|
}) = _PageStackState;
|
||||||
|
|
||||||
factory PageStackState.initial() => const PageStackState(
|
factory PageStackState.initial() => const PageStackState(
|
||||||
pageContext: BlankPageContext(),
|
stackView: BlankStackView(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,9 @@ final _privateConstructorUsedError = UnsupportedError(
|
|||||||
class _$PageStackEventTearOff {
|
class _$PageStackEventTearOff {
|
||||||
const _$PageStackEventTearOff();
|
const _$PageStackEventTearOff();
|
||||||
|
|
||||||
NewPageContext setContext(HomeStackContext newContext) {
|
NewPageContext setStackView(HomeStackView newStackView) {
|
||||||
return NewPageContext(
|
return NewPageContext(
|
||||||
newContext,
|
newStackView,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -28,27 +28,27 @@ const $PageStackEvent = _$PageStackEventTearOff();
|
|||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$PageStackEvent {
|
mixin _$PageStackEvent {
|
||||||
HomeStackContext get newContext => throw _privateConstructorUsedError;
|
HomeStackView get newStackView => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(HomeStackContext newContext) setContext,
|
required TResult Function(HomeStackView newStackView) setStackView,
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(HomeStackContext newContext)? setContext,
|
TResult Function(HomeStackView newStackView)? setStackView,
|
||||||
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(NewPageContext value) setContext,
|
required TResult Function(NewPageContext value) setStackView,
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeMap<TResult extends Object?>({
|
TResult maybeMap<TResult extends Object?>({
|
||||||
TResult Function(NewPageContext value)? setContext,
|
TResult Function(NewPageContext value)? setStackView,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) =>
|
}) =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
@ -63,7 +63,7 @@ abstract class $PageStackEventCopyWith<$Res> {
|
|||||||
factory $PageStackEventCopyWith(
|
factory $PageStackEventCopyWith(
|
||||||
PageStackEvent value, $Res Function(PageStackEvent) then) =
|
PageStackEvent value, $Res Function(PageStackEvent) then) =
|
||||||
_$PageStackEventCopyWithImpl<$Res>;
|
_$PageStackEventCopyWithImpl<$Res>;
|
||||||
$Res call({HomeStackContext newContext});
|
$Res call({HomeStackView newStackView});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@ -77,13 +77,13 @@ class _$PageStackEventCopyWithImpl<$Res>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? newContext = freezed,
|
Object? newStackView = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(_value.copyWith(
|
return _then(_value.copyWith(
|
||||||
newContext: newContext == freezed
|
newStackView: newStackView == freezed
|
||||||
? _value.newContext
|
? _value.newStackView
|
||||||
: newContext // ignore: cast_nullable_to_non_nullable
|
: newStackView // ignore: cast_nullable_to_non_nullable
|
||||||
as HomeStackContext,
|
as HomeStackView,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,7 +95,7 @@ abstract class $NewPageContextCopyWith<$Res>
|
|||||||
NewPageContext value, $Res Function(NewPageContext) then) =
|
NewPageContext value, $Res Function(NewPageContext) then) =
|
||||||
_$NewPageContextCopyWithImpl<$Res>;
|
_$NewPageContextCopyWithImpl<$Res>;
|
||||||
@override
|
@override
|
||||||
$Res call({HomeStackContext newContext});
|
$Res call({HomeStackView newStackView});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@ -111,13 +111,13 @@ class _$NewPageContextCopyWithImpl<$Res>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? newContext = freezed,
|
Object? newStackView = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(NewPageContext(
|
return _then(NewPageContext(
|
||||||
newContext == freezed
|
newStackView == freezed
|
||||||
? _value.newContext
|
? _value.newStackView
|
||||||
: newContext // ignore: cast_nullable_to_non_nullable
|
: newStackView // ignore: cast_nullable_to_non_nullable
|
||||||
as HomeStackContext,
|
as HomeStackView,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,28 +125,28 @@ class _$NewPageContextCopyWithImpl<$Res>
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
|
|
||||||
class _$NewPageContext implements NewPageContext {
|
class _$NewPageContext implements NewPageContext {
|
||||||
const _$NewPageContext(this.newContext);
|
const _$NewPageContext(this.newStackView);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final HomeStackContext newContext;
|
final HomeStackView newStackView;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'PageStackEvent.setContext(newContext: $newContext)';
|
return 'PageStackEvent.setStackView(newStackView: $newStackView)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(dynamic other) {
|
bool operator ==(dynamic other) {
|
||||||
return identical(this, other) ||
|
return identical(this, other) ||
|
||||||
(other is NewPageContext &&
|
(other is NewPageContext &&
|
||||||
(identical(other.newContext, newContext) ||
|
(identical(other.newStackView, newStackView) ||
|
||||||
const DeepCollectionEquality()
|
const DeepCollectionEquality()
|
||||||
.equals(other.newContext, newContext)));
|
.equals(other.newStackView, newStackView)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
runtimeType.hashCode ^ const DeepCollectionEquality().hash(newContext);
|
runtimeType.hashCode ^ const DeepCollectionEquality().hash(newStackView);
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@override
|
@override
|
||||||
@ -156,19 +156,19 @@ class _$NewPageContext implements NewPageContext {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult when<TResult extends Object?>({
|
TResult when<TResult extends Object?>({
|
||||||
required TResult Function(HomeStackContext newContext) setContext,
|
required TResult Function(HomeStackView newStackView) setStackView,
|
||||||
}) {
|
}) {
|
||||||
return setContext(newContext);
|
return setStackView(newStackView);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeWhen<TResult extends Object?>({
|
TResult maybeWhen<TResult extends Object?>({
|
||||||
TResult Function(HomeStackContext newContext)? setContext,
|
TResult Function(HomeStackView newStackView)? setStackView,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (setContext != null) {
|
if (setStackView != null) {
|
||||||
return setContext(newContext);
|
return setStackView(newStackView);
|
||||||
}
|
}
|
||||||
return orElse();
|
return orElse();
|
||||||
}
|
}
|
||||||
@ -176,29 +176,29 @@ class _$NewPageContext implements NewPageContext {
|
|||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult map<TResult extends Object?>({
|
TResult map<TResult extends Object?>({
|
||||||
required TResult Function(NewPageContext value) setContext,
|
required TResult Function(NewPageContext value) setStackView,
|
||||||
}) {
|
}) {
|
||||||
return setContext(this);
|
return setStackView(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@optionalTypeArgs
|
@optionalTypeArgs
|
||||||
TResult maybeMap<TResult extends Object?>({
|
TResult maybeMap<TResult extends Object?>({
|
||||||
TResult Function(NewPageContext value)? setContext,
|
TResult Function(NewPageContext value)? setStackView,
|
||||||
required TResult orElse(),
|
required TResult orElse(),
|
||||||
}) {
|
}) {
|
||||||
if (setContext != null) {
|
if (setStackView != null) {
|
||||||
return setContext(this);
|
return setStackView(this);
|
||||||
}
|
}
|
||||||
return orElse();
|
return orElse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class NewPageContext implements PageStackEvent {
|
abstract class NewPageContext implements PageStackEvent {
|
||||||
const factory NewPageContext(HomeStackContext newContext) = _$NewPageContext;
|
const factory NewPageContext(HomeStackView newStackView) = _$NewPageContext;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
HomeStackContext get newContext => throw _privateConstructorUsedError;
|
HomeStackView get newStackView => throw _privateConstructorUsedError;
|
||||||
@override
|
@override
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
$NewPageContextCopyWith<NewPageContext> get copyWith =>
|
$NewPageContextCopyWith<NewPageContext> get copyWith =>
|
||||||
@ -209,9 +209,9 @@ abstract class NewPageContext implements PageStackEvent {
|
|||||||
class _$PageStackStateTearOff {
|
class _$PageStackStateTearOff {
|
||||||
const _$PageStackStateTearOff();
|
const _$PageStackStateTearOff();
|
||||||
|
|
||||||
_PageStackState call({required HomeStackContext pageContext}) {
|
_PageStackState call({required HomeStackView stackView}) {
|
||||||
return _PageStackState(
|
return _PageStackState(
|
||||||
pageContext: pageContext,
|
stackView: stackView,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -221,7 +221,7 @@ const $PageStackState = _$PageStackStateTearOff();
|
|||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$PageStackState {
|
mixin _$PageStackState {
|
||||||
HomeStackContext get pageContext => throw _privateConstructorUsedError;
|
HomeStackView get stackView => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
$PageStackStateCopyWith<PageStackState> get copyWith =>
|
$PageStackStateCopyWith<PageStackState> get copyWith =>
|
||||||
@ -233,7 +233,7 @@ abstract class $PageStackStateCopyWith<$Res> {
|
|||||||
factory $PageStackStateCopyWith(
|
factory $PageStackStateCopyWith(
|
||||||
PageStackState value, $Res Function(PageStackState) then) =
|
PageStackState value, $Res Function(PageStackState) then) =
|
||||||
_$PageStackStateCopyWithImpl<$Res>;
|
_$PageStackStateCopyWithImpl<$Res>;
|
||||||
$Res call({HomeStackContext pageContext});
|
$Res call({HomeStackView stackView});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@ -247,13 +247,13 @@ class _$PageStackStateCopyWithImpl<$Res>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? pageContext = freezed,
|
Object? stackView = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(_value.copyWith(
|
return _then(_value.copyWith(
|
||||||
pageContext: pageContext == freezed
|
stackView: stackView == freezed
|
||||||
? _value.pageContext
|
? _value.stackView
|
||||||
: pageContext // ignore: cast_nullable_to_non_nullable
|
: stackView // ignore: cast_nullable_to_non_nullable
|
||||||
as HomeStackContext,
|
as HomeStackView,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -265,7 +265,7 @@ abstract class _$PageStackStateCopyWith<$Res>
|
|||||||
_PageStackState value, $Res Function(_PageStackState) then) =
|
_PageStackState value, $Res Function(_PageStackState) then) =
|
||||||
__$PageStackStateCopyWithImpl<$Res>;
|
__$PageStackStateCopyWithImpl<$Res>;
|
||||||
@override
|
@override
|
||||||
$Res call({HomeStackContext pageContext});
|
$Res call({HomeStackView stackView});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@ -281,13 +281,13 @@ class __$PageStackStateCopyWithImpl<$Res>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
Object? pageContext = freezed,
|
Object? stackView = freezed,
|
||||||
}) {
|
}) {
|
||||||
return _then(_PageStackState(
|
return _then(_PageStackState(
|
||||||
pageContext: pageContext == freezed
|
stackView: stackView == freezed
|
||||||
? _value.pageContext
|
? _value.stackView
|
||||||
: pageContext // ignore: cast_nullable_to_non_nullable
|
: stackView // ignore: cast_nullable_to_non_nullable
|
||||||
as HomeStackContext,
|
as HomeStackView,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -295,28 +295,28 @@ class __$PageStackStateCopyWithImpl<$Res>
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
|
|
||||||
class _$_PageStackState implements _PageStackState {
|
class _$_PageStackState implements _PageStackState {
|
||||||
const _$_PageStackState({required this.pageContext});
|
const _$_PageStackState({required this.stackView});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final HomeStackContext pageContext;
|
final HomeStackView stackView;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'PageStackState(pageContext: $pageContext)';
|
return 'PageStackState(stackView: $stackView)';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(dynamic other) {
|
bool operator ==(dynamic other) {
|
||||||
return identical(this, other) ||
|
return identical(this, other) ||
|
||||||
(other is _PageStackState &&
|
(other is _PageStackState &&
|
||||||
(identical(other.pageContext, pageContext) ||
|
(identical(other.stackView, stackView) ||
|
||||||
const DeepCollectionEquality()
|
const DeepCollectionEquality()
|
||||||
.equals(other.pageContext, pageContext)));
|
.equals(other.stackView, stackView)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
runtimeType.hashCode ^ const DeepCollectionEquality().hash(pageContext);
|
runtimeType.hashCode ^ const DeepCollectionEquality().hash(stackView);
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@override
|
@override
|
||||||
@ -325,11 +325,11 @@ class _$_PageStackState implements _PageStackState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract class _PageStackState implements PageStackState {
|
abstract class _PageStackState implements PageStackState {
|
||||||
const factory _PageStackState({required HomeStackContext pageContext}) =
|
const factory _PageStackState({required HomeStackView stackView}) =
|
||||||
_$_PageStackState;
|
_$_PageStackState;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
HomeStackContext get pageContext => throw _privateConstructorUsedError;
|
HomeStackView get stackView => throw _privateConstructorUsedError;
|
||||||
@override
|
@override
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
_$PageStackStateCopyWith<_PageStackState> get copyWith =>
|
_$PageStackStateCopyWith<_PageStackState> get copyWith =>
|
||||||
|
@ -2,7 +2,7 @@ import 'package:app_flowy/workspace/domain/page_stack/page_stack.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';
|
||||||
|
|
||||||
class DocPageContext extends HomeStackContext {
|
class DocPageContext extends HomeStackView {
|
||||||
final View view;
|
final View view;
|
||||||
DocPageContext(this.view)
|
DocPageContext(this.view)
|
||||||
: super(
|
: super(
|
||||||
@ -15,8 +15,8 @@ class DocPageContext extends HomeStackContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class DocPage extends HomeStackWidget {
|
class DocPage extends HomeStackWidget {
|
||||||
const DocPage({Key? key, required DocPageContext context})
|
const DocPage({Key? key, required DocPageContext stackView})
|
||||||
: super(key: key, pageContext: context);
|
: super(key: key, stackView: stackView);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_DocPageState createState() => _DocPageState();
|
_DocPageState createState() => _DocPageState();
|
||||||
@ -25,9 +25,9 @@ class DocPage extends HomeStackWidget {
|
|||||||
class _DocPageState extends State<DocPage> {
|
class _DocPageState extends State<DocPage> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
assert(widget.pageContext is DocPageContext);
|
assert(widget.stackView is DocPageContext);
|
||||||
|
|
||||||
final context = widget.pageContext as DocPageContext;
|
final context = widget.stackView as DocPageContext;
|
||||||
final filename = _extractFilename(context.view.id);
|
final filename = _extractFilename(context.view.id);
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ class HomeScreen extends StatelessWidget {
|
|||||||
final homeBloc = context.read<HomeBloc>();
|
final homeBloc = context.read<HomeBloc>();
|
||||||
Widget homeMenu = HomeMenu(
|
Widget homeMenu = HomeMenu(
|
||||||
pageContextChanged: (pageContext) {
|
pageContextChanged: (pageContext) {
|
||||||
getIt<HomePageStack>().setPageContext(pageContext);
|
getIt<HomePageStack>().setStackView(pageContext);
|
||||||
},
|
},
|
||||||
isCollapseChanged: (isCollapse) {
|
isCollapseChanged: (isCollapse) {
|
||||||
homeBloc.add(HomeEvent.forceCollapse(isCollapse));
|
homeBloc.add(HomeEvent.forceCollapse(isCollapse));
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import 'package:app_flowy/startup/startup.dart';
|
||||||
|
import 'package:app_flowy/workspace/domain/page_stack/page_stack.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';
|
||||||
|
|
||||||
@ -10,7 +12,7 @@ class ViewWidget extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: _handleTapOnView(context),
|
onTap: _openView(context),
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 30,
|
height: 30,
|
||||||
child: buildContent(),
|
child: buildContent(),
|
||||||
@ -33,14 +35,10 @@ class ViewWidget extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Function() _handleTapOnView(BuildContext context) {
|
Function() _openView(BuildContext context) {
|
||||||
return () {
|
return () {
|
||||||
// if (view.id.startsWith('doc')) {
|
final stackView = stackViewFromView(view);
|
||||||
// context.read<MenuBloc>().add(MenuEvent.openPage(DocPageContext(view)));
|
getIt<HomePageStack>().setStackView(stackView);
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// context.read<MenuBloc>().add(MenuEvent.openPage(GridPageContext(view)));
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,16 +2,16 @@ import 'package:app_flowy/workspace/domain/page_stack/page_stack.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';
|
||||||
|
|
||||||
class BlankPageContext extends HomeStackContext {
|
class BlankStackView extends HomeStackView {
|
||||||
const BlankPageContext() : super(type: ViewType.Blank, title: 'Blank');
|
const BlankStackView() : super(type: ViewType.Blank, title: 'Blank');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [];
|
List<Object> get props => [];
|
||||||
}
|
}
|
||||||
|
|
||||||
class BlankPage extends HomeStackWidget {
|
class BlankPage extends HomeStackWidget {
|
||||||
const BlankPage({Key? key, required BlankPageContext context})
|
const BlankPage({Key? key, required BlankStackView stackView})
|
||||||
: super(key: key, pageContext: context);
|
: super(key: key, stackView: stackView);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() => _BlankPageState();
|
State<StatefulWidget> createState() => _BlankPageState();
|
||||||
|
@ -2,6 +2,6 @@ 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 {
|
||||||
final HomeStackContext pageContext;
|
final HomeStackView pageContext;
|
||||||
const HomeStackPage({Key? key, required this.pageContext}) : super(key: key);
|
const HomeStackPage({Key? key, required this.pageContext}) : super(key: key);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ import 'package:textstyle_extensions/textstyle_extensions.dart';
|
|||||||
import 'app_list.dart';
|
import 'app_list.dart';
|
||||||
|
|
||||||
class HomeMenu extends StatelessWidget {
|
class HomeMenu extends StatelessWidget {
|
||||||
final Function(HomeStackContext?) pageContextChanged;
|
final Function(HomeStackView?) pageContextChanged;
|
||||||
final Function(bool) isCollapseChanged;
|
final Function(bool) isCollapseChanged;
|
||||||
final String workspaceId;
|
final String workspaceId;
|
||||||
|
|
||||||
@ -45,8 +45,8 @@ class HomeMenu extends StatelessWidget {
|
|||||||
child: MultiBlocListener(
|
child: MultiBlocListener(
|
||||||
listeners: [
|
listeners: [
|
||||||
BlocListener<MenuBloc, MenuState>(
|
BlocListener<MenuBloc, MenuState>(
|
||||||
listenWhen: (p, c) => p.pageContext != c.pageContext,
|
listenWhen: (p, c) => p.stackView != c.stackView,
|
||||||
listener: (context, state) => pageContextChanged(state.pageContext),
|
listener: (context, state) => pageContextChanged(state.stackView),
|
||||||
),
|
),
|
||||||
BlocListener<MenuBloc, MenuState>(
|
BlocListener<MenuBloc, MenuState>(
|
||||||
listenWhen: (p, c) => p.isCollapse != c.isCollapse,
|
listenWhen: (p, c) => p.isCollapse != c.isCollapse,
|
||||||
|
Loading…
Reference in New Issue
Block a user