diff --git a/app_flowy/ios/Flutter/AppFrameworkInfo.plist b/app_flowy/ios/Flutter/AppFrameworkInfo.plist
index 9367d483e4..8d4492f977 100644
--- a/app_flowy/ios/Flutter/AppFrameworkInfo.plist
+++ b/app_flowy/ios/Flutter/AppFrameworkInfo.plist
@@ -21,6 +21,6 @@
CFBundleVersion
1.0
MinimumOSVersion
- 8.0
+ 9.0
diff --git a/app_flowy/lib/home/application/home_bloc.dart b/app_flowy/lib/home/application/home_bloc.dart
index 259abc3bb6..f7eeb22332 100644
--- a/app_flowy/lib/home/application/home_bloc.dart
+++ b/app_flowy/lib/home/application/home_bloc.dart
@@ -29,8 +29,8 @@ class HomeBloc extends Bloc {
dismissEditPannel: (value) async* {
yield state.copyWith(editContext: none());
},
- showMenu: (e) async* {
- yield state.copyWith(showMenu: e.isShow);
+ forceCollapse: (e) async* {
+ yield state.copyWith(forceCollapse: e.forceCollapse);
},
);
}
diff --git a/app_flowy/lib/home/application/home_bloc.freezed.dart b/app_flowy/lib/home/application/home_bloc.freezed.dart
index 16ed6f5120..abaf293786 100644
--- a/app_flowy/lib/home/application/home_bloc.freezed.dart
+++ b/app_flowy/lib/home/application/home_bloc.freezed.dart
@@ -22,9 +22,9 @@ class _$HomeEventTearOff {
);
}
- _ShowMenu showMenu(bool isShow) {
- return _ShowMenu(
- isShow,
+ _ForceCollapse forceCollapse(bool forceCollapse) {
+ return _ForceCollapse(
+ forceCollapse,
);
}
@@ -53,7 +53,7 @@ mixin _$HomeEvent {
@optionalTypeArgs
TResult when({
required TResult Function(bool isLoading) showLoading,
- required TResult Function(bool isShow) showMenu,
+ required TResult Function(bool forceCollapse) forceCollapse,
required TResult Function(PageContext context) setPage,
required TResult Function(EditPannelContext editContext) setEditPannel,
required TResult Function() dismissEditPannel,
@@ -62,7 +62,7 @@ mixin _$HomeEvent {
@optionalTypeArgs
TResult maybeWhen({
TResult Function(bool isLoading)? showLoading,
- TResult Function(bool isShow)? showMenu,
+ TResult Function(bool forceCollapse)? forceCollapse,
TResult Function(PageContext context)? setPage,
TResult Function(EditPannelContext editContext)? setEditPannel,
TResult Function()? dismissEditPannel,
@@ -72,7 +72,7 @@ mixin _$HomeEvent {
@optionalTypeArgs
TResult map({
required TResult Function(_ShowLoading value) showLoading,
- required TResult Function(_ShowMenu value) showMenu,
+ required TResult Function(_ForceCollapse value) forceCollapse,
required TResult Function(SetCurrentPage value) setPage,
required TResult Function(_ShowEditPannel value) setEditPannel,
required TResult Function(_DismissEditPannel value) dismissEditPannel,
@@ -81,7 +81,7 @@ mixin _$HomeEvent {
@optionalTypeArgs
TResult maybeMap({
TResult Function(_ShowLoading value)? showLoading,
- TResult Function(_ShowMenu value)? showMenu,
+ TResult Function(_ForceCollapse value)? forceCollapse,
TResult Function(SetCurrentPage value)? setPage,
TResult Function(_ShowEditPannel value)? setEditPannel,
TResult Function(_DismissEditPannel value)? dismissEditPannel,
@@ -171,7 +171,7 @@ class _$_ShowLoading implements _ShowLoading {
@optionalTypeArgs
TResult when({
required TResult Function(bool isLoading) showLoading,
- required TResult Function(bool isShow) showMenu,
+ required TResult Function(bool forceCollapse) forceCollapse,
required TResult Function(PageContext context) setPage,
required TResult Function(EditPannelContext editContext) setEditPannel,
required TResult Function() dismissEditPannel,
@@ -183,7 +183,7 @@ class _$_ShowLoading implements _ShowLoading {
@optionalTypeArgs
TResult maybeWhen({
TResult Function(bool isLoading)? showLoading,
- TResult Function(bool isShow)? showMenu,
+ TResult Function(bool forceCollapse)? forceCollapse,
TResult Function(PageContext context)? setPage,
TResult Function(EditPannelContext editContext)? setEditPannel,
TResult Function()? dismissEditPannel,
@@ -199,7 +199,7 @@ class _$_ShowLoading implements _ShowLoading {
@optionalTypeArgs
TResult map({
required TResult Function(_ShowLoading value) showLoading,
- required TResult Function(_ShowMenu value) showMenu,
+ required TResult Function(_ForceCollapse value) forceCollapse,
required TResult Function(SetCurrentPage value) setPage,
required TResult Function(_ShowEditPannel value) setEditPannel,
required TResult Function(_DismissEditPannel value) dismissEditPannel,
@@ -211,7 +211,7 @@ class _$_ShowLoading implements _ShowLoading {
@optionalTypeArgs
TResult maybeMap({
TResult Function(_ShowLoading value)? showLoading,
- TResult Function(_ShowMenu value)? showMenu,
+ TResult Function(_ForceCollapse value)? forceCollapse,
TResult Function(SetCurrentPage value)? setPage,
TResult Function(_ShowEditPannel value)? setEditPannel,
TResult Function(_DismissEditPannel value)? dismissEditPannel,
@@ -234,29 +234,31 @@ abstract class _ShowLoading implements HomeEvent {
}
/// @nodoc
-abstract class _$ShowMenuCopyWith<$Res> {
- factory _$ShowMenuCopyWith(_ShowMenu value, $Res Function(_ShowMenu) then) =
- __$ShowMenuCopyWithImpl<$Res>;
- $Res call({bool isShow});
+abstract class _$ForceCollapseCopyWith<$Res> {
+ factory _$ForceCollapseCopyWith(
+ _ForceCollapse value, $Res Function(_ForceCollapse) then) =
+ __$ForceCollapseCopyWithImpl<$Res>;
+ $Res call({bool forceCollapse});
}
/// @nodoc
-class __$ShowMenuCopyWithImpl<$Res> extends _$HomeEventCopyWithImpl<$Res>
- implements _$ShowMenuCopyWith<$Res> {
- __$ShowMenuCopyWithImpl(_ShowMenu _value, $Res Function(_ShowMenu) _then)
- : super(_value, (v) => _then(v as _ShowMenu));
+class __$ForceCollapseCopyWithImpl<$Res> extends _$HomeEventCopyWithImpl<$Res>
+ implements _$ForceCollapseCopyWith<$Res> {
+ __$ForceCollapseCopyWithImpl(
+ _ForceCollapse _value, $Res Function(_ForceCollapse) _then)
+ : super(_value, (v) => _then(v as _ForceCollapse));
@override
- _ShowMenu get _value => super._value as _ShowMenu;
+ _ForceCollapse get _value => super._value as _ForceCollapse;
@override
$Res call({
- Object? isShow = freezed,
+ Object? forceCollapse = freezed,
}) {
- return _then(_ShowMenu(
- isShow == freezed
- ? _value.isShow
- : isShow // ignore: cast_nullable_to_non_nullable
+ return _then(_ForceCollapse(
+ forceCollapse == freezed
+ ? _value.forceCollapse
+ : forceCollapse // ignore: cast_nullable_to_non_nullable
as bool,
));
}
@@ -264,58 +266,59 @@ class __$ShowMenuCopyWithImpl<$Res> extends _$HomeEventCopyWithImpl<$Res>
/// @nodoc
-class _$_ShowMenu implements _ShowMenu {
- const _$_ShowMenu(this.isShow);
+class _$_ForceCollapse implements _ForceCollapse {
+ const _$_ForceCollapse(this.forceCollapse);
@override
- final bool isShow;
+ final bool forceCollapse;
@override
String toString() {
- return 'HomeEvent.showMenu(isShow: $isShow)';
+ return 'HomeEvent.forceCollapse(forceCollapse: $forceCollapse)';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
- (other is _ShowMenu &&
- (identical(other.isShow, isShow) ||
- const DeepCollectionEquality().equals(other.isShow, isShow)));
+ (other is _ForceCollapse &&
+ (identical(other.forceCollapse, forceCollapse) ||
+ const DeepCollectionEquality()
+ .equals(other.forceCollapse, forceCollapse)));
}
@override
int get hashCode =>
- runtimeType.hashCode ^ const DeepCollectionEquality().hash(isShow);
+ runtimeType.hashCode ^ const DeepCollectionEquality().hash(forceCollapse);
@JsonKey(ignore: true)
@override
- _$ShowMenuCopyWith<_ShowMenu> get copyWith =>
- __$ShowMenuCopyWithImpl<_ShowMenu>(this, _$identity);
+ _$ForceCollapseCopyWith<_ForceCollapse> get copyWith =>
+ __$ForceCollapseCopyWithImpl<_ForceCollapse>(this, _$identity);
@override
@optionalTypeArgs
TResult when({
required TResult Function(bool isLoading) showLoading,
- required TResult Function(bool isShow) showMenu,
+ required TResult Function(bool forceCollapse) forceCollapse,
required TResult Function(PageContext context) setPage,
required TResult Function(EditPannelContext editContext) setEditPannel,
required TResult Function() dismissEditPannel,
}) {
- return showMenu(isShow);
+ return forceCollapse(this.forceCollapse);
}
@override
@optionalTypeArgs
TResult maybeWhen({
TResult Function(bool isLoading)? showLoading,
- TResult Function(bool isShow)? showMenu,
+ TResult Function(bool forceCollapse)? forceCollapse,
TResult Function(PageContext context)? setPage,
TResult Function(EditPannelContext editContext)? setEditPannel,
TResult Function()? dismissEditPannel,
required TResult orElse(),
}) {
- if (showMenu != null) {
- return showMenu(isShow);
+ if (forceCollapse != null) {
+ return forceCollapse(this.forceCollapse);
}
return orElse();
}
@@ -324,37 +327,37 @@ class _$_ShowMenu implements _ShowMenu {
@optionalTypeArgs
TResult map({
required TResult Function(_ShowLoading value) showLoading,
- required TResult Function(_ShowMenu value) showMenu,
+ required TResult Function(_ForceCollapse value) forceCollapse,
required TResult Function(SetCurrentPage value) setPage,
required TResult Function(_ShowEditPannel value) setEditPannel,
required TResult Function(_DismissEditPannel value) dismissEditPannel,
}) {
- return showMenu(this);
+ return forceCollapse(this);
}
@override
@optionalTypeArgs
TResult maybeMap({
TResult Function(_ShowLoading value)? showLoading,
- TResult Function(_ShowMenu value)? showMenu,
+ TResult Function(_ForceCollapse value)? forceCollapse,
TResult Function(SetCurrentPage value)? setPage,
TResult Function(_ShowEditPannel value)? setEditPannel,
TResult Function(_DismissEditPannel value)? dismissEditPannel,
required TResult orElse(),
}) {
- if (showMenu != null) {
- return showMenu(this);
+ if (forceCollapse != null) {
+ return forceCollapse(this);
}
return orElse();
}
}
-abstract class _ShowMenu implements HomeEvent {
- const factory _ShowMenu(bool isShow) = _$_ShowMenu;
+abstract class _ForceCollapse implements HomeEvent {
+ const factory _ForceCollapse(bool forceCollapse) = _$_ForceCollapse;
- bool get isShow => throw _privateConstructorUsedError;
+ bool get forceCollapse => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
- _$ShowMenuCopyWith<_ShowMenu> get copyWith =>
+ _$ForceCollapseCopyWith<_ForceCollapse> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -423,7 +426,7 @@ class _$SetCurrentPage implements SetCurrentPage {
@optionalTypeArgs
TResult when({
required TResult Function(bool isLoading) showLoading,
- required TResult Function(bool isShow) showMenu,
+ required TResult Function(bool forceCollapse) forceCollapse,
required TResult Function(PageContext context) setPage,
required TResult Function(EditPannelContext editContext) setEditPannel,
required TResult Function() dismissEditPannel,
@@ -435,7 +438,7 @@ class _$SetCurrentPage implements SetCurrentPage {
@optionalTypeArgs
TResult maybeWhen({
TResult Function(bool isLoading)? showLoading,
- TResult Function(bool isShow)? showMenu,
+ TResult Function(bool forceCollapse)? forceCollapse,
TResult Function(PageContext context)? setPage,
TResult Function(EditPannelContext editContext)? setEditPannel,
TResult Function()? dismissEditPannel,
@@ -451,7 +454,7 @@ class _$SetCurrentPage implements SetCurrentPage {
@optionalTypeArgs
TResult map({
required TResult Function(_ShowLoading value) showLoading,
- required TResult Function(_ShowMenu value) showMenu,
+ required TResult Function(_ForceCollapse value) forceCollapse,
required TResult Function(SetCurrentPage value) setPage,
required TResult Function(_ShowEditPannel value) setEditPannel,
required TResult Function(_DismissEditPannel value) dismissEditPannel,
@@ -463,7 +466,7 @@ class _$SetCurrentPage implements SetCurrentPage {
@optionalTypeArgs
TResult maybeMap({
TResult Function(_ShowLoading value)? showLoading,
- TResult Function(_ShowMenu value)? showMenu,
+ TResult Function(_ForceCollapse value)? forceCollapse,
TResult Function(SetCurrentPage value)? setPage,
TResult Function(_ShowEditPannel value)? setEditPannel,
TResult Function(_DismissEditPannel value)? dismissEditPannel,
@@ -551,7 +554,7 @@ class _$_ShowEditPannel implements _ShowEditPannel {
@optionalTypeArgs
TResult when({
required TResult Function(bool isLoading) showLoading,
- required TResult Function(bool isShow) showMenu,
+ required TResult Function(bool forceCollapse) forceCollapse,
required TResult Function(PageContext context) setPage,
required TResult Function(EditPannelContext editContext) setEditPannel,
required TResult Function() dismissEditPannel,
@@ -563,7 +566,7 @@ class _$_ShowEditPannel implements _ShowEditPannel {
@optionalTypeArgs
TResult maybeWhen({
TResult Function(bool isLoading)? showLoading,
- TResult Function(bool isShow)? showMenu,
+ TResult Function(bool forceCollapse)? forceCollapse,
TResult Function(PageContext context)? setPage,
TResult Function(EditPannelContext editContext)? setEditPannel,
TResult Function()? dismissEditPannel,
@@ -579,7 +582,7 @@ class _$_ShowEditPannel implements _ShowEditPannel {
@optionalTypeArgs
TResult map({
required TResult Function(_ShowLoading value) showLoading,
- required TResult Function(_ShowMenu value) showMenu,
+ required TResult Function(_ForceCollapse value) forceCollapse,
required TResult Function(SetCurrentPage value) setPage,
required TResult Function(_ShowEditPannel value) setEditPannel,
required TResult Function(_DismissEditPannel value) dismissEditPannel,
@@ -591,7 +594,7 @@ class _$_ShowEditPannel implements _ShowEditPannel {
@optionalTypeArgs
TResult maybeMap({
TResult Function(_ShowLoading value)? showLoading,
- TResult Function(_ShowMenu value)? showMenu,
+ TResult Function(_ForceCollapse value)? forceCollapse,
TResult Function(SetCurrentPage value)? setPage,
TResult Function(_ShowEditPannel value)? setEditPannel,
TResult Function(_DismissEditPannel value)? dismissEditPannel,
@@ -655,7 +658,7 @@ class _$_DismissEditPannel implements _DismissEditPannel {
@optionalTypeArgs
TResult when({
required TResult Function(bool isLoading) showLoading,
- required TResult Function(bool isShow) showMenu,
+ required TResult Function(bool forceCollapse) forceCollapse,
required TResult Function(PageContext context) setPage,
required TResult Function(EditPannelContext editContext) setEditPannel,
required TResult Function() dismissEditPannel,
@@ -667,7 +670,7 @@ class _$_DismissEditPannel implements _DismissEditPannel {
@optionalTypeArgs
TResult maybeWhen({
TResult Function(bool isLoading)? showLoading,
- TResult Function(bool isShow)? showMenu,
+ TResult Function(bool forceCollapse)? forceCollapse,
TResult Function(PageContext context)? setPage,
TResult Function(EditPannelContext editContext)? setEditPannel,
TResult Function()? dismissEditPannel,
@@ -683,7 +686,7 @@ class _$_DismissEditPannel implements _DismissEditPannel {
@optionalTypeArgs
TResult map({
required TResult Function(_ShowLoading value) showLoading,
- required TResult Function(_ShowMenu value) showMenu,
+ required TResult Function(_ForceCollapse value) forceCollapse,
required TResult Function(SetCurrentPage value) setPage,
required TResult Function(_ShowEditPannel value) setEditPannel,
required TResult Function(_DismissEditPannel value) dismissEditPannel,
@@ -695,7 +698,7 @@ class _$_DismissEditPannel implements _DismissEditPannel {
@optionalTypeArgs
TResult maybeMap({
TResult Function(_ShowLoading value)? showLoading,
- TResult Function(_ShowMenu value)? showMenu,
+ TResult Function(_ForceCollapse value)? forceCollapse,
TResult Function(SetCurrentPage value)? setPage,
TResult Function(_ShowEditPannel value)? setEditPannel,
TResult Function(_DismissEditPannel value)? dismissEditPannel,
@@ -718,12 +721,12 @@ class _$HomeStateTearOff {
_HomeState call(
{required bool isLoading,
- required bool showMenu,
+ required bool forceCollapse,
required PageContext pageContext,
required Option editContext}) {
return _HomeState(
isLoading: isLoading,
- showMenu: showMenu,
+ forceCollapse: forceCollapse,
pageContext: pageContext,
editContext: editContext,
);
@@ -736,7 +739,7 @@ const $HomeState = _$HomeStateTearOff();
/// @nodoc
mixin _$HomeState {
bool get isLoading => throw _privateConstructorUsedError;
- bool get showMenu => throw _privateConstructorUsedError;
+ bool get forceCollapse => throw _privateConstructorUsedError;
PageContext get pageContext => throw _privateConstructorUsedError;
Option get editContext =>
throw _privateConstructorUsedError;
@@ -752,7 +755,7 @@ abstract class $HomeStateCopyWith<$Res> {
_$HomeStateCopyWithImpl<$Res>;
$Res call(
{bool isLoading,
- bool showMenu,
+ bool forceCollapse,
PageContext pageContext,
Option editContext});
}
@@ -768,7 +771,7 @@ class _$HomeStateCopyWithImpl<$Res> implements $HomeStateCopyWith<$Res> {
@override
$Res call({
Object? isLoading = freezed,
- Object? showMenu = freezed,
+ Object? forceCollapse = freezed,
Object? pageContext = freezed,
Object? editContext = freezed,
}) {
@@ -777,9 +780,9 @@ class _$HomeStateCopyWithImpl<$Res> implements $HomeStateCopyWith<$Res> {
? _value.isLoading
: isLoading // ignore: cast_nullable_to_non_nullable
as bool,
- showMenu: showMenu == freezed
- ? _value.showMenu
- : showMenu // ignore: cast_nullable_to_non_nullable
+ forceCollapse: forceCollapse == freezed
+ ? _value.forceCollapse
+ : forceCollapse // ignore: cast_nullable_to_non_nullable
as bool,
pageContext: pageContext == freezed
? _value.pageContext
@@ -801,7 +804,7 @@ abstract class _$HomeStateCopyWith<$Res> implements $HomeStateCopyWith<$Res> {
@override
$Res call(
{bool isLoading,
- bool showMenu,
+ bool forceCollapse,
PageContext pageContext,
Option editContext});
}
@@ -818,7 +821,7 @@ class __$HomeStateCopyWithImpl<$Res> extends _$HomeStateCopyWithImpl<$Res>
@override
$Res call({
Object? isLoading = freezed,
- Object? showMenu = freezed,
+ Object? forceCollapse = freezed,
Object? pageContext = freezed,
Object? editContext = freezed,
}) {
@@ -827,9 +830,9 @@ class __$HomeStateCopyWithImpl<$Res> extends _$HomeStateCopyWithImpl<$Res>
? _value.isLoading
: isLoading // ignore: cast_nullable_to_non_nullable
as bool,
- showMenu: showMenu == freezed
- ? _value.showMenu
- : showMenu // ignore: cast_nullable_to_non_nullable
+ forceCollapse: forceCollapse == freezed
+ ? _value.forceCollapse
+ : forceCollapse // ignore: cast_nullable_to_non_nullable
as bool,
pageContext: pageContext == freezed
? _value.pageContext
@@ -848,14 +851,14 @@ class __$HomeStateCopyWithImpl<$Res> extends _$HomeStateCopyWithImpl<$Res>
class _$_HomeState implements _HomeState {
const _$_HomeState(
{required this.isLoading,
- required this.showMenu,
+ required this.forceCollapse,
required this.pageContext,
required this.editContext});
@override
final bool isLoading;
@override
- final bool showMenu;
+ final bool forceCollapse;
@override
final PageContext pageContext;
@override
@@ -863,7 +866,7 @@ class _$_HomeState implements _HomeState {
@override
String toString() {
- return 'HomeState(isLoading: $isLoading, showMenu: $showMenu, pageContext: $pageContext, editContext: $editContext)';
+ return 'HomeState(isLoading: $isLoading, forceCollapse: $forceCollapse, pageContext: $pageContext, editContext: $editContext)';
}
@override
@@ -873,9 +876,9 @@ class _$_HomeState implements _HomeState {
(identical(other.isLoading, isLoading) ||
const DeepCollectionEquality()
.equals(other.isLoading, isLoading)) &&
- (identical(other.showMenu, showMenu) ||
+ (identical(other.forceCollapse, forceCollapse) ||
const DeepCollectionEquality()
- .equals(other.showMenu, showMenu)) &&
+ .equals(other.forceCollapse, forceCollapse)) &&
(identical(other.pageContext, pageContext) ||
const DeepCollectionEquality()
.equals(other.pageContext, pageContext)) &&
@@ -888,7 +891,7 @@ class _$_HomeState implements _HomeState {
int get hashCode =>
runtimeType.hashCode ^
const DeepCollectionEquality().hash(isLoading) ^
- const DeepCollectionEquality().hash(showMenu) ^
+ const DeepCollectionEquality().hash(forceCollapse) ^
const DeepCollectionEquality().hash(pageContext) ^
const DeepCollectionEquality().hash(editContext);
@@ -901,14 +904,14 @@ class _$_HomeState implements _HomeState {
abstract class _HomeState implements HomeState {
const factory _HomeState(
{required bool isLoading,
- required bool showMenu,
+ required bool forceCollapse,
required PageContext pageContext,
required Option editContext}) = _$_HomeState;
@override
bool get isLoading => throw _privateConstructorUsedError;
@override
- bool get showMenu => throw _privateConstructorUsedError;
+ bool get forceCollapse => throw _privateConstructorUsedError;
@override
PageContext get pageContext => throw _privateConstructorUsedError;
@override
diff --git a/app_flowy/lib/home/application/home_event.dart b/app_flowy/lib/home/application/home_event.dart
index ec4d0a457b..76bc5662d8 100644
--- a/app_flowy/lib/home/application/home_event.dart
+++ b/app_flowy/lib/home/application/home_event.dart
@@ -3,7 +3,7 @@ part of 'home_bloc.dart';
@freezed
abstract class HomeEvent with _$HomeEvent {
const factory HomeEvent.showLoading(bool isLoading) = _ShowLoading;
- const factory HomeEvent.showMenu(bool isShow) = _ShowMenu;
+ const factory HomeEvent.forceCollapse(bool forceCollapse) = _ForceCollapse;
//page
const factory HomeEvent.setPage(PageContext context) = SetCurrentPage;
diff --git a/app_flowy/lib/home/application/home_state.dart b/app_flowy/lib/home/application/home_state.dart
index ce0be0f38e..cc08000edf 100644
--- a/app_flowy/lib/home/application/home_state.dart
+++ b/app_flowy/lib/home/application/home_state.dart
@@ -4,14 +4,14 @@ part of 'home_bloc.dart';
abstract class HomeState implements _$HomeState {
const factory HomeState({
required bool isLoading,
- required bool showMenu,
+ required bool forceCollapse,
required PageContext pageContext,
required Option editContext,
}) = _HomeState;
factory HomeState.initial() => HomeState(
isLoading: false,
- showMenu: true,
+ forceCollapse: false,
pageContext: const BlankPageContext(),
editContext: none(),
);
diff --git a/app_flowy/lib/home/application/menu/menu_bloc.dart b/app_flowy/lib/home/application/menu/menu_bloc.dart
index dd5790b458..3c1278a0a2 100644
--- a/app_flowy/lib/home/application/menu/menu_bloc.dart
+++ b/app_flowy/lib/home/application/menu/menu_bloc.dart
@@ -33,7 +33,7 @@ class MenuBloc extends Bloc {
yield state.copyWith(pageContext: some(e.context));
}
- Stream _performActionOnCreateApp(_CreateApp e) async* {
+ Stream _performActionOnCreateApp(_CreateApp val) async* {
yield state;
}
diff --git a/app_flowy/lib/home/application/menu/menu_bloc.freezed.dart b/app_flowy/lib/home/application/menu/menu_bloc.freezed.dart
index 38b4cb1fd0..8bfbf24366 100644
--- a/app_flowy/lib/home/application/menu/menu_bloc.freezed.dart
+++ b/app_flowy/lib/home/application/menu/menu_bloc.freezed.dart
@@ -26,8 +26,10 @@ class _$MenuEventTearOff {
);
}
- _CreateApp createApp() {
- return const _CreateApp();
+ _CreateApp createApp(String appName) {
+ return _CreateApp(
+ appName,
+ );
}
}
@@ -40,14 +42,14 @@ mixin _$MenuEvent {
TResult when({
required TResult Function() collapse,
required TResult Function(PageContext context) openPage,
- required TResult Function() createApp,
+ required TResult Function(String appName) createApp,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen({
TResult Function()? collapse,
TResult Function(PageContext context)? openPage,
- TResult Function()? createApp,
+ TResult Function(String appName)? createApp,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@@ -122,7 +124,7 @@ class _$Collapse implements Collapse {
TResult when({
required TResult Function() collapse,
required TResult Function(PageContext context) openPage,
- required TResult Function() createApp,
+ required TResult Function(String appName) createApp,
}) {
return collapse();
}
@@ -132,7 +134,7 @@ class _$Collapse implements Collapse {
TResult maybeWhen({
TResult Function()? collapse,
TResult Function(PageContext context)? openPage,
- TResult Function()? createApp,
+ TResult Function(String appName)? createApp,
required TResult orElse(),
}) {
if (collapse != null) {
@@ -234,7 +236,7 @@ class _$_OpenPage implements _OpenPage {
TResult when({
required TResult Function() collapse,
required TResult Function(PageContext context) openPage,
- required TResult Function() createApp,
+ required TResult Function(String appName) createApp,
}) {
return openPage(context);
}
@@ -244,7 +246,7 @@ class _$_OpenPage implements _OpenPage {
TResult maybeWhen({
TResult Function()? collapse,
TResult Function(PageContext context)? openPage,
- TResult Function()? createApp,
+ TResult Function(String appName)? createApp,
required TResult orElse(),
}) {
if (openPage != null) {
@@ -292,6 +294,7 @@ abstract class _$CreateAppCopyWith<$Res> {
factory _$CreateAppCopyWith(
_CreateApp value, $Res Function(_CreateApp) then) =
__$CreateAppCopyWithImpl<$Res>;
+ $Res call({String appName});
}
/// @nodoc
@@ -302,34 +305,58 @@ class __$CreateAppCopyWithImpl<$Res> extends _$MenuEventCopyWithImpl<$Res>
@override
_CreateApp get _value => super._value as _CreateApp;
+
+ @override
+ $Res call({
+ Object? appName = freezed,
+ }) {
+ return _then(_CreateApp(
+ appName == freezed
+ ? _value.appName
+ : appName // ignore: cast_nullable_to_non_nullable
+ as String,
+ ));
+ }
}
/// @nodoc
class _$_CreateApp implements _CreateApp {
- const _$_CreateApp();
+ const _$_CreateApp(this.appName);
+
+ @override
+ final String appName;
@override
String toString() {
- return 'MenuEvent.createApp()';
+ return 'MenuEvent.createApp(appName: $appName)';
}
@override
bool operator ==(dynamic other) {
- return identical(this, other) || (other is _CreateApp);
+ return identical(this, other) ||
+ (other is _CreateApp &&
+ (identical(other.appName, appName) ||
+ const DeepCollectionEquality().equals(other.appName, appName)));
}
@override
- int get hashCode => runtimeType.hashCode;
+ int get hashCode =>
+ runtimeType.hashCode ^ const DeepCollectionEquality().hash(appName);
+
+ @JsonKey(ignore: true)
+ @override
+ _$CreateAppCopyWith<_CreateApp> get copyWith =>
+ __$CreateAppCopyWithImpl<_CreateApp>(this, _$identity);
@override
@optionalTypeArgs
TResult when({
required TResult Function() collapse,
required TResult Function(PageContext context) openPage,
- required TResult Function() createApp,
+ required TResult Function(String appName) createApp,
}) {
- return createApp();
+ return createApp(appName);
}
@override
@@ -337,11 +364,11 @@ class _$_CreateApp implements _CreateApp {
TResult maybeWhen({
TResult Function()? collapse,
TResult Function(PageContext context)? openPage,
- TResult Function()? createApp,
+ TResult Function(String appName)? createApp,
required TResult orElse(),
}) {
if (createApp != null) {
- return createApp();
+ return createApp(appName);
}
return orElse();
}
@@ -372,7 +399,12 @@ class _$_CreateApp implements _CreateApp {
}
abstract class _CreateApp implements MenuEvent {
- const factory _CreateApp() = _$_CreateApp;
+ const factory _CreateApp(String appName) = _$_CreateApp;
+
+ String get appName => throw _privateConstructorUsedError;
+ @JsonKey(ignore: true)
+ _$CreateAppCopyWith<_CreateApp> get copyWith =>
+ throw _privateConstructorUsedError;
}
/// @nodoc
diff --git a/app_flowy/lib/home/application/menu/menu_event.dart b/app_flowy/lib/home/application/menu/menu_event.dart
index a187022b9a..fabde31bd3 100644
--- a/app_flowy/lib/home/application/menu/menu_event.dart
+++ b/app_flowy/lib/home/application/menu/menu_event.dart
@@ -4,5 +4,5 @@ part of 'menu_bloc.dart';
abstract class MenuEvent with _$MenuEvent {
const factory MenuEvent.collapse() = Collapse;
const factory MenuEvent.openPage(PageContext context) = _OpenPage;
- const factory MenuEvent.createApp() = _CreateApp;
+ const factory MenuEvent.createApp(String appName) = _CreateApp;
}
diff --git a/app_flowy/lib/home/presentation/home_layout.dart b/app_flowy/lib/home/presentation/home_layout.dart
index 567d212dcc..46cf1ea333 100644
--- a/app_flowy/lib/home/presentation/home_layout.dart
+++ b/app_flowy/lib/home/presentation/home_layout.dart
@@ -17,7 +17,8 @@ class HomeLayout {
late double homePageROffset;
late Duration animDuration;
- HomeLayout(BuildContext context, BoxConstraints homeScreenConstraint) {
+ HomeLayout(BuildContext context, BoxConstraints homeScreenConstraint,
+ bool forceCollapse) {
final homeBlocState = context.read().state;
showEditPannel = homeBlocState.editContext.isSome();
@@ -27,12 +28,11 @@ class HomeLayout {
menuWidth = Sizes.sideBarLg;
}
- // if (menuBlocState.isCollapse) {
- // showMenu = false;
- // } else {
- // showMenu = context.widthPx > PageBreaks.TabletPortrait;
- // }
- showMenu = context.widthPx > PageBreaks.tabletPortrait;
+ if (forceCollapse) {
+ showMenu = false;
+ } else {
+ showMenu = context.widthPx > PageBreaks.tabletPortrait;
+ }
homePageLOffset = showMenu ? menuWidth : 0.0;
animDuration = .35.seconds;
diff --git a/app_flowy/lib/home/presentation/home_screen.dart b/app_flowy/lib/home/presentation/home_screen.dart
index b31ce4a174..23307b5a39 100644
--- a/app_flowy/lib/home/presentation/home_screen.dart
+++ b/app_flowy/lib/home/presentation/home_screen.dart
@@ -29,10 +29,12 @@ class HomeScreen extends StatelessWidget {
child: Scaffold(
key: HomeScreen.scaffoldKey,
body: BlocBuilder(
+ buildWhen: (previous, current) => previous != current,
builder: (context, state) {
return StyledContainer(
Theme.of(context).colorScheme.background,
- child: _buildBody(state),
+ child: _buildBody(
+ state, context.read().state.forceCollapse),
);
},
),
@@ -40,10 +42,10 @@ class HomeScreen extends StatelessWidget {
);
}
- Widget _buildBody(HomeState state) {
+ Widget _buildBody(HomeState state, bool forceCollapse) {
return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
- final layout = HomeLayout(context, constraints);
+ final layout = HomeLayout(context, constraints, forceCollapse);
const homePage = HomePage();
final menu = _buildHomeMenu(
layout: layout,
@@ -76,7 +78,7 @@ class HomeScreen extends StatelessWidget {
);
},
isCollapseChanged: (isCollapse) {
- homeBloc.add(HomeEvent.showMenu(!isCollapse));
+ homeBloc.add(HomeEvent.forceCollapse(isCollapse));
},
);
homeMenu = RepaintBoundary(child: homeMenu);
diff --git a/app_flowy/lib/home/presentation/widgets/menu/home_menu.dart b/app_flowy/lib/home/presentation/widgets/menu/home_menu.dart
index b233128131..d92e4436ec 100644
--- a/app_flowy/lib/home/presentation/widgets/menu/home_menu.dart
+++ b/app_flowy/lib/home/presentation/widgets/menu/home_menu.dart
@@ -1,12 +1,20 @@
import 'package:app_flowy/home/application/menu/menu_bloc.dart';
import 'package:app_flowy/home/domain/page_context.dart';
import 'package:app_flowy/startup/startup.dart';
+import 'package:app_flowy/startup/tasks/app_widget_task.dart';
import 'package:dartz/dartz.dart';
import 'package:flowy_infra/size.dart';
+import 'package:flowy_infra/text_style.dart';
+import 'package:flowy_infra/theme.dart';
+import 'package:flowy_infra_ui/style_widget/styled_text_input.dart';
+import 'package:flowy_infra_ui/widget/buttons/ok_cancel_button.dart';
+import 'package:flowy_infra_ui/widget/dialog/styled_dialogs.dart';
+import 'package:flowy_infra_ui/widget/spacing.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../home_sizes.dart';
import 'package:styled_widget/styled_widget.dart';
+import 'package:textstyle_extensions/textstyle_extensions.dart';
class HomeMenu extends StatelessWidget {
final Function(Option) pageContextChanged;
@@ -20,41 +28,41 @@ class HomeMenu extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return MultiBlocProvider(
- providers: [
- BlocProvider(create: (context) => getIt()),
- ],
- child: MultiBlocListener(
- listeners: bind(),
- child: Container(
- color: Theme.of(context).colorScheme.primaryVariant,
- child: Padding(
- padding: EdgeInsets.symmetric(horizontal: Insets.sm),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- const MenuTopBar(),
- Container(),
- const NewAppButton(),
- ],
- ),
- ),
+ return BlocProvider(
+ create: (context) => getIt(),
+ child: MultiBlocListener(
+ listeners: [
+ BlocListener(
+ listenWhen: (p, c) => p.pageContext != c.pageContext,
+ listener: (context, state) => pageContextChanged(state.pageContext),
),
- ));
+ BlocListener(
+ listenWhen: (p, c) => p.isCollapse != c.isCollapse,
+ listener: (context, state) => isCollapseChanged(state.isCollapse),
+ )
+ ],
+ child: BlocBuilder(
+ builder: (context, state) => _renderBody(context),
+ ),
+ ),
+ );
}
- // bind the function passed by ooutter with the bloc listener
- List> bind() {
- return [
- BlocListener(
- listenWhen: (p, c) => p.pageContext != c.pageContext,
- listener: (context, state) => pageContextChanged(state.pageContext),
- ),
- BlocListener(
- listenWhen: (p, c) => p.isCollapse != c.isCollapse,
- listener: (context, state) => isCollapseChanged(state.isCollapse),
- )
- ];
+ Widget _renderBody(BuildContext context) {
+ return Container(
+ color: Theme.of(context).colorScheme.primaryVariant,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ const MenuTopBar(),
+ Expanded(child: Container()),
+ NewAppButton(
+ createAppCallback: (appName) =>
+ context.read().add(MenuEvent.createApp(appName)),
+ ),
+ ],
+ ).padding(horizontal: Insets.sm),
+ );
}
}
@@ -87,7 +95,9 @@ class MenuTopBar extends StatelessWidget {
}
class NewAppButton extends StatelessWidget {
- const NewAppButton({Key? key}) : super(key: key);
+ final Function(String)? createAppCallback;
+
+ const NewAppButton({this.createAppCallback, Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return SizedBox(
@@ -100,22 +110,82 @@ class NewAppButton extends StatelessWidget {
width: 10,
),
TextButton(
- onPressed: () async {
- // Dialogs.show(OkCancelDialog(
- // title: "No Connection",
- // message:
- // "It appears your device is offline. Please check your connection and try again.",
- // onOkPressed: () => AppGlobals.nav.pop(),
- // ));
- },
- child: const Text('New App',
- style: TextStyle(
- color: Colors.black,
- fontWeight: FontWeight.bold,
- fontSize: 20)),
+ onPressed: () async => await _showCreateAppDialog(context),
+ child: _buttonTitle(),
)
],
),
);
}
+
+ Widget _buttonTitle() {
+ return const Text('New App',
+ style: TextStyle(
+ color: Colors.black,
+ fontWeight: FontWeight.bold,
+ fontSize: 20,
+ ));
+ }
+
+ Future _showCreateAppDialog(BuildContext context) async {
+ await Dialogs.showWithContext(CreateAppDialogContext(
+ confirm: (appName) {
+ if (appName.isNotEmpty && createAppCallback != null) {
+ createAppCallback!(appName);
+ }
+ },
+ ), context);
+ }
+}
+
+//ignore: must_be_immutable
+class CreateAppDialogContext extends DialogContext {
+ String appName;
+ final Function(String)? confirm;
+
+ CreateAppDialogContext({this.appName = "", this.confirm})
+ : super(identifier: 'CreateAppDialogContext');
+
+ @override
+ Widget buildWiget(BuildContext context) {
+ final theme = context.watch();
+ return StyledDialog(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ ...[
+ Text('Create App'.toUpperCase(),
+ style: TextStyles.T1.textColor(theme.accent1Darker)),
+ VSpace(Insets.sm * 1.5),
+ // Container(color: theme.greyWeak.withOpacity(.35), height: 1),
+ VSpace(Insets.m * 1.5),
+ ],
+ StyledFormTextInput(
+ hintText: "App name",
+ onChanged: (text) {
+ appName = text;
+ },
+ ),
+ SizedBox(height: Insets.l),
+ OkCancelButton(
+ onOkPressed: () {
+ if (confirm != null) {
+ confirm!(appName);
+ AppGlobals.nav.pop();
+ }
+ },
+ onCancelPressed: () {
+ AppGlobals.nav.pop();
+ },
+ )
+ ],
+ ),
+ );
+ }
+
+ @override
+ List