[flutter]: solve conflicts

This commit is contained in:
annie 2021-11-10 21:31:36 +08:00
commit 57ba7d4d4d
60 changed files with 8144 additions and 393 deletions

122
README.md
View File

@ -1,23 +1,121 @@
[![Version](https://img.shields.io/badge/rustc-1.46+-ab6000.svg)](https://blog.rust-lang.org/2020/03/12/Rust-1.46.html)
![Apache 2.0 licensed](https://img.shields.io/crates/l/actix-web.svg)
<h1 align="center" style="border-bottom: none">
<b>
<a href="https://www.appflowy.io">AppFlowy.IO</a><br>
</b>
⭐️ The Open Source Notion Alternative ⭐️ <br>
</h1>
<p align="center">
You are in charge of your data and customizations.
</p>
# what is AppFlowy?
<div align="center">
![GitHub stars](https://img.shields.io/github/stars/{AppFlowy-IO}/{appflowy}.svg)
## Features
</div>
## Documentation
<p align="center">
<a href="http://www.appflowy.io"><b>Website</b></a>
<a href="https://discord.gg/9Q2xaN37tV"><b>Discord</b></a>
<a href="https://twitter.com/appflowy"><b>Twitter</b></a>
</p>
* [**Getting Started**](doc/GETTING_STARTED.md)
* [**Roadmap**](doc/ROADMAP.md)
* [**Deep Dive AppFlowy**](doc/APPFLOWY_SYSTEM_DESIGN.md)
<p align="center"><img src="" alt="The Open Source Notion Alternative." width="1000px" /></p>
## Built With
* [Flutter](https://flutter.dev/)
* [Rust](https://www.rust-lang.org/)
## Stay Up-to-Date
GIF (how to star)
## Getting Started
To get a local copy up and running, please follow these simple steps.
Development environment setup:
**Step 1:**
* git clone [https://github.com/AppFlowy-IO/appflowy.git](https://github.com/AppFlowy-IO/appflowy.git)
**Step 2:**
- `cd appflowy`
- `make install_rust`
> skip if you already installed it
>
- `make nstall_cargo_make`
> AppFlowy uses [https://github.com/sagiegurari/cargo-make](https://github.com/sagiegurari/cargo-make) to construct the build scripts
>
- `cargo make flowy_dev`
> It's located at xxx/appflowy/scripts/makefile/env.toml. `flowy_dev` consists of three tasks:
> * `install_targets`
> * `install_diesel`
> * `install_protobuf`
**Step 3:**
* Follow the instructions [here](https://flutter.dev/docs/get-started/install) to install Flutter. As AppFlowy uses the `dev` channel, you need to switch the channel. Just type:
`flutter channel dev`
**Step 4:**
* Open the `app_flowy` folder located at xx/appflowy/app_flowy with Visual Studio or other IDEs at your disposal
* Go to the Run and Debug tab and then click the run button.
![Run the project](https://github.com/AppFlowy-IO/appflowy/blob/main/doc/imgs/run.png)
## Roadmap
[AppFlowy Roadmap](https://trello.com/b/NCyXCXXh/appflowy-roadmap)
If you'd like to propose a feature, submit an issue [here](https://github.com/AppFlowy-IO/appflowy/issues)
## **Releases**
Please see the [changelog](https://www.appflowy.io/whatsnew) for more details about a given release.
## Contributing
Read the [Contributing Doc](doc/CONTRIBUTING.md) before you want to contribute.
## Social Media
* Slack (to be determined)
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**. Please look at [CONTRIBUTING.md](https://github.com/AppFlowy-IO/appflowy/blob/main/doc/CONTRIBUTING.md) for details.
## Why Are We Building This?
Notion has been our favorite project and knowledge management tool in recent years because of its aesthetic appeal and functionality. Our team uses it daily, and we are on its paid plan. However, as we all know Notion has its limitations. These include weak data security and poor compatibility with mobile devices. Likewise, alternative collaborative workplace management tools also have their constraints.
The limitations we encountered using these tools rooted in our past work experience with collaborative productivity tools lead to our firm belief that there is, and will be a glass ceiling on what's possible in the future for tools like Notion. This emanates from these tools probable struggles to scale horizontally at some point. It implies that they will likely be forced to prioritize for a proportion of customers whose needs can be quite different from the rest. While decision-makers want a workplace OS, the truth is that it is not very possible to come up with a one-size fits all solution in such a fragmented market.
When a customer's evolving core needs are not satisfied, they either switch to another or build one from the ground up, in-house. Consequently, they either go under another ceiling or buy an expensive ticket to learn a hard lesson. This is a requirement for many resources and expertise, building a reliable and easy-to-use collaborative tool, not to mention the speed and native experience. The same may apply to individual users as well.
All these restrictions necessitate our mission - to make it possible for anyone to create apps that suit their needs well.
- To individuals, we would like to offer Notion's functionality along with data security and cross-platform native experience.
- To enterprises and hackers, AppFlowy is dedicated to offering building blocks, that is, collaboration infra services to enable you to make apps on your own. Moreover, you have 100% control of your data. You can design and modify AppFlowy your way, with a single codebase written in Flutter and Rust supporting multiple platforms armed with long-term maintainability.
We decided to achieve this mission by upholding the three most fundamental values:
- Data privacy first
- Reliable native experience
- Community-driven extensibility
To be honest, we do not claim to outperform Notion in terms of functionality and design, at least for now. Besides, our priority doesn't lie in more functionality at the moment. Instead, we would like to cultivate a community to democratize the knowledge and wheels of making complex workplace management tools, while enabling people and businesses to create beautiful things on their own by equipping them with a versatile toolbox of building blocks.
## License
AppFlowy is under the Apache 2.0 license. See the [LICENSE](/LICENSE) file for details.
Distributed under the AGPLv3 License. See `LICENSE.md` for more information.
## Acknowledgements
Special thanks to these amazing projects which help power AppFlowy.IO:
- [flutter-quill](https://github.com/singerdmx/flutter-quill)

View File

@ -33,7 +33,7 @@ class ApplicationWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
const ratio = 1.73;
const minWidth = 1200.0;
const minWidth = 800.0;
setWindowMinSize(const Size(minWidth, minWidth / ratio));
// const launchWidth = 1310.0;
// setWindowFrame(const Rect.fromLTWH(0, 0, launchWidth, launchWidth / ratio));

View File

@ -1,3 +1,4 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
@ -46,6 +47,13 @@ mixin _$SignInEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? signedInWithUserEmailAndPassword,
TResult Function(String email)? emailChanged,
TResult Function(String password)? passwordChanged,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? signedInWithUserEmailAndPassword,
TResult Function(String email)? emailChanged,
@ -62,6 +70,14 @@ mixin _$SignInEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(SignedInWithUserEmailAndPassword value)?
signedInWithUserEmailAndPassword,
TResult Function(EmailChanged value)? emailChanged,
TResult Function(PasswordChanged value)? passwordChanged,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(SignedInWithUserEmailAndPassword value)?
signedInWithUserEmailAndPassword,
@ -140,6 +156,16 @@ class _$SignedInWithUserEmailAndPassword
return signedInWithUserEmailAndPassword();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? signedInWithUserEmailAndPassword,
TResult Function(String email)? emailChanged,
TResult Function(String password)? passwordChanged,
}) {
return signedInWithUserEmailAndPassword?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -165,6 +191,17 @@ class _$SignedInWithUserEmailAndPassword
return signedInWithUserEmailAndPassword(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(SignedInWithUserEmailAndPassword value)?
signedInWithUserEmailAndPassword,
TResult Function(EmailChanged value)? emailChanged,
TResult Function(PasswordChanged value)? passwordChanged,
}) {
return signedInWithUserEmailAndPassword?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -257,6 +294,16 @@ class _$EmailChanged implements EmailChanged {
return emailChanged(email);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? signedInWithUserEmailAndPassword,
TResult Function(String email)? emailChanged,
TResult Function(String password)? passwordChanged,
}) {
return emailChanged?.call(email);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -282,6 +329,17 @@ class _$EmailChanged implements EmailChanged {
return emailChanged(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(SignedInWithUserEmailAndPassword value)?
signedInWithUserEmailAndPassword,
TResult Function(EmailChanged value)? emailChanged,
TResult Function(PasswordChanged value)? passwordChanged,
}) {
return emailChanged?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -380,6 +438,16 @@ class _$PasswordChanged implements PasswordChanged {
return passwordChanged(password);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? signedInWithUserEmailAndPassword,
TResult Function(String email)? emailChanged,
TResult Function(String password)? passwordChanged,
}) {
return passwordChanged?.call(password);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -405,6 +473,17 @@ class _$PasswordChanged implements PasswordChanged {
return passwordChanged(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(SignedInWithUserEmailAndPassword value)?
signedInWithUserEmailAndPassword,
TResult Function(EmailChanged value)? emailChanged,
TResult Function(PasswordChanged value)? passwordChanged,
}) {
return passwordChanged?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({

View File

@ -1,3 +1,4 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
@ -53,6 +54,14 @@ mixin _$SignUpEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? signUpWithUserEmailAndPassword,
TResult Function(String email)? emailChanged,
TResult Function(String password)? passwordChanged,
TResult Function(String password)? repeatPasswordChanged,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? signUpWithUserEmailAndPassword,
TResult Function(String email)? emailChanged,
@ -72,6 +81,15 @@ mixin _$SignUpEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(SignUpWithUserEmailAndPassword value)?
signUpWithUserEmailAndPassword,
TResult Function(EmailChanged value)? emailChanged,
TResult Function(PasswordChanged value)? passwordChanged,
TResult Function(RepeatPasswordChanged value)? repeatPasswordChanged,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(SignUpWithUserEmailAndPassword value)?
signUpWithUserEmailAndPassword,
@ -151,6 +169,17 @@ class _$SignUpWithUserEmailAndPassword
return signUpWithUserEmailAndPassword();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? signUpWithUserEmailAndPassword,
TResult Function(String email)? emailChanged,
TResult Function(String password)? passwordChanged,
TResult Function(String password)? repeatPasswordChanged,
}) {
return signUpWithUserEmailAndPassword?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -179,6 +208,18 @@ class _$SignUpWithUserEmailAndPassword
return signUpWithUserEmailAndPassword(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(SignUpWithUserEmailAndPassword value)?
signUpWithUserEmailAndPassword,
TResult Function(EmailChanged value)? emailChanged,
TResult Function(PasswordChanged value)? passwordChanged,
TResult Function(RepeatPasswordChanged value)? repeatPasswordChanged,
}) {
return signUpWithUserEmailAndPassword?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -273,6 +314,17 @@ class _$EmailChanged implements EmailChanged {
return emailChanged(email);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? signUpWithUserEmailAndPassword,
TResult Function(String email)? emailChanged,
TResult Function(String password)? passwordChanged,
TResult Function(String password)? repeatPasswordChanged,
}) {
return emailChanged?.call(email);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -301,6 +353,18 @@ class _$EmailChanged implements EmailChanged {
return emailChanged(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(SignUpWithUserEmailAndPassword value)?
signUpWithUserEmailAndPassword,
TResult Function(EmailChanged value)? emailChanged,
TResult Function(PasswordChanged value)? passwordChanged,
TResult Function(RepeatPasswordChanged value)? repeatPasswordChanged,
}) {
return emailChanged?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -401,6 +465,17 @@ class _$PasswordChanged implements PasswordChanged {
return passwordChanged(password);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? signUpWithUserEmailAndPassword,
TResult Function(String email)? emailChanged,
TResult Function(String password)? passwordChanged,
TResult Function(String password)? repeatPasswordChanged,
}) {
return passwordChanged?.call(password);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -429,6 +504,18 @@ class _$PasswordChanged implements PasswordChanged {
return passwordChanged(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(SignUpWithUserEmailAndPassword value)?
signUpWithUserEmailAndPassword,
TResult Function(EmailChanged value)? emailChanged,
TResult Function(PasswordChanged value)? passwordChanged,
TResult Function(RepeatPasswordChanged value)? repeatPasswordChanged,
}) {
return passwordChanged?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -530,6 +617,17 @@ class _$RepeatPasswordChanged implements RepeatPasswordChanged {
return repeatPasswordChanged(password);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? signUpWithUserEmailAndPassword,
TResult Function(String email)? emailChanged,
TResult Function(String password)? passwordChanged,
TResult Function(String password)? repeatPasswordChanged,
}) {
return repeatPasswordChanged?.call(password);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -558,6 +656,18 @@ class _$RepeatPasswordChanged implements RepeatPasswordChanged {
return repeatPasswordChanged(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(SignUpWithUserEmailAndPassword value)?
signUpWithUserEmailAndPassword,
TResult Function(EmailChanged value)? emailChanged,
TResult Function(PasswordChanged value)? passwordChanged,
TResult Function(RepeatPasswordChanged value)? repeatPasswordChanged,
}) {
return repeatPasswordChanged?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({

View File

@ -1,3 +1,4 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
@ -32,6 +33,11 @@ mixin _$SplashEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? getUser,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? getUser,
required TResult orElse(),
@ -43,6 +49,11 @@ mixin _$SplashEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_GetUser value)? getUser,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_GetUser value)? getUser,
required TResult orElse(),
@ -108,6 +119,14 @@ class _$_GetUser implements _GetUser {
return getUser();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? getUser,
}) {
return getUser?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -128,6 +147,14 @@ class _$_GetUser implements _GetUser {
return getUser(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_GetUser value)? getUser,
}) {
return getUser?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({

View File

@ -1,3 +1,4 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
@ -46,6 +47,13 @@ mixin _$AuthState {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function(UserProfile userProfile)? authenticated,
TResult Function(UserError error)? unauthenticated,
TResult Function()? initial,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(UserProfile userProfile)? authenticated,
TResult Function(UserError error)? unauthenticated,
@ -61,6 +69,13 @@ mixin _$AuthState {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Authenticated value)? authenticated,
TResult Function(Unauthenticated value)? unauthenticated,
TResult Function(_Initial value)? initial,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(Authenticated value)? authenticated,
TResult Function(Unauthenticated value)? unauthenticated,
@ -157,6 +172,16 @@ class _$Authenticated implements Authenticated {
return authenticated(userProfile);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function(UserProfile userProfile)? authenticated,
TResult Function(UserError error)? unauthenticated,
TResult Function()? initial,
}) {
return authenticated?.call(userProfile);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -181,6 +206,16 @@ class _$Authenticated implements Authenticated {
return authenticated(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Authenticated value)? authenticated,
TResult Function(Unauthenticated value)? unauthenticated,
TResult Function(_Initial value)? initial,
}) {
return authenticated?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -276,6 +311,16 @@ class _$Unauthenticated implements Unauthenticated {
return unauthenticated(error);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function(UserProfile userProfile)? authenticated,
TResult Function(UserError error)? unauthenticated,
TResult Function()? initial,
}) {
return unauthenticated?.call(error);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -300,6 +345,16 @@ class _$Unauthenticated implements Unauthenticated {
return unauthenticated(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Authenticated value)? authenticated,
TResult Function(Unauthenticated value)? unauthenticated,
TResult Function(_Initial value)? initial,
}) {
return unauthenticated?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -368,6 +423,16 @@ class _$_Initial implements _Initial {
return initial();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function(UserProfile userProfile)? authenticated,
TResult Function(UserError error)? unauthenticated,
TResult Function()? initial,
}) {
return initial?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -392,6 +457,16 @@ class _$_Initial implements _Initial {
return initial(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Authenticated value)? authenticated,
TResult Function(Unauthenticated value)? unauthenticated,
TResult Function(_Initial value)? initial,
}) {
return initial?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({

View File

@ -1,3 +1,4 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
@ -68,6 +69,16 @@ mixin _$AppEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(String name, String desc, ViewType viewType)? createView,
TResult Function()? delete,
TResult Function(String newName)? rename,
TResult Function(List<View> views)? didReceiveViews,
TResult Function(App app)? appDidUpdate,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function(String name, String desc, ViewType viewType)? createView,
@ -89,6 +100,16 @@ mixin _$AppEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(CreateView value)? createView,
TResult Function(Delete value)? delete,
TResult Function(Rename value)? rename,
TResult Function(ReceiveViews value)? didReceiveViews,
TResult Function(AppDidUpdate value)? appDidUpdate,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(CreateView value)? createView,
@ -164,6 +185,19 @@ class _$Initial implements Initial {
return initial();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(String name, String desc, ViewType viewType)? createView,
TResult Function()? delete,
TResult Function(String newName)? rename,
TResult Function(List<View> views)? didReceiveViews,
TResult Function(App app)? appDidUpdate,
}) {
return initial?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -194,6 +228,19 @@ class _$Initial implements Initial {
return initial(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(CreateView value)? createView,
TResult Function(Delete value)? delete,
TResult Function(Rename value)? rename,
TResult Function(ReceiveViews value)? didReceiveViews,
TResult Function(AppDidUpdate value)? appDidUpdate,
}) {
return initial?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -312,6 +359,19 @@ class _$CreateView implements CreateView {
return createView(name, desc, viewType);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(String name, String desc, ViewType viewType)? createView,
TResult Function()? delete,
TResult Function(String newName)? rename,
TResult Function(List<View> views)? didReceiveViews,
TResult Function(App app)? appDidUpdate,
}) {
return createView?.call(name, desc, viewType);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -342,6 +402,19 @@ class _$CreateView implements CreateView {
return createView(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(CreateView value)? createView,
TResult Function(Delete value)? delete,
TResult Function(Rename value)? rename,
TResult Function(ReceiveViews value)? didReceiveViews,
TResult Function(AppDidUpdate value)? appDidUpdate,
}) {
return createView?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -420,6 +493,19 @@ class _$Delete implements Delete {
return delete();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(String name, String desc, ViewType viewType)? createView,
TResult Function()? delete,
TResult Function(String newName)? rename,
TResult Function(List<View> views)? didReceiveViews,
TResult Function(App app)? appDidUpdate,
}) {
return delete?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -450,6 +536,19 @@ class _$Delete implements Delete {
return delete(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(CreateView value)? createView,
TResult Function(Delete value)? delete,
TResult Function(Rename value)? rename,
TResult Function(ReceiveViews value)? didReceiveViews,
TResult Function(AppDidUpdate value)? appDidUpdate,
}) {
return delete?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -545,6 +644,19 @@ class _$Rename implements Rename {
return rename(newName);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(String name, String desc, ViewType viewType)? createView,
TResult Function()? delete,
TResult Function(String newName)? rename,
TResult Function(List<View> views)? didReceiveViews,
TResult Function(App app)? appDidUpdate,
}) {
return rename?.call(newName);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -575,6 +687,19 @@ class _$Rename implements Rename {
return rename(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(CreateView value)? createView,
TResult Function(Delete value)? delete,
TResult Function(Rename value)? rename,
TResult Function(ReceiveViews value)? didReceiveViews,
TResult Function(AppDidUpdate value)? appDidUpdate,
}) {
return rename?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -676,6 +801,19 @@ class _$ReceiveViews implements ReceiveViews {
return didReceiveViews(views);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(String name, String desc, ViewType viewType)? createView,
TResult Function()? delete,
TResult Function(String newName)? rename,
TResult Function(List<View> views)? didReceiveViews,
TResult Function(App app)? appDidUpdate,
}) {
return didReceiveViews?.call(views);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -706,6 +844,19 @@ class _$ReceiveViews implements ReceiveViews {
return didReceiveViews(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(CreateView value)? createView,
TResult Function(Delete value)? delete,
TResult Function(Rename value)? rename,
TResult Function(ReceiveViews value)? didReceiveViews,
TResult Function(AppDidUpdate value)? appDidUpdate,
}) {
return didReceiveViews?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -808,6 +959,19 @@ class _$AppDidUpdate implements AppDidUpdate {
return appDidUpdate(app);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(String name, String desc, ViewType viewType)? createView,
TResult Function()? delete,
TResult Function(String newName)? rename,
TResult Function(List<View> views)? didReceiveViews,
TResult Function(App app)? appDidUpdate,
}) {
return appDidUpdate?.call(app);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -838,6 +1002,19 @@ class _$AppDidUpdate implements AppDidUpdate {
return appDidUpdate(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(CreateView value)? createView,
TResult Function(Delete value)? delete,
TResult Function(Rename value)? rename,
TResult Function(ReceiveViews value)? didReceiveViews,
TResult Function(AppDidUpdate value)? appDidUpdate,
}) {
return appDidUpdate?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({

View File

@ -1,3 +1,4 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
@ -52,6 +53,15 @@ mixin _$DocEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? deleted,
TResult Function()? restore,
TResult Function()? restorePage,
TResult Function()? deletePermanently,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? deleted,
@ -71,6 +81,15 @@ mixin _$DocEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(Deleted value)? deleted,
TResult Function(Restore value)? restore,
TResult Function(RestorePage value)? restorePage,
TResult Function(DeletePermanently value)? deletePermanently,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(Deleted value)? deleted,
@ -143,6 +162,18 @@ class _$Initial implements Initial {
return initial();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? deleted,
TResult Function()? restore,
TResult Function()? restorePage,
TResult Function()? deletePermanently,
}) {
return initial?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -171,6 +202,18 @@ class _$Initial implements Initial {
return initial(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(Deleted value)? deleted,
TResult Function(Restore value)? restore,
TResult Function(RestorePage value)? restorePage,
TResult Function(DeletePermanently value)? deletePermanently,
}) {
return initial?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -238,6 +281,18 @@ class _$Deleted implements Deleted {
return deleted();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? deleted,
TResult Function()? restore,
TResult Function()? restorePage,
TResult Function()? deletePermanently,
}) {
return deleted?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -266,6 +321,18 @@ class _$Deleted implements Deleted {
return deleted(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(Deleted value)? deleted,
TResult Function(Restore value)? restore,
TResult Function(RestorePage value)? restorePage,
TResult Function(DeletePermanently value)? deletePermanently,
}) {
return deleted?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -333,6 +400,18 @@ class _$Restore implements Restore {
return restore();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? deleted,
TResult Function()? restore,
TResult Function()? restorePage,
TResult Function()? deletePermanently,
}) {
return restore?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -361,6 +440,18 @@ class _$Restore implements Restore {
return restore(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(Deleted value)? deleted,
TResult Function(Restore value)? restore,
TResult Function(RestorePage value)? restorePage,
TResult Function(DeletePermanently value)? deletePermanently,
}) {
return restore?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -430,6 +521,18 @@ class _$RestorePage implements RestorePage {
return restorePage();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? deleted,
TResult Function()? restore,
TResult Function()? restorePage,
TResult Function()? deletePermanently,
}) {
return restorePage?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -458,6 +561,18 @@ class _$RestorePage implements RestorePage {
return restorePage(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(Deleted value)? deleted,
TResult Function(Restore value)? restore,
TResult Function(RestorePage value)? restorePage,
TResult Function(DeletePermanently value)? deletePermanently,
}) {
return restorePage?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -527,6 +642,18 @@ class _$DeletePermanently implements DeletePermanently {
return deletePermanently();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? deleted,
TResult Function()? restore,
TResult Function()? restorePage,
TResult Function()? deletePermanently,
}) {
return deletePermanently?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -555,6 +682,18 @@ class _$DeletePermanently implements DeletePermanently {
return deletePermanently(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(Deleted value)? deleted,
TResult Function(Restore value)? restore,
TResult Function(RestorePage value)? restorePage,
TResult Function(DeletePermanently value)? deletePermanently,
}) {
return deletePermanently?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -790,6 +929,12 @@ mixin _$DocLoadState {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? loading,
TResult Function(Either<Unit, WorkspaceError> successOrFail)? finish,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? loading,
TResult Function(Either<Unit, WorkspaceError> successOrFail)? finish,
@ -803,6 +948,12 @@ mixin _$DocLoadState {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Loading value)? loading,
TResult Function(_Finish value)? finish,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Loading value)? loading,
TResult Function(_Finish value)? finish,
@ -871,6 +1022,15 @@ class _$_Loading implements _Loading {
return loading();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? loading,
TResult Function(Either<Unit, WorkspaceError> successOrFail)? finish,
}) {
return loading?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -893,6 +1053,15 @@ class _$_Loading implements _Loading {
return loading(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Loading value)? loading,
TResult Function(_Finish value)? finish,
}) {
return loading?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -981,6 +1150,15 @@ class _$_Finish implements _Finish {
return finish(successOrFail);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? loading,
TResult Function(Either<Unit, WorkspaceError> successOrFail)? finish,
}) {
return finish?.call(successOrFail);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -1003,6 +1181,15 @@ class _$_Finish implements _Finish {
return finish(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Loading value)? loading,
TResult Function(_Finish value)? finish,
}) {
return finish?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({

View File

@ -0,0 +1,52 @@
import 'package:app_flowy/workspace/domain/i_share.dart';
import 'package:app_flowy/workspace/infrastructure/markdown/delta_markdown.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace-infra/export.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace-infra/view_create.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:dartz/dartz.dart';
part 'share_bloc.freezed.dart';
class DocShareBloc extends Bloc<DocShareEvent, DocShareState> {
IShare shareManager;
View view;
DocShareBloc({required this.view, required this.shareManager}) : super(const DocShareState.initial()) {
on<DocShareEvent>((event, emit) async {
await event.map(
shareMarkdown: (ShareMarkdown value) async {
await shareManager.exportMarkdown(view.id).then((result) {
result.fold(
(value) => emit(DocShareState.finish(left(_convertDeltaToMarkdown(value)))),
(error) => emit(DocShareState.finish(right(error))),
);
});
emit(const DocShareState.loading());
},
shareLink: (ShareLink value) {},
shareText: (ShareText value) {},
);
});
}
ExportData _convertDeltaToMarkdown(ExportData value) {
final result = deltaToMarkdown(value.data);
value.data = result;
return value;
}
}
@freezed
class DocShareEvent with _$DocShareEvent {
const factory DocShareEvent.shareMarkdown() = ShareMarkdown;
const factory DocShareEvent.shareText() = ShareText;
const factory DocShareEvent.shareLink() = ShareLink;
}
@freezed
class DocShareState with _$DocShareState {
const factory DocShareState.initial() = _Initial;
const factory DocShareState.loading() = _Loading;
const factory DocShareState.finish(Either<ExportData, WorkspaceError> successOrFail) = _Finish;
}

View File

@ -0,0 +1,867 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
part of 'share_bloc.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
/// @nodoc
class _$DocShareEventTearOff {
const _$DocShareEventTearOff();
ShareMarkdown shareMarkdown() {
return const ShareMarkdown();
}
ShareText shareText() {
return const ShareText();
}
ShareLink shareLink() {
return const ShareLink();
}
}
/// @nodoc
const $DocShareEvent = _$DocShareEventTearOff();
/// @nodoc
mixin _$DocShareEvent {
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() shareMarkdown,
required TResult Function() shareText,
required TResult Function() shareLink,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? shareMarkdown,
TResult Function()? shareText,
TResult Function()? shareLink,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? shareMarkdown,
TResult Function()? shareText,
TResult Function()? shareLink,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(ShareMarkdown value) shareMarkdown,
required TResult Function(ShareText value) shareText,
required TResult Function(ShareLink value) shareLink,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(ShareMarkdown value)? shareMarkdown,
TResult Function(ShareText value)? shareText,
TResult Function(ShareLink value)? shareLink,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(ShareMarkdown value)? shareMarkdown,
TResult Function(ShareText value)? shareText,
TResult Function(ShareLink value)? shareLink,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $DocShareEventCopyWith<$Res> {
factory $DocShareEventCopyWith(
DocShareEvent value, $Res Function(DocShareEvent) then) =
_$DocShareEventCopyWithImpl<$Res>;
}
/// @nodoc
class _$DocShareEventCopyWithImpl<$Res>
implements $DocShareEventCopyWith<$Res> {
_$DocShareEventCopyWithImpl(this._value, this._then);
final DocShareEvent _value;
// ignore: unused_field
final $Res Function(DocShareEvent) _then;
}
/// @nodoc
abstract class $ShareMarkdownCopyWith<$Res> {
factory $ShareMarkdownCopyWith(
ShareMarkdown value, $Res Function(ShareMarkdown) then) =
_$ShareMarkdownCopyWithImpl<$Res>;
}
/// @nodoc
class _$ShareMarkdownCopyWithImpl<$Res>
extends _$DocShareEventCopyWithImpl<$Res>
implements $ShareMarkdownCopyWith<$Res> {
_$ShareMarkdownCopyWithImpl(
ShareMarkdown _value, $Res Function(ShareMarkdown) _then)
: super(_value, (v) => _then(v as ShareMarkdown));
@override
ShareMarkdown get _value => super._value as ShareMarkdown;
}
/// @nodoc
class _$ShareMarkdown implements ShareMarkdown {
const _$ShareMarkdown();
@override
String toString() {
return 'DocShareEvent.shareMarkdown()';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) || (other is ShareMarkdown);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() shareMarkdown,
required TResult Function() shareText,
required TResult Function() shareLink,
}) {
return shareMarkdown();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? shareMarkdown,
TResult Function()? shareText,
TResult Function()? shareLink,
}) {
return shareMarkdown?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? shareMarkdown,
TResult Function()? shareText,
TResult Function()? shareLink,
required TResult orElse(),
}) {
if (shareMarkdown != null) {
return shareMarkdown();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(ShareMarkdown value) shareMarkdown,
required TResult Function(ShareText value) shareText,
required TResult Function(ShareLink value) shareLink,
}) {
return shareMarkdown(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(ShareMarkdown value)? shareMarkdown,
TResult Function(ShareText value)? shareText,
TResult Function(ShareLink value)? shareLink,
}) {
return shareMarkdown?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(ShareMarkdown value)? shareMarkdown,
TResult Function(ShareText value)? shareText,
TResult Function(ShareLink value)? shareLink,
required TResult orElse(),
}) {
if (shareMarkdown != null) {
return shareMarkdown(this);
}
return orElse();
}
}
abstract class ShareMarkdown implements DocShareEvent {
const factory ShareMarkdown() = _$ShareMarkdown;
}
/// @nodoc
abstract class $ShareTextCopyWith<$Res> {
factory $ShareTextCopyWith(ShareText value, $Res Function(ShareText) then) =
_$ShareTextCopyWithImpl<$Res>;
}
/// @nodoc
class _$ShareTextCopyWithImpl<$Res> extends _$DocShareEventCopyWithImpl<$Res>
implements $ShareTextCopyWith<$Res> {
_$ShareTextCopyWithImpl(ShareText _value, $Res Function(ShareText) _then)
: super(_value, (v) => _then(v as ShareText));
@override
ShareText get _value => super._value as ShareText;
}
/// @nodoc
class _$ShareText implements ShareText {
const _$ShareText();
@override
String toString() {
return 'DocShareEvent.shareText()';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) || (other is ShareText);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() shareMarkdown,
required TResult Function() shareText,
required TResult Function() shareLink,
}) {
return shareText();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? shareMarkdown,
TResult Function()? shareText,
TResult Function()? shareLink,
}) {
return shareText?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? shareMarkdown,
TResult Function()? shareText,
TResult Function()? shareLink,
required TResult orElse(),
}) {
if (shareText != null) {
return shareText();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(ShareMarkdown value) shareMarkdown,
required TResult Function(ShareText value) shareText,
required TResult Function(ShareLink value) shareLink,
}) {
return shareText(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(ShareMarkdown value)? shareMarkdown,
TResult Function(ShareText value)? shareText,
TResult Function(ShareLink value)? shareLink,
}) {
return shareText?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(ShareMarkdown value)? shareMarkdown,
TResult Function(ShareText value)? shareText,
TResult Function(ShareLink value)? shareLink,
required TResult orElse(),
}) {
if (shareText != null) {
return shareText(this);
}
return orElse();
}
}
abstract class ShareText implements DocShareEvent {
const factory ShareText() = _$ShareText;
}
/// @nodoc
abstract class $ShareLinkCopyWith<$Res> {
factory $ShareLinkCopyWith(ShareLink value, $Res Function(ShareLink) then) =
_$ShareLinkCopyWithImpl<$Res>;
}
/// @nodoc
class _$ShareLinkCopyWithImpl<$Res> extends _$DocShareEventCopyWithImpl<$Res>
implements $ShareLinkCopyWith<$Res> {
_$ShareLinkCopyWithImpl(ShareLink _value, $Res Function(ShareLink) _then)
: super(_value, (v) => _then(v as ShareLink));
@override
ShareLink get _value => super._value as ShareLink;
}
/// @nodoc
class _$ShareLink implements ShareLink {
const _$ShareLink();
@override
String toString() {
return 'DocShareEvent.shareLink()';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) || (other is ShareLink);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() shareMarkdown,
required TResult Function() shareText,
required TResult Function() shareLink,
}) {
return shareLink();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? shareMarkdown,
TResult Function()? shareText,
TResult Function()? shareLink,
}) {
return shareLink?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? shareMarkdown,
TResult Function()? shareText,
TResult Function()? shareLink,
required TResult orElse(),
}) {
if (shareLink != null) {
return shareLink();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(ShareMarkdown value) shareMarkdown,
required TResult Function(ShareText value) shareText,
required TResult Function(ShareLink value) shareLink,
}) {
return shareLink(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(ShareMarkdown value)? shareMarkdown,
TResult Function(ShareText value)? shareText,
TResult Function(ShareLink value)? shareLink,
}) {
return shareLink?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(ShareMarkdown value)? shareMarkdown,
TResult Function(ShareText value)? shareText,
TResult Function(ShareLink value)? shareLink,
required TResult orElse(),
}) {
if (shareLink != null) {
return shareLink(this);
}
return orElse();
}
}
abstract class ShareLink implements DocShareEvent {
const factory ShareLink() = _$ShareLink;
}
/// @nodoc
class _$DocShareStateTearOff {
const _$DocShareStateTearOff();
_Initial initial() {
return const _Initial();
}
_Loading loading() {
return const _Loading();
}
_Finish finish(Either<ExportData, WorkspaceError> successOrFail) {
return _Finish(
successOrFail,
);
}
}
/// @nodoc
const $DocShareState = _$DocShareStateTearOff();
/// @nodoc
mixin _$DocShareState {
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() initial,
required TResult Function() loading,
required TResult Function(Either<ExportData, WorkspaceError> successOrFail)
finish,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? loading,
TResult Function(Either<ExportData, WorkspaceError> successOrFail)? finish,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? loading,
TResult Function(Either<ExportData, WorkspaceError> successOrFail)? finish,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Initial value) initial,
required TResult Function(_Loading value) loading,
required TResult Function(_Finish value) finish,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(_Loading value)? loading,
TResult Function(_Finish value)? finish,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(_Loading value)? loading,
TResult Function(_Finish value)? finish,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $DocShareStateCopyWith<$Res> {
factory $DocShareStateCopyWith(
DocShareState value, $Res Function(DocShareState) then) =
_$DocShareStateCopyWithImpl<$Res>;
}
/// @nodoc
class _$DocShareStateCopyWithImpl<$Res>
implements $DocShareStateCopyWith<$Res> {
_$DocShareStateCopyWithImpl(this._value, this._then);
final DocShareState _value;
// ignore: unused_field
final $Res Function(DocShareState) _then;
}
/// @nodoc
abstract class _$InitialCopyWith<$Res> {
factory _$InitialCopyWith(_Initial value, $Res Function(_Initial) then) =
__$InitialCopyWithImpl<$Res>;
}
/// @nodoc
class __$InitialCopyWithImpl<$Res> extends _$DocShareStateCopyWithImpl<$Res>
implements _$InitialCopyWith<$Res> {
__$InitialCopyWithImpl(_Initial _value, $Res Function(_Initial) _then)
: super(_value, (v) => _then(v as _Initial));
@override
_Initial get _value => super._value as _Initial;
}
/// @nodoc
class _$_Initial implements _Initial {
const _$_Initial();
@override
String toString() {
return 'DocShareState.initial()';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) || (other is _Initial);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() initial,
required TResult Function() loading,
required TResult Function(Either<ExportData, WorkspaceError> successOrFail)
finish,
}) {
return initial();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? loading,
TResult Function(Either<ExportData, WorkspaceError> successOrFail)? finish,
}) {
return initial?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? loading,
TResult Function(Either<ExportData, WorkspaceError> successOrFail)? finish,
required TResult orElse(),
}) {
if (initial != null) {
return initial();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Initial value) initial,
required TResult Function(_Loading value) loading,
required TResult Function(_Finish value) finish,
}) {
return initial(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(_Loading value)? loading,
TResult Function(_Finish value)? finish,
}) {
return initial?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(_Loading value)? loading,
TResult Function(_Finish value)? finish,
required TResult orElse(),
}) {
if (initial != null) {
return initial(this);
}
return orElse();
}
}
abstract class _Initial implements DocShareState {
const factory _Initial() = _$_Initial;
}
/// @nodoc
abstract class _$LoadingCopyWith<$Res> {
factory _$LoadingCopyWith(_Loading value, $Res Function(_Loading) then) =
__$LoadingCopyWithImpl<$Res>;
}
/// @nodoc
class __$LoadingCopyWithImpl<$Res> extends _$DocShareStateCopyWithImpl<$Res>
implements _$LoadingCopyWith<$Res> {
__$LoadingCopyWithImpl(_Loading _value, $Res Function(_Loading) _then)
: super(_value, (v) => _then(v as _Loading));
@override
_Loading get _value => super._value as _Loading;
}
/// @nodoc
class _$_Loading implements _Loading {
const _$_Loading();
@override
String toString() {
return 'DocShareState.loading()';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) || (other is _Loading);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() initial,
required TResult Function() loading,
required TResult Function(Either<ExportData, WorkspaceError> successOrFail)
finish,
}) {
return loading();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? loading,
TResult Function(Either<ExportData, WorkspaceError> successOrFail)? finish,
}) {
return loading?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? loading,
TResult Function(Either<ExportData, WorkspaceError> successOrFail)? finish,
required TResult orElse(),
}) {
if (loading != null) {
return loading();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Initial value) initial,
required TResult Function(_Loading value) loading,
required TResult Function(_Finish value) finish,
}) {
return loading(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(_Loading value)? loading,
TResult Function(_Finish value)? finish,
}) {
return loading?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(_Loading value)? loading,
TResult Function(_Finish value)? finish,
required TResult orElse(),
}) {
if (loading != null) {
return loading(this);
}
return orElse();
}
}
abstract class _Loading implements DocShareState {
const factory _Loading() = _$_Loading;
}
/// @nodoc
abstract class _$FinishCopyWith<$Res> {
factory _$FinishCopyWith(_Finish value, $Res Function(_Finish) then) =
__$FinishCopyWithImpl<$Res>;
$Res call({Either<ExportData, WorkspaceError> successOrFail});
}
/// @nodoc
class __$FinishCopyWithImpl<$Res> extends _$DocShareStateCopyWithImpl<$Res>
implements _$FinishCopyWith<$Res> {
__$FinishCopyWithImpl(_Finish _value, $Res Function(_Finish) _then)
: super(_value, (v) => _then(v as _Finish));
@override
_Finish get _value => super._value as _Finish;
@override
$Res call({
Object? successOrFail = freezed,
}) {
return _then(_Finish(
successOrFail == freezed
? _value.successOrFail
: successOrFail // ignore: cast_nullable_to_non_nullable
as Either<ExportData, WorkspaceError>,
));
}
}
/// @nodoc
class _$_Finish implements _Finish {
const _$_Finish(this.successOrFail);
@override
final Either<ExportData, WorkspaceError> successOrFail;
@override
String toString() {
return 'DocShareState.finish(successOrFail: $successOrFail)';
}
@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other is _Finish &&
(identical(other.successOrFail, successOrFail) ||
const DeepCollectionEquality()
.equals(other.successOrFail, successOrFail)));
}
@override
int get hashCode =>
runtimeType.hashCode ^ const DeepCollectionEquality().hash(successOrFail);
@JsonKey(ignore: true)
@override
_$FinishCopyWith<_Finish> get copyWith =>
__$FinishCopyWithImpl<_Finish>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() initial,
required TResult Function() loading,
required TResult Function(Either<ExportData, WorkspaceError> successOrFail)
finish,
}) {
return finish(successOrFail);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? loading,
TResult Function(Either<ExportData, WorkspaceError> successOrFail)? finish,
}) {
return finish?.call(successOrFail);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? loading,
TResult Function(Either<ExportData, WorkspaceError> successOrFail)? finish,
required TResult orElse(),
}) {
if (finish != null) {
return finish(successOrFail);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Initial value) initial,
required TResult Function(_Loading value) loading,
required TResult Function(_Finish value) finish,
}) {
return finish(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(_Loading value)? loading,
TResult Function(_Finish value)? finish,
}) {
return finish?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(_Loading value)? loading,
TResult Function(_Finish value)? finish,
required TResult orElse(),
}) {
if (finish != null) {
return finish(this);
}
return orElse();
}
}
abstract class _Finish implements DocShareState {
const factory _Finish(Either<ExportData, WorkspaceError> successOrFail) =
_$_Finish;
Either<ExportData, WorkspaceError> get successOrFail =>
throw _privateConstructorUsedError;
@JsonKey(ignore: true)
_$FinishCopyWith<_Finish> get copyWith => throw _privateConstructorUsedError;
}

View File

@ -1,3 +1,4 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
@ -43,6 +44,12 @@ mixin _$EditPannelEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function(EditPannelContext context)? startEdit,
TResult Function(EditPannelContext context)? endEdit,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(EditPannelContext context)? startEdit,
TResult Function(EditPannelContext context)? endEdit,
@ -56,6 +63,12 @@ mixin _$EditPannelEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_StartEdit value)? startEdit,
TResult Function(_EndEdit value)? endEdit,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_StartEdit value)? startEdit,
TResult Function(_EndEdit value)? endEdit,
@ -169,6 +182,15 @@ class _$_StartEdit implements _StartEdit {
return startEdit(context);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function(EditPannelContext context)? startEdit,
TResult Function(EditPannelContext context)? endEdit,
}) {
return startEdit?.call(context);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -191,6 +213,15 @@ class _$_StartEdit implements _StartEdit {
return startEdit(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_StartEdit value)? startEdit,
TResult Function(_EndEdit value)? endEdit,
}) {
return startEdit?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -286,6 +317,15 @@ class _$_EndEdit implements _EndEdit {
return endEdit(context);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function(EditPannelContext context)? startEdit,
TResult Function(EditPannelContext context)? endEdit,
}) {
return endEdit?.call(context);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -308,6 +348,15 @@ class _$_EndEdit implements _EndEdit {
return endEdit(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_StartEdit value)? startEdit,
TResult Function(_EndEdit value)? endEdit,
}) {
return endEdit?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({

View File

@ -1,3 +1,4 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
@ -53,6 +54,14 @@ mixin _$HomeEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function(bool isLoading)? showLoading,
TResult Function(bool forceCollapse)? forceCollapse,
TResult Function(EditPannelContext editContext)? setEditPannel,
TResult Function()? dismissEditPannel,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(bool isLoading)? showLoading,
TResult Function(bool forceCollapse)? forceCollapse,
@ -70,6 +79,14 @@ mixin _$HomeEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_ShowLoading value)? showLoading,
TResult Function(_ForceCollapse value)? forceCollapse,
TResult Function(_ShowEditPannel value)? setEditPannel,
TResult Function(_DismissEditPannel value)? dismissEditPannel,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_ShowLoading value)? showLoading,
TResult Function(_ForceCollapse value)? forceCollapse,
@ -168,6 +185,17 @@ class _$_ShowLoading implements _ShowLoading {
return showLoading(isLoading);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function(bool isLoading)? showLoading,
TResult Function(bool forceCollapse)? forceCollapse,
TResult Function(EditPannelContext editContext)? setEditPannel,
TResult Function()? dismissEditPannel,
}) {
return showLoading?.call(isLoading);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -194,6 +222,17 @@ class _$_ShowLoading implements _ShowLoading {
return showLoading(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_ShowLoading value)? showLoading,
TResult Function(_ForceCollapse value)? forceCollapse,
TResult Function(_ShowEditPannel value)? setEditPannel,
TResult Function(_DismissEditPannel value)? dismissEditPannel,
}) {
return showLoading?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -292,6 +331,17 @@ class _$_ForceCollapse implements _ForceCollapse {
return forceCollapse(this.forceCollapse);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function(bool isLoading)? showLoading,
TResult Function(bool forceCollapse)? forceCollapse,
TResult Function(EditPannelContext editContext)? setEditPannel,
TResult Function()? dismissEditPannel,
}) {
return forceCollapse?.call(this.forceCollapse);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -318,6 +368,17 @@ class _$_ForceCollapse implements _ForceCollapse {
return forceCollapse(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_ShowLoading value)? showLoading,
TResult Function(_ForceCollapse value)? forceCollapse,
TResult Function(_ShowEditPannel value)? setEditPannel,
TResult Function(_DismissEditPannel value)? dismissEditPannel,
}) {
return forceCollapse?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -416,6 +477,17 @@ class _$_ShowEditPannel implements _ShowEditPannel {
return setEditPannel(editContext);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function(bool isLoading)? showLoading,
TResult Function(bool forceCollapse)? forceCollapse,
TResult Function(EditPannelContext editContext)? setEditPannel,
TResult Function()? dismissEditPannel,
}) {
return setEditPannel?.call(editContext);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -442,6 +514,17 @@ class _$_ShowEditPannel implements _ShowEditPannel {
return setEditPannel(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_ShowLoading value)? showLoading,
TResult Function(_ForceCollapse value)? forceCollapse,
TResult Function(_ShowEditPannel value)? setEditPannel,
TResult Function(_DismissEditPannel value)? dismissEditPannel,
}) {
return setEditPannel?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -516,6 +599,17 @@ class _$_DismissEditPannel implements _DismissEditPannel {
return dismissEditPannel();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function(bool isLoading)? showLoading,
TResult Function(bool forceCollapse)? forceCollapse,
TResult Function(EditPannelContext editContext)? setEditPannel,
TResult Function()? dismissEditPannel,
}) {
return dismissEditPannel?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -542,6 +636,17 @@ class _$_DismissEditPannel implements _DismissEditPannel {
return dismissEditPannel(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_ShowLoading value)? showLoading,
TResult Function(_ForceCollapse value)? forceCollapse,
TResult Function(_ShowEditPannel value)? setEditPannel,
TResult Function(_DismissEditPannel value)? dismissEditPannel,
}) {
return dismissEditPannel?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({

View File

@ -1,3 +1,4 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
@ -44,6 +45,13 @@ mixin _$HomeListenEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? started,
TResult Function()? stop,
TResult Function(String msg)? unauthorized,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? started,
TResult Function()? stop,
@ -59,6 +67,13 @@ mixin _$HomeListenEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Started value)? started,
TResult Function(_Stop value)? stop,
TResult Function(_Unauthorized value)? unauthorized,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Started value)? started,
TResult Function(_Stop value)? stop,
@ -129,6 +144,16 @@ class _$_Started implements _Started {
return started();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? started,
TResult Function()? stop,
TResult Function(String msg)? unauthorized,
}) {
return started?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -153,6 +178,16 @@ class _$_Started implements _Started {
return started(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Started value)? started,
TResult Function(_Stop value)? stop,
TResult Function(_Unauthorized value)? unauthorized,
}) {
return started?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -216,6 +251,16 @@ class _$_Stop implements _Stop {
return stop();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? started,
TResult Function()? stop,
TResult Function(String msg)? unauthorized,
}) {
return stop?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -240,6 +285,16 @@ class _$_Stop implements _Stop {
return stop(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Started value)? started,
TResult Function(_Stop value)? stop,
TResult Function(_Unauthorized value)? unauthorized,
}) {
return stop?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -331,6 +386,16 @@ class _$_Unauthorized implements _Unauthorized {
return unauthorized(msg);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? started,
TResult Function()? stop,
TResult Function(String msg)? unauthorized,
}) {
return unauthorized?.call(msg);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -355,6 +420,16 @@ class _$_Unauthorized implements _Unauthorized {
return unauthorized(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Started value)? started,
TResult Function(_Stop value)? stop,
TResult Function(_Unauthorized value)? unauthorized,
}) {
return unauthorized?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -406,6 +481,12 @@ mixin _$HomeListenState {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? loading,
TResult Function(String msg)? unauthorized,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? loading,
TResult Function(String msg)? unauthorized,
@ -419,6 +500,12 @@ mixin _$HomeListenState {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Loading value)? loading,
TResult Function(Unauthorized value)? unauthorized,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(Loading value)? loading,
TResult Function(Unauthorized value)? unauthorized,
@ -487,6 +574,15 @@ class _$Loading implements Loading {
return loading();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? loading,
TResult Function(String msg)? unauthorized,
}) {
return loading?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -509,6 +605,15 @@ class _$Loading implements Loading {
return loading(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Loading value)? loading,
TResult Function(Unauthorized value)? unauthorized,
}) {
return loading?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -598,6 +703,15 @@ class _$Unauthorized implements Unauthorized {
return unauthorized(msg);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? loading,
TResult Function(String msg)? unauthorized,
}) {
return unauthorized?.call(msg);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -620,6 +734,15 @@ class _$Unauthorized implements Unauthorized {
return unauthorized(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Loading value)? loading,
TResult Function(Unauthorized value)? unauthorized,
}) {
return unauthorized?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({

View File

@ -1,3 +1,4 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
@ -61,6 +62,16 @@ mixin _$MenuEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? collapse,
TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,
TResult Function(String name, String? desc)? createApp,
TResult Function(Either<List<App>, WorkspaceError> appsOrFail)?
didReceiveApps,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? collapse,
@ -81,6 +92,15 @@ mixin _$MenuEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(Collapse value)? collapse,
TResult Function(OpenPage value)? openPage,
TResult Function(CreateApp value)? createApp,
TResult Function(ReceiveApps value)? didReceiveApps,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(Collapse value)? collapse,
@ -155,6 +175,19 @@ class _$_Initial implements _Initial {
return initial();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? collapse,
TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,
TResult Function(String name, String? desc)? createApp,
TResult Function(Either<List<App>, WorkspaceError> appsOrFail)?
didReceiveApps,
}) {
return initial?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -184,6 +217,18 @@ class _$_Initial implements _Initial {
return initial(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(Collapse value)? collapse,
TResult Function(OpenPage value)? openPage,
TResult Function(CreateApp value)? createApp,
TResult Function(ReceiveApps value)? didReceiveApps,
}) {
return initial?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -253,6 +298,19 @@ class _$Collapse implements Collapse {
return collapse();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? collapse,
TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,
TResult Function(String name, String? desc)? createApp,
TResult Function(Either<List<App>, WorkspaceError> appsOrFail)?
didReceiveApps,
}) {
return collapse?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -282,6 +340,18 @@ class _$Collapse implements Collapse {
return collapse(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(Collapse value)? collapse,
TResult Function(OpenPage value)? openPage,
TResult Function(CreateApp value)? createApp,
TResult Function(ReceiveApps value)? didReceiveApps,
}) {
return collapse?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -376,6 +446,19 @@ class _$OpenPage implements OpenPage {
return openPage(context);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? collapse,
TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,
TResult Function(String name, String? desc)? createApp,
TResult Function(Either<List<App>, WorkspaceError> appsOrFail)?
didReceiveApps,
}) {
return openPage?.call(context);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -405,6 +488,18 @@ class _$OpenPage implements OpenPage {
return openPage(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(Collapse value)? collapse,
TResult Function(OpenPage value)? openPage,
TResult Function(CreateApp value)? createApp,
TResult Function(ReceiveApps value)? didReceiveApps,
}) {
return openPage?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -517,6 +612,19 @@ class _$CreateApp implements CreateApp {
return createApp(name, desc);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? collapse,
TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,
TResult Function(String name, String? desc)? createApp,
TResult Function(Either<List<App>, WorkspaceError> appsOrFail)?
didReceiveApps,
}) {
return createApp?.call(name, desc);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -546,6 +654,18 @@ class _$CreateApp implements CreateApp {
return createApp(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(Collapse value)? collapse,
TResult Function(OpenPage value)? openPage,
TResult Function(CreateApp value)? createApp,
TResult Function(ReceiveApps value)? didReceiveApps,
}) {
return createApp?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -649,6 +769,19 @@ class _$ReceiveApps implements ReceiveApps {
return didReceiveApps(appsOrFail);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? collapse,
TResult Function(HomeStackContext<dynamic, dynamic> context)? openPage,
TResult Function(String name, String? desc)? createApp,
TResult Function(Either<List<App>, WorkspaceError> appsOrFail)?
didReceiveApps,
}) {
return didReceiveApps?.call(appsOrFail);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -678,6 +811,18 @@ class _$ReceiveApps implements ReceiveApps {
return didReceiveApps(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(Collapse value)? collapse,
TResult Function(OpenPage value)? openPage,
TResult Function(CreateApp value)? createApp,
TResult Function(ReceiveApps value)? didReceiveApps,
}) {
return didReceiveApps?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({

View File

@ -1,3 +1,4 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
@ -37,6 +38,12 @@ mixin _$MenuUserEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? fetchWorkspaces,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? fetchWorkspaces,
@ -50,6 +57,12 @@ mixin _$MenuUserEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(_FetchWorkspaces value)? fetchWorkspaces,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(_FetchWorkspaces value)? fetchWorkspaces,
@ -118,6 +131,15 @@ class _$_Initial implements _Initial {
return initial();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? fetchWorkspaces,
}) {
return initial?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -140,6 +162,15 @@ class _$_Initial implements _Initial {
return initial(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(_FetchWorkspaces value)? fetchWorkspaces,
}) {
return initial?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -204,6 +235,15 @@ class _$_FetchWorkspaces implements _FetchWorkspaces {
return fetchWorkspaces();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? fetchWorkspaces,
}) {
return fetchWorkspaces?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -226,6 +266,15 @@ class _$_FetchWorkspaces implements _FetchWorkspaces {
return fetchWorkspaces(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(_FetchWorkspaces value)? fetchWorkspaces,
}) {
return fetchWorkspaces?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({

View File

@ -1,3 +1,4 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
@ -63,6 +64,16 @@ mixin _$TrashEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(List<Trash> trash)? didReceiveTrash,
TResult Function(String trashId)? putback,
TResult Function(Trash trash)? delete,
TResult Function()? restoreAll,
TResult Function()? deleteAll,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function(List<Trash> trash)? didReceiveTrash,
@ -84,6 +95,16 @@ mixin _$TrashEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(ReceiveTrash value)? didReceiveTrash,
TResult Function(Putback value)? putback,
TResult Function(Delete value)? delete,
TResult Function(RestoreAll value)? restoreAll,
TResult Function(DeleteAll value)? deleteAll,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(ReceiveTrash value)? didReceiveTrash,
@ -159,6 +180,19 @@ class _$Initial implements Initial {
return initial();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(List<Trash> trash)? didReceiveTrash,
TResult Function(String trashId)? putback,
TResult Function(Trash trash)? delete,
TResult Function()? restoreAll,
TResult Function()? deleteAll,
}) {
return initial?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -189,6 +223,19 @@ class _$Initial implements Initial {
return initial(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(ReceiveTrash value)? didReceiveTrash,
TResult Function(Putback value)? putback,
TResult Function(Delete value)? delete,
TResult Function(RestoreAll value)? restoreAll,
TResult Function(DeleteAll value)? deleteAll,
}) {
return initial?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -285,6 +332,19 @@ class _$ReceiveTrash implements ReceiveTrash {
return didReceiveTrash(trash);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(List<Trash> trash)? didReceiveTrash,
TResult Function(String trashId)? putback,
TResult Function(Trash trash)? delete,
TResult Function()? restoreAll,
TResult Function()? deleteAll,
}) {
return didReceiveTrash?.call(trash);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -315,6 +375,19 @@ class _$ReceiveTrash implements ReceiveTrash {
return didReceiveTrash(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(ReceiveTrash value)? didReceiveTrash,
TResult Function(Putback value)? putback,
TResult Function(Delete value)? delete,
TResult Function(RestoreAll value)? restoreAll,
TResult Function(DeleteAll value)? deleteAll,
}) {
return didReceiveTrash?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -414,6 +487,19 @@ class _$Putback implements Putback {
return putback(trashId);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(List<Trash> trash)? didReceiveTrash,
TResult Function(String trashId)? putback,
TResult Function(Trash trash)? delete,
TResult Function()? restoreAll,
TResult Function()? deleteAll,
}) {
return putback?.call(trashId);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -444,6 +530,19 @@ class _$Putback implements Putback {
return putback(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(ReceiveTrash value)? didReceiveTrash,
TResult Function(Putback value)? putback,
TResult Function(Delete value)? delete,
TResult Function(RestoreAll value)? restoreAll,
TResult Function(DeleteAll value)? deleteAll,
}) {
return putback?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -542,6 +641,19 @@ class _$Delete implements Delete {
return delete(trash);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(List<Trash> trash)? didReceiveTrash,
TResult Function(String trashId)? putback,
TResult Function(Trash trash)? delete,
TResult Function()? restoreAll,
TResult Function()? deleteAll,
}) {
return delete?.call(trash);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -572,6 +684,19 @@ class _$Delete implements Delete {
return delete(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(ReceiveTrash value)? didReceiveTrash,
TResult Function(Putback value)? putback,
TResult Function(Delete value)? delete,
TResult Function(RestoreAll value)? restoreAll,
TResult Function(DeleteAll value)? deleteAll,
}) {
return delete?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -646,6 +771,19 @@ class _$RestoreAll implements RestoreAll {
return restoreAll();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(List<Trash> trash)? didReceiveTrash,
TResult Function(String trashId)? putback,
TResult Function(Trash trash)? delete,
TResult Function()? restoreAll,
TResult Function()? deleteAll,
}) {
return restoreAll?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -676,6 +814,19 @@ class _$RestoreAll implements RestoreAll {
return restoreAll(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(ReceiveTrash value)? didReceiveTrash,
TResult Function(Putback value)? putback,
TResult Function(Delete value)? delete,
TResult Function(RestoreAll value)? restoreAll,
TResult Function(DeleteAll value)? deleteAll,
}) {
return restoreAll?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -745,6 +896,19 @@ class _$DeleteAll implements DeleteAll {
return deleteAll();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(List<Trash> trash)? didReceiveTrash,
TResult Function(String trashId)? putback,
TResult Function(Trash trash)? delete,
TResult Function()? restoreAll,
TResult Function()? deleteAll,
}) {
return deleteAll?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -775,6 +939,19 @@ class _$DeleteAll implements DeleteAll {
return deleteAll(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(ReceiveTrash value)? didReceiveTrash,
TResult Function(Putback value)? putback,
TResult Function(Delete value)? delete,
TResult Function(RestoreAll value)? restoreAll,
TResult Function(DeleteAll value)? deleteAll,
}) {
return deleteAll?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({

View File

@ -1,3 +1,4 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
@ -64,6 +65,16 @@ mixin _$ViewEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(bool isEditing)? setIsEditing,
TResult Function(String newName)? rename,
TResult Function()? delete,
TResult Function()? duplicate,
TResult Function(Either<View, WorkspaceError> result)? viewDidUpdate,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function(bool isEditing)? setIsEditing,
@ -85,6 +96,16 @@ mixin _$ViewEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(SetEditing value)? setIsEditing,
TResult Function(Rename value)? rename,
TResult Function(Delete value)? delete,
TResult Function(Duplicate value)? duplicate,
TResult Function(ViewDidUpdate value)? viewDidUpdate,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(SetEditing value)? setIsEditing,
@ -160,6 +181,19 @@ class _$Initial implements Initial {
return initial();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(bool isEditing)? setIsEditing,
TResult Function(String newName)? rename,
TResult Function()? delete,
TResult Function()? duplicate,
TResult Function(Either<View, WorkspaceError> result)? viewDidUpdate,
}) {
return initial?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -190,6 +224,19 @@ class _$Initial implements Initial {
return initial(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(SetEditing value)? setIsEditing,
TResult Function(Rename value)? rename,
TResult Function(Delete value)? delete,
TResult Function(Duplicate value)? duplicate,
TResult Function(ViewDidUpdate value)? viewDidUpdate,
}) {
return initial?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -287,6 +334,19 @@ class _$SetEditing implements SetEditing {
return setIsEditing(isEditing);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(bool isEditing)? setIsEditing,
TResult Function(String newName)? rename,
TResult Function()? delete,
TResult Function()? duplicate,
TResult Function(Either<View, WorkspaceError> result)? viewDidUpdate,
}) {
return setIsEditing?.call(isEditing);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -317,6 +377,19 @@ class _$SetEditing implements SetEditing {
return setIsEditing(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(SetEditing value)? setIsEditing,
TResult Function(Rename value)? rename,
TResult Function(Delete value)? delete,
TResult Function(Duplicate value)? duplicate,
TResult Function(ViewDidUpdate value)? viewDidUpdate,
}) {
return setIsEditing?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -417,6 +490,19 @@ class _$Rename implements Rename {
return rename(newName);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(bool isEditing)? setIsEditing,
TResult Function(String newName)? rename,
TResult Function()? delete,
TResult Function()? duplicate,
TResult Function(Either<View, WorkspaceError> result)? viewDidUpdate,
}) {
return rename?.call(newName);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -447,6 +533,19 @@ class _$Rename implements Rename {
return rename(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(SetEditing value)? setIsEditing,
TResult Function(Rename value)? rename,
TResult Function(Delete value)? delete,
TResult Function(Duplicate value)? duplicate,
TResult Function(ViewDidUpdate value)? viewDidUpdate,
}) {
return rename?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -521,6 +620,19 @@ class _$Delete implements Delete {
return delete();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(bool isEditing)? setIsEditing,
TResult Function(String newName)? rename,
TResult Function()? delete,
TResult Function()? duplicate,
TResult Function(Either<View, WorkspaceError> result)? viewDidUpdate,
}) {
return delete?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -551,6 +663,19 @@ class _$Delete implements Delete {
return delete(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(SetEditing value)? setIsEditing,
TResult Function(Rename value)? rename,
TResult Function(Delete value)? delete,
TResult Function(Duplicate value)? duplicate,
TResult Function(ViewDidUpdate value)? viewDidUpdate,
}) {
return delete?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -621,6 +746,19 @@ class _$Duplicate implements Duplicate {
return duplicate();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(bool isEditing)? setIsEditing,
TResult Function(String newName)? rename,
TResult Function()? delete,
TResult Function()? duplicate,
TResult Function(Either<View, WorkspaceError> result)? viewDidUpdate,
}) {
return duplicate?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -651,6 +789,19 @@ class _$Duplicate implements Duplicate {
return duplicate(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(SetEditing value)? setIsEditing,
TResult Function(Rename value)? rename,
TResult Function(Delete value)? delete,
TResult Function(Duplicate value)? duplicate,
TResult Function(ViewDidUpdate value)? viewDidUpdate,
}) {
return duplicate?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -748,6 +899,19 @@ class _$ViewDidUpdate implements ViewDidUpdate {
return viewDidUpdate(result);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(bool isEditing)? setIsEditing,
TResult Function(String newName)? rename,
TResult Function()? delete,
TResult Function()? duplicate,
TResult Function(Either<View, WorkspaceError> result)? viewDidUpdate,
}) {
return viewDidUpdate?.call(result);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -778,6 +942,19 @@ class _$ViewDidUpdate implements ViewDidUpdate {
return viewDidUpdate(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(SetEditing value)? setIsEditing,
TResult Function(Rename value)? rename,
TResult Function(Delete value)? delete,
TResult Function(Duplicate value)? duplicate,
TResult Function(ViewDidUpdate value)? viewDidUpdate,
}) {
return viewDidUpdate?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({

View File

@ -1,3 +1,4 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
@ -57,6 +58,15 @@ mixin _$WelcomeEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(String name, String desc)? createWorkspace,
TResult Function(Workspace workspace)? openWorkspace,
TResult Function(Either<List<Workspace>, WorkspaceError> workspacesOrFail)?
workspacesReveived,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function(String name, String desc)? createWorkspace,
@ -75,6 +85,14 @@ mixin _$WelcomeEvent {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(CreateWorkspace value)? createWorkspace,
TResult Function(OpenWorkspace value)? openWorkspace,
TResult Function(WorkspacesReceived value)? workspacesReveived,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(CreateWorkspace value)? createWorkspace,
@ -148,6 +166,18 @@ class _$Initial implements Initial {
return initial();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(String name, String desc)? createWorkspace,
TResult Function(Workspace workspace)? openWorkspace,
TResult Function(Either<List<Workspace>, WorkspaceError> workspacesOrFail)?
workspacesReveived,
}) {
return initial?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -175,6 +205,17 @@ class _$Initial implements Initial {
return initial(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(CreateWorkspace value)? createWorkspace,
TResult Function(OpenWorkspace value)? openWorkspace,
TResult Function(WorkspacesReceived value)? workspacesReveived,
}) {
return initial?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -281,6 +322,18 @@ class _$CreateWorkspace implements CreateWorkspace {
return createWorkspace(name, desc);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(String name, String desc)? createWorkspace,
TResult Function(Workspace workspace)? openWorkspace,
TResult Function(Either<List<Workspace>, WorkspaceError> workspacesOrFail)?
workspacesReveived,
}) {
return createWorkspace?.call(name, desc);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -308,6 +361,17 @@ class _$CreateWorkspace implements CreateWorkspace {
return createWorkspace(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(CreateWorkspace value)? createWorkspace,
TResult Function(OpenWorkspace value)? openWorkspace,
TResult Function(WorkspacesReceived value)? workspacesReveived,
}) {
return createWorkspace?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -409,6 +473,18 @@ class _$OpenWorkspace implements OpenWorkspace {
return openWorkspace(workspace);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(String name, String desc)? createWorkspace,
TResult Function(Workspace workspace)? openWorkspace,
TResult Function(Either<List<Workspace>, WorkspaceError> workspacesOrFail)?
workspacesReveived,
}) {
return openWorkspace?.call(workspace);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -436,6 +512,17 @@ class _$OpenWorkspace implements OpenWorkspace {
return openWorkspace(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(CreateWorkspace value)? createWorkspace,
TResult Function(OpenWorkspace value)? openWorkspace,
TResult Function(WorkspacesReceived value)? workspacesReveived,
}) {
return openWorkspace?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@ -538,6 +625,18 @@ class _$WorkspacesReceived implements WorkspacesReceived {
return workspacesReveived(workspacesOrFail);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? initial,
TResult Function(String name, String desc)? createWorkspace,
TResult Function(Workspace workspace)? openWorkspace,
TResult Function(Either<List<Workspace>, WorkspaceError> workspacesOrFail)?
workspacesReveived,
}) {
return workspacesReveived?.call(workspacesOrFail);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@ -565,6 +664,17 @@ class _$WorkspacesReceived implements WorkspacesReceived {
return workspacesReveived(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Initial value)? initial,
TResult Function(CreateWorkspace value)? createWorkspace,
TResult Function(OpenWorkspace value)? openWorkspace,
TResult Function(WorkspacesReceived value)? workspacesReveived,
}) {
return workspacesReveived?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({

View File

@ -0,0 +1,12 @@
import 'dart:async';
import 'package:dartz/dartz.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace-infra/protobuf.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
abstract class IShare {
Future<Either<ExportData, WorkspaceError>> exportText(String docId);
Future<Either<ExportData, WorkspaceError>> exportMarkdown(String docId);
Future<Either<ExportData, WorkspaceError>> exportURL(String docId);
}

View File

@ -9,7 +9,8 @@ import 'package:app_flowy/workspace/presentation/widgets/prelude.dart';
typedef NavigationCallback = void Function(String id);
abstract class NavigationItem {
Widget get naviTitle;
Widget get leftBarItem;
Widget? get rightBarItem => null;
String get identifier;
NavigationCallback get action => (id) {
@ -29,9 +30,10 @@ abstract class HomeStackContext<T, S> with NavigationItem {
List<NavigationItem> get navigationItems;
@override
Widget get naviTitle;
Widget get leftBarItem;
Widget? Function(BuildContext context) get buildNaviAction;
@override
Widget? get rightBarItem;
@override
String get identifier;
@ -49,7 +51,7 @@ class HomeStackNotifier extends ChangeNotifier {
HomeStackContext stackContext;
PublishNotifier<bool> collapsedNotifier = PublishNotifier();
Widget get titleWidget => stackContext.naviTitle;
Widget get titleWidget => stackContext.leftBarItem;
HomeStackNotifier({HomeStackContext? context}) : stackContext = context ?? BlankStackContext();
@ -71,7 +73,7 @@ class HomeStackManager {
HomeStackManager();
Widget title() {
return _notifier.context.naviTitle;
return _notifier.context.leftBarItem;
}
PublishNotifier<bool> get collapsedNotifier => _notifier.collapsedNotifier;

View File

@ -1,11 +1,13 @@
import 'package:app_flowy/workspace/application/app/app_bloc.dart';
import 'package:app_flowy/workspace/application/doc/doc_bloc.dart';
import 'package:app_flowy/workspace/application/doc/share_bloc.dart';
import 'package:app_flowy/workspace/application/menu/menu_bloc.dart';
import 'package:app_flowy/workspace/application/menu/menu_user_bloc.dart';
import 'package:app_flowy/workspace/application/trash/trash_bloc.dart';
import 'package:app_flowy/workspace/application/view/view_bloc.dart';
import 'package:app_flowy/workspace/application/workspace/welcome_bloc.dart';
import 'package:app_flowy/workspace/domain/i_doc.dart';
import 'package:app_flowy/workspace/domain/i_share.dart';
import 'package:app_flowy/workspace/domain/i_trash.dart';
import 'package:app_flowy/workspace/domain/i_view.dart';
import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';
@ -23,8 +25,10 @@ import 'package:flowy_sdk/protobuf/flowy-workspace-infra/app_create.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace-infra/view_create.pb.dart';
import 'package:get_it/get_it.dart';
import 'i_share_impl.dart';
import 'i_user_impl.dart';
import 'i_view_impl.dart';
import 'repos/share_repo.dart';
class HomeDepsResolver {
static Future<void> resolve(GetIt getIt) async {
@ -102,5 +106,11 @@ class HomeDepsResolver {
getIt.registerFactory<ITrash>(() => ITrashImpl(repo: getIt<TrashRepo>()));
getIt.registerFactory<ITrashListener>(() => ITrashListenerImpl(repo: getIt<TrashListenerRepo>()));
getIt.registerFactory<TrashBloc>(() => TrashBloc(trasnManager: getIt<ITrash>(), listener: getIt<ITrashListener>()));
// share
getIt.registerLazySingleton<ShareRepo>(() => ShareRepo());
getIt.registerFactory<IShare>(() => IShareImpl(repo: getIt<ShareRepo>()));
getIt.registerFactoryParam<DocShareBloc, View, void>(
(view, _) => DocShareBloc(view: view, shareManager: getIt<IShare>()));
}
}

View File

@ -0,0 +1,27 @@
import 'package:app_flowy/workspace/domain/i_share.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace-infra/protobuf.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
import 'package:dartz/dartz.dart';
import 'repos/share_repo.dart';
class IShareImpl extends IShare {
ShareRepo repo;
IShareImpl({required this.repo});
@override
Future<Either<ExportData, WorkspaceError>> exportText(String docId) {
return repo.export(docId, ExportType.Text);
}
@override
Future<Either<ExportData, WorkspaceError>> exportMarkdown(String docId) {
return repo.export(docId, ExportType.Markdown);
}
@override
Future<Either<ExportData, WorkspaceError>> exportURL(String docId) {
return repo.export(docId, ExportType.Link);
}
}

View File

@ -0,0 +1,30 @@
library delta_markdown;
import 'dart:convert';
import 'src/delta_markdown_decoder.dart';
import 'src/delta_markdown_encoder.dart';
import 'src/version.dart';
const version = packageVersion;
/// Codec used to convert between Markdown and Quill deltas.
const DeltaMarkdownCodec _kCodec = DeltaMarkdownCodec();
String markdownToDelta(String markdown) {
return _kCodec.decode(markdown);
}
String deltaToMarkdown(String delta) {
return _kCodec.encode(delta);
}
class DeltaMarkdownCodec extends Codec<String, String> {
const DeltaMarkdownCodec();
@override
Converter<String, String> get decoder => DeltaMarkdownDecoder();
@override
Converter<String, String> get encoder => DeltaMarkdownEncoder();
}

View File

@ -0,0 +1,113 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
typedef Resolver = Node? Function(String name, [String? title]);
/// Base class for any AST item.
///
/// Roughly corresponds to Node in the DOM. Will be either an Element or Text.
class Node {
void accept(NodeVisitor visitor) {}
bool isToplevel = false;
String? get textContent {
return null;
}
}
/// A named tag that can contain other nodes.
class Element extends Node {
/// Instantiates a [tag] Element with [children].
Element(this.tag, this.children) : attributes = <String, String>{};
/// Instantiates an empty, self-closing [tag] Element.
Element.empty(this.tag)
: children = null,
attributes = {};
/// Instantiates a [tag] Element with no [children].
Element.withTag(this.tag)
: children = [],
attributes = {};
/// Instantiates a [tag] Element with a single Text child.
Element.text(this.tag, String text)
: children = [Text(text)],
attributes = {};
final String tag;
final List<Node>? children;
final Map<String, String> attributes;
String? generatedId;
/// Whether this element is self-closing.
bool get isEmpty => children == null;
@override
void accept(NodeVisitor visitor) {
if (visitor.visitElementBefore(this)) {
if (children != null) {
for (final child in children!) {
child.accept(visitor);
}
}
visitor.visitElementAfter(this);
}
}
@override
String get textContent => children == null
? ''
: children!.map((child) => child.textContent).join();
}
/// A plain text element.
class Text extends Node {
Text(this.text);
final String text;
@override
void accept(NodeVisitor visitor) => visitor.visitText(this);
@override
String get textContent => text;
}
/// Inline content that has not been parsed into inline nodes (strong, links,
/// etc).
///
/// These placeholder nodes should only remain in place while the block nodes
/// of a document are still being parsed, in order to gather all reference link
/// definitions.
class UnparsedContent extends Node {
UnparsedContent(this.textContent);
@override
final String textContent;
@override
void accept(NodeVisitor visitor);
}
/// Visitor pattern for the AST.
///
/// Renderers or other AST transformers should implement this.
abstract class NodeVisitor {
/// Called when a Text node has been reached.
void visitText(Text text);
/// Called when an Element has been reached, before its children have been
/// visited.
///
/// Returns `false` to skip its children.
bool visitElementBefore(Element element);
/// Called when an Element has been reached, after its children have been
/// visited.
///
/// Will not be called if [visitElementBefore] returns `false`.
void visitElementAfter(Element element);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,255 @@
import 'dart:collection';
import 'dart:convert';
import 'package:flutter_quill/models/documents/attribute.dart';
import 'package:flutter_quill/models/quill_delta.dart';
import 'ast.dart' as ast;
import 'document.dart';
class DeltaMarkdownDecoder extends Converter<String, String> {
@override
String convert(String input) {
final lines = input.replaceAll('\r\n', '\n').split('\n');
final markdownDocument = Document().parseLines(lines);
return jsonEncode(_DeltaVisitor().convert(markdownDocument).toJson());
}
}
class _DeltaVisitor implements ast.NodeVisitor {
static final _blockTags =
RegExp('h1|h2|h3|h4|h5|h6|hr|pre|ul|ol|blockquote|p|pre');
static final _embedTags = RegExp('hr|img');
late Delta delta;
late Queue<Attribute> activeInlineAttributes;
Attribute? activeBlockAttribute;
late Set<String> uniqueIds;
ast.Element? previousElement;
late ast.Element previousToplevelElement;
Delta convert(List<ast.Node> nodes) {
delta = Delta();
activeInlineAttributes = Queue<Attribute>();
uniqueIds = <String>{};
for (final node in nodes) {
node.accept(this);
}
// Ensure the delta ends with a newline.
if (delta.length > 0 && delta.last.value != '\n') {
delta.insert('\n', activeBlockAttribute?.toJson());
}
return delta;
}
@override
void visitText(ast.Text text) {
// Remove trailing newline
//final lines = text.text.trim().split('\n');
/*
final attributes = Map<String, dynamic>();
for (final attr in activeInlineAttributes) {
attributes.addAll(attr.toJson());
}
for (final l in lines) {
delta.insert(l, attributes);
delta.insert('\n', activeBlockAttribute.toJson());
}*/
final str = text.text;
//if (str.endsWith('\n')) str = str.substring(0, str.length - 1);
final attributes = <String, dynamic>{};
for (final attr in activeInlineAttributes) {
attributes.addAll(attr.toJson());
}
var newlineIndex = str.indexOf('\n');
var startIndex = 0;
while (newlineIndex != -1) {
final previousText = str.substring(startIndex, newlineIndex);
if (previousText.isNotEmpty) {
delta.insert(previousText, attributes.isNotEmpty ? attributes : null);
}
delta.insert('\n', activeBlockAttribute?.toJson());
startIndex = newlineIndex + 1;
newlineIndex = str.indexOf('\n', newlineIndex + 1);
}
if (startIndex < str.length) {
final lastStr = str.substring(startIndex);
delta.insert(lastStr, attributes.isNotEmpty ? attributes : null);
}
}
@override
bool visitElementBefore(ast.Element element) {
// Hackish. Separate block-level elements with newlines.
final attr = _tagToAttribute(element);
if (delta.isNotEmpty && _blockTags.firstMatch(element.tag) != null) {
if (element.isToplevel) {
// If the last active block attribute is not a list, we need to finish
// it off.
if (previousToplevelElement.tag != 'ul' &&
previousToplevelElement.tag != 'ol' &&
previousToplevelElement.tag != 'pre' &&
previousToplevelElement.tag != 'hr') {
delta.insert('\n', activeBlockAttribute?.toJson());
}
// Only separate the blocks if both are paragraphs.
//
// TODO(kolja): Determine which behavior we really want here.
// We can either insert an additional newline or just have the
// paragraphs as single lines. Zefyr will by default render two lines
// are different paragraphs so for now we will not add an additonal
// newline here.
//
// if (previousToplevelElement != null &&
// previousToplevelElement.tag == 'p' &&
// element.tag == 'p') {
// delta.insert('\n');
// }
} else if (element.tag == 'p' &&
previousElement != null &&
!previousElement!.isToplevel &&
!previousElement!.children!.contains(element)) {
// Here we have two children of the same toplevel element. These need
// to be separated by additional newlines.
delta
// Finish off the last lower-level block.
..insert('\n', activeBlockAttribute?.toJson())
// Add an empty line between the lower-level blocks.
..insert('\n', activeBlockAttribute?.toJson());
}
}
// Keep track of the top-level block attribute.
if (element.isToplevel && element.tag != 'hr') {
// Hacky solution for horizontal rule so that the attribute is not added
// to the line feed at the end of the line.
activeBlockAttribute = attr;
}
if (_embedTags.firstMatch(element.tag) != null) {
// We write out the element here since the embed has no children or
// content.
delta.insert(attr!.toJson());
} else if (_blockTags.firstMatch(element.tag) == null && attr != null) {
activeInlineAttributes.addLast(attr);
}
previousElement = element;
if (element.isToplevel) {
previousToplevelElement = element;
}
if (element.isEmpty) {
// Empty element like <hr/>.
//buffer.write(' />');
if (element.tag == 'br') {
delta.insert('\n');
}
return false;
} else {
//buffer.write('>');
return true;
}
}
@override
void visitElementAfter(ast.Element element) {
if (element.tag == 'li' &&
(previousToplevelElement.tag == 'ol' ||
previousToplevelElement.tag == 'ul')) {
delta.insert('\n', activeBlockAttribute?.toJson());
}
final attr = _tagToAttribute(element);
if (attr == null || !attr.isInline || activeInlineAttributes.last != attr) {
return;
}
activeInlineAttributes.removeLast();
// Always keep track of the last element.
// This becomes relevant if we have something like
//
// <ul>
// <li>...</li>
// <li>...</li>
// </ul>
previousElement = element;
}
/// Uniquifies an id generated from text.
String uniquifyId(String id) {
if (!uniqueIds.contains(id)) {
uniqueIds.add(id);
return id;
}
var suffix = 2;
var suffixedId = '$id-$suffix';
while (uniqueIds.contains(suffixedId)) {
suffixedId = '$id-${suffix++}';
}
uniqueIds.add(suffixedId);
return suffixedId;
}
Attribute? _tagToAttribute(ast.Element el) {
switch (el.tag) {
case 'em':
return Attribute.italic;
case 'strong':
return Attribute.bold;
case 'ul':
return Attribute.ul;
case 'ol':
return Attribute.ol;
case 'pre':
return Attribute.codeBlock;
case 'blockquote':
return Attribute.blockQuote;
case 'h1':
return Attribute.h1;
case 'h2':
return Attribute.h2;
case 'h3':
return Attribute.h3;
case 'a':
final href = el.attributes['href'];
return LinkAttribute(href);
case 'img':
final href = el.attributes['src'];
return ImageAttribute(href);
case 'hr':
return DividerAttribute();
}
return null;
}
}
class ImageAttribute extends Attribute<String?> {
ImageAttribute(String? val) : super('image', AttributeScope.EMBEDS, val);
}
class DividerAttribute extends Attribute<String?> {
DividerAttribute() : super('divider', AttributeScope.EMBEDS, 'hr');
}

View File

@ -0,0 +1,272 @@
import 'dart:convert';
import 'package:collection/collection.dart' show IterableExtension;
import 'package:flutter_quill/models/documents/attribute.dart';
import 'package:flutter_quill/models/documents/nodes/embed.dart';
import 'package:flutter_quill/models/documents/style.dart';
import 'package:flutter_quill/models/quill_delta.dart';
class DeltaMarkdownEncoder extends Converter<String, String> {
static const _lineFeedAsciiCode = 0x0A;
late StringBuffer markdownBuffer;
late StringBuffer lineBuffer;
Attribute? currentBlockStyle;
late Style currentInlineStyle;
late List<String> currentBlockLines;
/// Converts the [input] delta to Markdown.
@override
String convert(String input) {
markdownBuffer = StringBuffer();
lineBuffer = StringBuffer();
currentInlineStyle = Style();
currentBlockLines = <String>[];
final inputJson = jsonDecode(input) as List<dynamic>?;
if (inputJson is! List<dynamic>) {
throw ArgumentError('Unexpected formatting of the input delta string.');
}
final delta = Delta.fromJson(inputJson);
final iterator = DeltaIterator(delta);
while (iterator.hasNext) {
final operation = iterator.next();
if (operation.data is String) {
final operationData = operation.data as String;
if (!operationData.contains('\n')) {
_handleInline(lineBuffer, operationData, operation.attributes);
} else {
_handleLine(operationData, operation.attributes);
}
} else if (operation.data is Map<String, dynamic>) {
_handleEmbed(operation.data as Map<String, dynamic>);
} else {
throw ArgumentError('Unexpected formatting of the input delta string.');
}
}
_handleBlock(currentBlockStyle); // Close the last block
return markdownBuffer.toString();
}
void _handleInline(
StringBuffer buffer,
String text,
Map<String, dynamic>? attributes,
) {
final style = Style.fromJson(attributes);
// First close any current styles if needed
final markedForRemoval = <Attribute>[];
// Close the styles in reverse order, e.g. **_ for _**Test**_.
for (final value
in currentInlineStyle.attributes.values.toList().reversed) {
// TODO(tillf): Is block correct?
if (value.scope == AttributeScope.BLOCK) {
continue;
}
if (style.containsKey(value.key)) {
continue;
}
final padding = _trimRight(buffer);
_writeAttribute(buffer, value, close: true);
if (padding.isNotEmpty) {
buffer.write(padding);
}
markedForRemoval.add(value);
}
// Make sure to remove all attributes that are marked for removal.
for (final value in markedForRemoval) {
currentInlineStyle.attributes.removeWhere((_, v) => v == value);
}
// Now open any new styles.
for (final attribute in style.attributes.values) {
// TODO(tillf): Is block correct?
if (attribute.scope == AttributeScope.BLOCK) {
continue;
}
if (currentInlineStyle.containsKey(attribute.key)) {
continue;
}
final originalText = text;
text = text.trimLeft();
final padding = ' ' * (originalText.length - text.length);
if (padding.isNotEmpty) {
buffer.write(padding);
}
_writeAttribute(buffer, attribute);
}
// Write the text itself
buffer.write(text);
currentInlineStyle = style;
}
void _handleLine(String data, Map<String, dynamic>? attributes) {
final span = StringBuffer();
for (var i = 0; i < data.length; i++) {
if (data.codeUnitAt(i) == _lineFeedAsciiCode) {
if (span.isNotEmpty) {
// Write the span if it's not empty.
_handleInline(lineBuffer, span.toString(), attributes);
}
// Close any open inline styles.
_handleInline(lineBuffer, '', null);
final lineBlock = Style.fromJson(attributes)
.attributes
.values
.singleWhereOrNull((a) => a.scope == AttributeScope.BLOCK);
if (lineBlock == currentBlockStyle) {
currentBlockLines.add(lineBuffer.toString());
} else {
_handleBlock(currentBlockStyle);
currentBlockLines
..clear()
..add(lineBuffer.toString());
currentBlockStyle = lineBlock;
}
lineBuffer.clear();
span.clear();
} else {
span.writeCharCode(data.codeUnitAt(i));
}
}
// Remaining span
if (span.isNotEmpty) {
_handleInline(lineBuffer, span.toString(), attributes);
}
}
void _handleEmbed(Map<String, dynamic> data) {
final embed = BlockEmbed(data.keys.first, data.values.first as String);
if (embed.type == 'image') {
_writeEmbedTag(lineBuffer, embed);
_writeEmbedTag(lineBuffer, embed, close: true);
} else if (embed.type == 'divider') {
_writeEmbedTag(lineBuffer, embed);
_writeEmbedTag(lineBuffer, embed, close: true);
}
}
void _handleBlock(Attribute? blockStyle) {
if (currentBlockLines.isEmpty) {
return; // Empty block
}
// If there was a block before this one, add empty line between the blocks
if (markdownBuffer.isNotEmpty) {
markdownBuffer.writeln();
}
if (blockStyle == null) {
markdownBuffer
..write(currentBlockLines.join('\n'))
..writeln();
} else if (blockStyle == Attribute.codeBlock) {
_writeAttribute(markdownBuffer, blockStyle);
markdownBuffer.write(currentBlockLines.join('\n'));
_writeAttribute(markdownBuffer, blockStyle, close: true);
markdownBuffer.writeln();
} else {
// Dealing with lists or a quote.
for (final line in currentBlockLines) {
_writeBlockTag(markdownBuffer, blockStyle);
markdownBuffer
..write(line)
..writeln();
}
}
}
String _trimRight(StringBuffer buffer) {
final text = buffer.toString();
if (!text.endsWith(' ')) {
return '';
}
final result = text.trimRight();
buffer
..clear()
..write(result);
return ' ' * (text.length - result.length);
}
void _writeAttribute(
StringBuffer buffer,
Attribute attribute, {
bool close = false,
}) {
if (attribute.key == Attribute.bold.key) {
buffer.write('**');
} else if (attribute.key == Attribute.italic.key) {
buffer.write('_');
} else if (attribute.key == Attribute.link.key) {
buffer.write(!close ? '[' : '](${attribute.value})');
} else if (attribute == Attribute.codeBlock) {
buffer.write(!close ? '```\n' : '\n```');
} else {
throw ArgumentError('Cannot handle $attribute');
}
}
void _writeBlockTag(
StringBuffer buffer,
Attribute block, {
bool close = false,
}) {
if (close) {
return; // no close tag needed for simple blocks.
}
if (block == Attribute.blockQuote) {
buffer.write('> ');
} else if (block == Attribute.ul) {
buffer.write('* ');
} else if (block == Attribute.ol) {
buffer.write('1. ');
} else if (block.key == Attribute.h1.key && block.value == 1) {
buffer.write('# ');
} else if (block.key == Attribute.h2.key && block.value == 2) {
buffer.write('## ');
} else if (block.key == Attribute.h3.key && block.value == 3) {
buffer.write('### ');
} else {
throw ArgumentError('Cannot handle block $block');
}
}
void _writeEmbedTag(
StringBuffer buffer,
BlockEmbed embed, {
bool close = false,
}) {
const kImageType = 'image';
const kDividerType = 'divider';
if (embed.type == kImageType) {
if (close) {
buffer.write('](${embed.data})');
} else {
buffer.write('![');
}
} else if (embed.type == kDividerType && close) {
buffer.write('\n---\n\n');
}
}
}

View File

@ -0,0 +1,88 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'ast.dart';
import 'block_parser.dart';
import 'extension_set.dart';
import 'inline_parser.dart';
/// Maintains the context needed to parse a Markdown document.
class Document {
Document({
Iterable<BlockSyntax>? blockSyntaxes,
Iterable<InlineSyntax>? inlineSyntaxes,
ExtensionSet? extensionSet,
this.linkResolver,
this.imageLinkResolver,
}) : extensionSet = extensionSet ?? ExtensionSet.commonMark {
_blockSyntaxes
..addAll(blockSyntaxes ?? [])
..addAll(this.extensionSet.blockSyntaxes);
_inlineSyntaxes
..addAll(inlineSyntaxes ?? [])
..addAll(this.extensionSet.inlineSyntaxes);
}
final Map<String, LinkReference> linkReferences = <String, LinkReference>{};
final ExtensionSet extensionSet;
final Resolver? linkResolver;
final Resolver? imageLinkResolver;
final _blockSyntaxes = <BlockSyntax>{};
final _inlineSyntaxes = <InlineSyntax>{};
Iterable<BlockSyntax> get blockSyntaxes => _blockSyntaxes;
Iterable<InlineSyntax> get inlineSyntaxes => _inlineSyntaxes;
/// Parses the given [lines] of Markdown to a series of AST nodes.
List<Node> parseLines(List<String> lines) {
final nodes = BlockParser(lines, this).parseLines();
// Make sure to mark the top level nodes as such.
for (final n in nodes) {
n.isToplevel = true;
}
_parseInlineContent(nodes);
return nodes;
}
/// Parses the given inline Markdown [text] to a series of AST nodes.
List<Node>? parseInline(String text) => InlineParser(text, this).parse();
void _parseInlineContent(List<Node> nodes) {
for (var i = 0; i < nodes.length; i++) {
final node = nodes[i];
if (node is UnparsedContent) {
final inlineNodes = parseInline(node.textContent)!;
nodes
..removeAt(i)
..insertAll(i, inlineNodes);
i += inlineNodes.length - 1;
} else if (node is Element && node.children != null) {
_parseInlineContent(node.children!);
}
}
}
}
/// A [link reference
/// definition](http://spec.commonmark.org/0.28/#link-reference-definitions).
class LinkReference {
/// Construct a [LinkReference], with all necessary fields.
///
/// If the parsed link reference definition does not include a title, use
/// `null` for the [title] parameter.
LinkReference(this.label, this.destination, this.title);
/// The [link label](http://spec.commonmark.org/0.28/#link-label).
///
/// Temporarily, this class is also being used to represent the link data for
/// an inline link (the destination and title), but this should change before
/// the package is released.
final String label;
/// The [link destination](http://spec.commonmark.org/0.28/#link-destination).
final String destination;
/// The [link title](http://spec.commonmark.org/0.28/#link-title).
final String title;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,64 @@
import 'block_parser.dart';
import 'inline_parser.dart';
/// ExtensionSets provide a simple grouping mechanism for common Markdown
/// flavors.
///
/// For example, the [gitHubFlavored] set of syntax extensions allows users to
/// output HTML from their Markdown in a similar fashion to GitHub's parsing.
class ExtensionSet {
ExtensionSet(this.blockSyntaxes, this.inlineSyntaxes);
/// The [ExtensionSet.none] extension set renders Markdown similar to
/// [Markdown.pl].
///
/// However, this set does not render _exactly_ the same as Markdown.pl;
/// rather it is more-or-less the CommonMark standard of Markdown, without
/// fenced code blocks, or inline HTML.
///
/// [Markdown.pl]: http://daringfireball.net/projects/markdown/syntax
static final ExtensionSet none = ExtensionSet([], []);
/// The [commonMark] extension set is close to compliance with [CommonMark].
///
/// [CommonMark]: http://commonmark.org/
static final ExtensionSet commonMark =
ExtensionSet([const FencedCodeBlockSyntax()], [InlineHtmlSyntax()]);
/// The [gitHubWeb] extension set renders Markdown similarly to GitHub.
///
/// This is different from the [gitHubFlavored] extension set in that GitHub
/// actually renders HTML different from straight [GitHub flavored Markdown].
///
/// (The only difference currently is that [gitHubWeb] renders headers with
/// linkable IDs.)
///
/// [GitHub flavored Markdown]: https://github.github.com/gfm/
static final ExtensionSet gitHubWeb = ExtensionSet([
const FencedCodeBlockSyntax(),
const HeaderWithIdSyntax(),
const SetextHeaderWithIdSyntax(),
const TableSyntax()
], [
InlineHtmlSyntax(),
StrikethroughSyntax(),
EmojiSyntax(),
AutolinkExtensionSyntax(),
]);
/// The [gitHubFlavored] extension set is close to compliance with the [GitHub
/// flavored Markdown spec].
///
/// [GitHub flavored Markdown]: https://github.github.com/gfm/
static final ExtensionSet gitHubFlavored = ExtensionSet([
const FencedCodeBlockSyntax(),
const TableSyntax()
], [
InlineHtmlSyntax(),
StrikethroughSyntax(),
AutolinkExtensionSyntax(),
]);
final List<BlockSyntax> blockSyntaxes;
final List<InlineSyntax> inlineSyntaxes;
}

View File

@ -0,0 +1,121 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'ast.dart';
import 'block_parser.dart';
import 'document.dart';
import 'extension_set.dart';
import 'inline_parser.dart';
/// Converts the given string of Markdown to HTML.
String markdownToHtml(String markdown,
{Iterable<BlockSyntax>? blockSyntaxes,
Iterable<InlineSyntax>? inlineSyntaxes,
ExtensionSet? extensionSet,
Resolver? linkResolver,
Resolver? imageLinkResolver,
bool inlineOnly = false}) {
final document = Document(
blockSyntaxes: blockSyntaxes,
inlineSyntaxes: inlineSyntaxes,
extensionSet: extensionSet,
linkResolver: linkResolver,
imageLinkResolver: imageLinkResolver);
if (inlineOnly) {
return renderToHtml(document.parseInline(markdown)!);
}
// Replace windows line endings with unix line endings, and split.
final lines = markdown.replaceAll('\r\n', '\n').split('\n');
return '${renderToHtml(document.parseLines(lines))}\n';
}
/// Renders [nodes] to HTML.
String renderToHtml(List<Node> nodes) => HtmlRenderer().render(nodes);
/// Translates a parsed AST to HTML.
class HtmlRenderer implements NodeVisitor {
HtmlRenderer();
static final _blockTags = RegExp('blockquote|h1|h2|h3|h4|h5|h6|hr|p|pre');
late StringBuffer buffer;
late Set<String> uniqueIds;
String render(List<Node> nodes) {
buffer = StringBuffer();
uniqueIds = <String>{};
for (final node in nodes) {
node.accept(this);
}
return buffer.toString();
}
@override
void visitText(Text text) {
buffer.write(text.text);
}
@override
bool visitElementBefore(Element element) {
// Hackish. Separate block-level elements with newlines.
if (buffer.isNotEmpty && _blockTags.firstMatch(element.tag) != null) {
buffer.write('\n');
}
buffer.write('<${element.tag}');
// Sort the keys so that we generate stable output.
final attributeNames = element.attributes.keys.toList()
..sort((a, b) => a.compareTo(b));
for (final name in attributeNames) {
buffer.write(' $name="${element.attributes[name]}"');
}
// attach header anchor ids generated from text
if (element.generatedId != null) {
buffer.write(' id="${uniquifyId(element.generatedId!)}"');
}
if (element.isEmpty) {
// Empty element like <hr/>.
buffer.write(' />');
if (element.tag == 'br') {
buffer.write('\n');
}
return false;
} else {
buffer.write('>');
return true;
}
}
@override
void visitElementAfter(Element element) {
buffer.write('</${element.tag}>');
}
/// Uniquifies an id generated from text.
String uniquifyId(String id) {
if (!uniqueIds.contains(id)) {
uniqueIds.add(id);
return id;
}
var suffix = 2;
var suffixedId = '$id-$suffix';
while (uniqueIds.contains(suffixedId)) {
suffixedId = '$id-${suffix++}';
}
uniqueIds.add(suffixedId);
return suffixedId;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,71 @@
import 'dart:convert';
import 'package:charcode/charcode.dart';
String escapeHtml(String html) =>
const HtmlEscape(HtmlEscapeMode.element).convert(html);
// Escape the contents of [value], so that it may be used as an HTML attribute.
// Based on http://spec.commonmark.org/0.28/#backslash-escapes.
String escapeAttribute(String value) {
final result = StringBuffer();
int ch;
for (var i = 0; i < value.codeUnits.length; i++) {
ch = value.codeUnitAt(i);
if (ch == $backslash) {
i++;
if (i == value.codeUnits.length) {
result.writeCharCode(ch);
break;
}
ch = value.codeUnitAt(i);
switch (ch) {
case $quote:
result.write('&quot;');
break;
case $exclamation:
case $hash:
case $dollar:
case $percent:
case $ampersand:
case $apostrophe:
case $lparen:
case $rparen:
case $asterisk:
case $plus:
case $comma:
case $dash:
case $dot:
case $slash:
case $colon:
case $semicolon:
case $lt:
case $equal:
case $gt:
case $question:
case $at:
case $lbracket:
case $backslash:
case $rbracket:
case $caret:
case $underscore:
case $backquote:
case $lbrace:
case $bar:
case $rbrace:
case $tilde:
result.writeCharCode(ch);
break;
default:
result.write('%5C');
result.writeCharCode(ch);
}
} else if (ch == $quote) {
result.write('%22');
} else {
result.writeCharCode(ch);
}
}
return result.toString();
}

View File

@ -0,0 +1,2 @@
// Generated code. Do not modify.
const packageVersion = '0.0.2';

View File

@ -0,0 +1,15 @@
import 'dart:async';
import 'package:dartz/dartz.dart';
import 'package:flowy_sdk/dispatch/dispatch.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace-infra/protobuf.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
class ShareRepo {
Future<Either<ExportData, WorkspaceError>> export(String docId, ExportType type) {
final request = ExportRequest.create()
..docId = docId
..exportType = type;
return WorkspaceEventExportDocument(request).send();
}
}

View File

@ -61,14 +61,22 @@ class FlowyNavigation extends StatelessWidget {
);
},
update: (_, notifier, controller) => controller!..update(notifier),
child: Row(children: [
Selector<NavigationNotifier, PublishNotifier<bool>>(
selector: (context, notifier) => notifier.collapasedNotifier,
builder: (ctx, collapsedNotifier, child) => _renderCollapse(ctx, collapsedNotifier)),
Selector<NavigationNotifier, List<NavigationItem>>(
child: Expanded(
child: Row(children: [
Selector<NavigationNotifier, PublishNotifier<bool>>(
selector: (context, notifier) => notifier.collapasedNotifier,
builder: (ctx, collapsedNotifier, child) => _renderCollapse(ctx, collapsedNotifier)),
Selector<NavigationNotifier, List<NavigationItem>>(
selector: (context, notifier) => notifier.navigationItems,
builder: (ctx, items, child) => Row(children: _renderNavigationItems(items))),
]),
builder: (ctx, items, child) => Expanded(
child: Row(
children: _renderNavigationItems(items),
// crossAxisAlignment: WrapCrossAlignment.start,
),
),
),
]),
),
);
}
@ -106,7 +114,13 @@ class FlowyNavigation extends StatelessWidget {
Widget last = NaviItemWidget(newItems.removeLast());
List<Widget> widgets = List.empty(growable: true);
widgets.addAll(newItems.map((item) => NaviItemDivider(child: NaviItemWidget(item))).toList());
// widgets.addAll(newItems.map((item) => NaviItemDivider(child: NaviItemWidget(item))).toList());
for (final item in newItems) {
widgets.add(NaviItemWidget(item));
widgets.add(const Text('/'));
}
widgets.add(last);
return widgets;
@ -129,39 +143,13 @@ class FlowyNavigation extends StatelessWidget {
}
}
class IconNaviItemWidget extends StatelessWidget {
final NavigationItem item;
const IconNaviItemWidget(this.item, {Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return SizedBox(
height: 24,
child: InkWell(
child: item.naviTitle,
onTap: () {
debugPrint('show app document');
},
).padding(horizontal: 8, vertical: 2),
);
}
}
class NaviItemWidget extends StatelessWidget {
final NavigationItem item;
const NaviItemWidget(this.item, {Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return SizedBox(
height: 24,
child: InkWell(
child: item.naviTitle,
onTap: () {
debugPrint('show app document');
},
).padding(horizontal: 8, vertical: 2),
);
return Expanded(child: item.leftBarItem.padding(horizontal: 2, vertical: 2));
}
}
@ -172,7 +160,7 @@ class NaviItemDivider extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Row(
children: [child, const Text('/').padding(horizontal: 2)],
children: [child, const Text('/')],
);
}
}
@ -184,7 +172,7 @@ class EllipsisNaviItem extends NavigationItem {
});
@override
Widget get naviTitle => const FlowyText.medium('...');
Widget get leftBarItem => const FlowyText.medium('...');
@override
NavigationCallback get action => (id) {};

View File

@ -9,10 +9,10 @@ class BlankStackContext extends HomeStackContext {
String get identifier => "1";
@override
Widget get naviTitle => const FlowyText.medium('Blank page', fontSize: 12);
Widget get leftBarItem => const FlowyText.medium('Blank page', fontSize: 12);
@override
Widget? Function(BuildContext context) get buildNaviAction => (_) => null;
Widget? get rightBarItem => null;
@override
HomeStackType get type => HomeStackType.blank;

View File

@ -1,15 +1,23 @@
import 'package:app_flowy/startup/startup.dart';
import 'package:app_flowy/workspace/application/doc/share_bloc.dart';
import 'package:app_flowy/workspace/domain/i_view.dart';
import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';
import 'package:app_flowy/workspace/domain/view_ext.dart';
import 'package:app_flowy/workspace/infrastructure/repos/view_repo.dart';
import 'package:app_flowy/workspace/presentation/widgets/dialogs.dart';
import 'package:app_flowy/workspace/presentation/widgets/pop_up_action.dart';
import 'package:flowy_infra/size.dart';
import 'package:flowy_infra/theme.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flowy_infra_ui/style_widget/text.dart';
import 'package:flowy_infra_ui/widget/rounded_button.dart';
import 'package:flowy_log/flowy_log.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace-infra/export.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace-infra/view_create.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace/errors.pb.dart';
import 'package:flutter/material.dart';
import 'package:dartz/dartz.dart' as dartz;
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:clipboard/clipboard.dart';
import 'doc_page.dart';
@ -33,10 +41,10 @@ class DocStackContext extends HomeStackContext<String, ShareActionWrapper> {
}
@override
Widget get naviTitle => FlowyText.medium(_view.name, fontSize: 12);
Widget get leftBarItem => DocLeftBarItem(view: _view);
@override
Widget? Function(BuildContext context) get buildNaviAction => _buildNaviAction;
Widget? get rightBarItem => DocShareButton(view: _view);
@override
String get identifier => _view.id;
@ -45,7 +53,7 @@ class DocStackContext extends HomeStackContext<String, ShareActionWrapper> {
HomeStackType get type => _view.stackType();
@override
Widget buildWidget() => DocStackPage(_view, key: ValueKey(_view.id));
Widget buildWidget() => DocPage(view: _view, key: ValueKey(_view.id));
@override
List<NavigationItem> get navigationItems => _makeNavigationItems();
@ -58,81 +66,163 @@ class DocStackContext extends HomeStackContext<String, ShareActionWrapper> {
// }).toList();
List<NavigationItem> _makeNavigationItems() {
return [this];
return [
this,
];
}
@override
void dispose() {
_listener.stop();
}
Widget _buildNaviAction(BuildContext context) {
return const DocShareButton();
}
}
class DocShareButton extends StatelessWidget {
const DocShareButton({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
double buttonWidth = 60;
return RoundedTextButton(
title: 'Share',
height: 30,
width: buttonWidth,
fontSize: 12,
borderRadius: Corners.s6Border,
color: Colors.lightBlue,
onPressed: () {
final actionList = ShareActions(onSelected: (result) {
result.fold(() {}, (action) {
switch (action) {
case ShareAction.markdown:
break;
case ShareAction.copyLink:
break;
}
});
});
actionList.show(
context,
context,
anchorDirection: AnchorDirection.bottomWithCenterAligned,
anchorOffset: Offset(-(buttonWidth / 2), 10),
);
},
);
}
}
class DocStackPage extends StatefulWidget {
class DocLeftBarItem extends StatefulWidget {
final View view;
const DocStackPage(this.view, {Key? key}) : super(key: key);
const DocLeftBarItem({required this.view, Key? key}) : super(key: key);
@override
_DocStackPageState createState() => _DocStackPageState();
State<DocLeftBarItem> createState() => _DocLeftBarItemState();
}
class _DocStackPageState extends State<DocStackPage> {
class _DocLeftBarItemState extends State<DocLeftBarItem> {
final _controller = TextEditingController();
final _focusNode = FocusNode();
late ViewRepository repo;
@override
Widget build(BuildContext context) {
return DocPage(view: widget.view);
void initState() {
repo = ViewRepository(view: widget.view);
_focusNode.addListener(_handleFocusChanged);
super.initState();
}
@override
void dispose() {
_controller.dispose();
_focusNode.dispose();
super.dispose();
}
@override
void deactivate() {
super.deactivate();
Widget build(BuildContext context) {
_controller.text = widget.view.name;
final theme = context.watch<AppTheme>();
return IntrinsicWidth(
child: TextField(
controller: _controller,
focusNode: _focusNode,
scrollPadding: EdgeInsets.zero,
decoration: const InputDecoration(
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
isDense: true,
),
style: TextStyle(
color: theme.shader1,
fontSize: 14,
fontWeight: FontWeight.w500,
overflow: TextOverflow.ellipsis,
),
// cursorColor: widget.cursorColor,
// obscureText: widget.enableObscure,
),
);
}
void _handleFocusChanged() {
if (_controller.text.isEmpty) {
_controller.text = widget.view.name;
return;
}
if (_controller.text != widget.view.name) {
repo.updateView(name: _controller.text);
}
}
}
class DocShareButton extends StatelessWidget {
final View view;
DocShareButton({Key? key, required this.view}) : super(key: ValueKey(view.id));
@override
void didUpdateWidget(covariant DocStackPage oldWidget) {
super.didUpdateWidget(oldWidget);
Widget build(BuildContext context) {
double buttonWidth = 60;
return BlocProvider(
create: (context) => getIt<DocShareBloc>(param1: view),
child: BlocListener<DocShareBloc, DocShareState>(
listener: (context, state) {
state.map(
initial: (_) {},
loading: (_) {},
finish: (state) {
state.successOrFail.fold(
_handleExportData,
_handleExportError,
);
},
);
},
child: BlocBuilder<DocShareBloc, DocShareState>(
builder: (context, state) {
return RoundedTextButton(
title: 'Share',
height: 30,
width: buttonWidth,
fontSize: 12,
borderRadius: Corners.s6Border,
color: Colors.lightBlue,
onPressed: () => _showActionList(context, Offset(-(buttonWidth / 2), 10)),
);
},
),
),
);
}
void _handleExportData(ExportData exportData) {
switch (exportData.exportType) {
case ExportType.Link:
// TODO: Handle this case.
break;
case ExportType.Markdown:
FlutterClipboard.copy(exportData.data).then((value) => Log.info('copied to clipboard'));
break;
case ExportType.Text:
// TODO: Handle this case.
break;
}
}
void _handleExportError(WorkspaceError error) {}
void _showActionList(BuildContext context, Offset offset) {
final actionList = ShareActions(onSelected: (result) {
result.fold(() {}, (action) {
switch (action) {
case ShareAction.markdown:
context.read<DocShareBloc>().add(const DocShareEvent.shareMarkdown());
break;
case ShareAction.copyLink:
showWorkInProgressDialog(context);
break;
}
});
});
actionList.show(
context,
context,
anchorDirection: AnchorDirection.bottomWithCenterAligned,
anchorOffset: offset,
);
}
void showWorkInProgressDialog(BuildContext context) {
const FlowyAlertDialog(title: "Work in progress").show(context);
}
}
@ -140,9 +230,7 @@ class ShareActions with ActionList<ShareActionWrapper> implements FlowyOverlayDe
final Function(dartz.Option<ShareAction>) onSelected;
final _items = ShareAction.values.map((action) => ShareActionWrapper(action)).toList();
ShareActions({
required this.onSelected,
});
ShareActions({required this.onSelected});
@override
double get maxWidth => 130;
@ -167,12 +255,7 @@ class ShareActions with ActionList<ShareActionWrapper> implements FlowyOverlayDe
FlowyOverlayDelegate? get delegate => this;
@override
void didRemove() {
onSelected(dartz.none());
}
@override
ListOverlayFooter? get footer => null;
void didRemove() => onSelected(dartz.none());
}
enum ShareAction {

View File

@ -26,10 +26,10 @@ class TrashStackContext extends HomeStackContext {
String get identifier => "TrashStackContext";
@override
Widget get naviTitle => const FlowyText.medium('Trash', fontSize: 12);
Widget get leftBarItem => const FlowyText.medium('Trash', fontSize: 12);
@override
Widget? Function(BuildContext context) get buildNaviAction => (_) => null;
Widget? get rightBarItem => null;
@override
HomeStackType get type => HomeStackType.trash;

View File

@ -53,7 +53,8 @@ class _CreateTextFieldDialog extends State<TextFieldDialog> {
VSpace(Insets.sm * 1.5),
],
FlowyFormTextInput(
hintText: widget.value,
hintText: "Page name",
initialValue: widget.value,
textStyle: const TextStyle(fontSize: 24, fontWeight: FontWeight.w400),
autoFocus: true,
onChanged: (text) {
@ -77,6 +78,52 @@ class _CreateTextFieldDialog extends State<TextFieldDialog> {
}
}
class FlowyAlertDialog extends StatefulWidget {
final String title;
final void Function()? cancel;
final void Function()? confirm;
const FlowyAlertDialog({
required this.title,
this.confirm,
this.cancel,
Key? key,
}) : super(key: key);
@override
State<FlowyAlertDialog> createState() => _CreateFlowyAlertDialog();
}
class _CreateFlowyAlertDialog extends State<FlowyAlertDialog> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
final theme = context.watch<AppTheme>();
return StyledDialog(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
...[
FlowyText.medium(widget.title, color: theme.shader4),
],
if (widget.confirm != null) ...[
const VSpace(20),
OkCancelButton(
onOkPressed: widget.confirm!,
onCancelPressed: widget.confirm,
)
]
],
),
);
}
}
class OkCancelDialog extends StatelessWidget {
final VoidCallback? onOkPressed;
final VoidCallback? onCancelPressed;

View File

@ -21,12 +21,12 @@ class HomeTopBar extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const FlowyNavigation(),
const Spacer(),
const HSpace(16),
ChangeNotifierProvider.value(
value: Provider.of<HomeStackNotifier>(context, listen: false),
child: Consumer(
builder: (BuildContext context, HomeStackNotifier notifier, Widget? child) {
return notifier.stackContext.buildNaviAction(context) ?? const SizedBox();
return notifier.stackContext.rightBarItem ?? const SizedBox();
},
),
) // _renderMoreButton(),

View File

@ -98,11 +98,14 @@ class MenuAppHeader extends StatelessWidget {
}
Widget _renderAddButton(BuildContext context) {
return AddButton(
onSelected: (viewType) {
context.read<AppBloc>().add(AppEvent.createView("New view", "", viewType));
},
).padding(right: MenuAppSizes.headerPadding);
return Tooltip(
message: "Quickly add a page inside",
child: AddButton(
onSelected: (viewType) {
context.read<AppBloc>().add(AppEvent.createView("New view", "", viewType));
},
).padding(right: MenuAppSizes.headerPadding),
);
}
void _handleAction(BuildContext context, Option<AppDisclosureAction> action) {

View File

@ -32,9 +32,6 @@ class AppDisclosureActionSheet with ActionList<DisclosureActionWrapper> implemen
void didRemove() {
onSelected(dartz.none());
}
@override
ListOverlayFooter? get footer => null;
}
class DisclosureActionWrapper extends ActionItem {

View File

@ -52,9 +52,6 @@ class ViewDisclosureButton extends StatelessWidget
void didRemove() {
onSelected(dartz.none());
}
@override
ListOverlayFooter? get footer => null;
}
class ViewDisclosureActionWrapper extends ActionItem {

View File

@ -56,11 +56,10 @@ class ViewSectionItem extends StatelessWidget {
List<Widget> children = [
SizedBox(width: 16, height: 16, child: state.view.thumbnail()),
const HSpace(2),
FlowyText.regular(state.view.name, fontSize: 12),
Expanded(child: FlowyText.regular(state.view.name, fontSize: 12)),
];
if (onHover || state.isEditing) {
children.add(const Spacer());
children.add(
ViewDisclosureButton(
onTap: () => context.read<ViewBloc>().add(const ViewEvent.setIsEditing(true)),

View File

@ -17,7 +17,7 @@ abstract class ActionList<T extends ActionItem> {
double get itemHeight => ActionListSizes.itemHeight;
ListOverlayFooter? get footer;
ListOverlayFooter? get footer => null;
void Function(dartz.Option<T>) get selectCallback;

View File

@ -10,8 +10,7 @@ import 'package:provider/provider.dart';
import 'package:textstyle_extensions/textstyle_extensions.dart';
class FlowyFormTextInput extends StatelessWidget {
static EdgeInsets kDefaultTextInputPadding =
EdgeInsets.only(bottom: Insets.sm, top: 4);
static EdgeInsets kDefaultTextInputPadding = EdgeInsets.only(bottom: Insets.sm, top: 4);
final String? label;
final bool? autoFocus;
@ -61,8 +60,7 @@ class FlowyFormTextInput extends StatelessWidget {
inputDecoration: InputDecoration(
isDense: true,
contentPadding: contentPadding ?? kDefaultTextInputPadding,
border: const ThinUnderlineBorder(
borderSide: BorderSide(width: 5, color: Colors.red)),
border: const ThinUnderlineBorder(borderSide: BorderSide(width: 5, color: Colors.red)),
//focusedBorder: UnderlineInputBorder(borderSide: BorderSide(width: .5, color: Colors.red)),
hintText: hintText,
),
@ -143,8 +141,7 @@ class StyledSearchTextInputState extends State<StyledSearchTextInput> {
@override
void initState() {
_controller =
widget.controller ?? TextEditingController(text: widget.initialValue);
_controller = widget.controller ?? TextEditingController(text: widget.initialValue);
_focusNode = FocusNode(
debugLabel: widget.label ?? '',
onKey: (FocusNode node, RawKeyEvent evt) {
@ -160,8 +157,7 @@ class StyledSearchTextInputState extends State<StyledSearchTextInput> {
canRequestFocus: true,
);
// Listen for focus out events
_focusNode
.addListener(() => widget.onFocusChanged?.call(_focusNode.hasFocus));
_focusNode.addListener(() => widget.onFocusChanged?.call(_focusNode.hasFocus));
widget.onFocusCreated?.call(_focusNode);
if (widget.autoFocus ?? false) {
scheduleMicrotask(() => _focusNode.requestFocus());
@ -210,8 +206,7 @@ class StyledSearchTextInputState extends State<StyledSearchTextInput> {
InputDecoration(
prefixIcon: widget.prefixIcon,
suffixIcon: widget.suffixIcon,
contentPadding:
widget.contentPadding ?? EdgeInsets.all(Insets.m),
contentPadding: widget.contentPadding ?? EdgeInsets.all(Insets.m),
border: const OutlineInputBorder(borderSide: BorderSide.none),
isDense: true,
icon: widget.icon == null ? null : Icon(widget.icon),
@ -259,8 +254,7 @@ class ThinUnderlineBorder extends InputBorder {
bool get isOutline => false;
@override
UnderlineInputBorder copyWith(
{BorderSide? borderSide, BorderRadius? borderRadius}) {
UnderlineInputBorder copyWith({BorderSide? borderSide, BorderRadius? borderRadius}) {
return UnderlineInputBorder(
borderSide: borderSide ?? this.borderSide,
borderRadius: borderRadius ?? this.borderRadius,
@ -280,8 +274,7 @@ class ThinUnderlineBorder extends InputBorder {
@override
Path getInnerPath(Rect rect, {TextDirection? textDirection}) {
return Path()
..addRect(Rect.fromLTWH(rect.left, rect.top, rect.width,
math.max(0.0, rect.height - borderSide.width)));
..addRect(Rect.fromLTWH(rect.left, rect.top, rect.width, math.max(0.0, rect.height - borderSide.width)));
}
@override
@ -292,8 +285,7 @@ class ThinUnderlineBorder extends InputBorder {
@override
ShapeBorder? lerpFrom(ShapeBorder? a, double t) {
if (a is UnderlineInputBorder) {
final newBorderRadius =
BorderRadius.lerp(a.borderRadius, borderRadius, t);
final newBorderRadius = BorderRadius.lerp(a.borderRadius, borderRadius, t);
if (newBorderRadius != null) {
return UnderlineInputBorder(
@ -308,8 +300,7 @@ class ThinUnderlineBorder extends InputBorder {
@override
ShapeBorder? lerpTo(ShapeBorder? b, double t) {
if (b is UnderlineInputBorder) {
final newBorderRadius =
BorderRadius.lerp(b.borderRadius, borderRadius, t);
final newBorderRadius = BorderRadius.lerp(b.borderRadius, borderRadius, t);
if (newBorderRadius != null) {
return UnderlineInputBorder(
borderSide: BorderSide.lerp(borderSide, b.borderSide, t),
@ -335,8 +326,7 @@ class ThinUnderlineBorder extends InputBorder {
double gapPercentage = 0.0,
TextDirection? textDirection,
}) {
if (borderRadius.bottomLeft != Radius.zero ||
borderRadius.bottomRight != Radius.zero) {
if (borderRadius.bottomLeft != Radius.zero || borderRadius.bottomRight != Radius.zero) {
canvas.clipPath(getOuterPath(rect, textDirection: textDirection));
}
canvas.drawLine(rect.bottomLeft, rect.bottomRight, borderSide.toPaint());

View File

@ -17,12 +17,15 @@ class RoundedInputField extends StatefulWidget {
final String errorText;
final TextStyle style;
final ValueChanged<String>? onChanged;
final String? initialValue;
late bool enableObscure;
var _text = "";
RoundedInputField({
Key? key,
this.hintText,
this.errorText = "",
this.initialValue,
this.icon,
this.obscureText = false,
this.obscureIcon,
@ -32,7 +35,6 @@ class RoundedInputField extends StatefulWidget {
this.highlightBorderColor = Colors.transparent,
this.cursorColor = Colors.black,
this.style = const TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
this.errorText = "",
}) : super(key: key) {
enableObscure = obscureText;
}
@ -62,6 +64,7 @@ class _RoundedInputFieldState extends State<RoundedInputField> {
borderRadius: Corners.s10Border,
borderColor: borderColor,
child: TextFormField(
initialValue: widget.initialValue,
onChanged: (value) {
widget._text = value;
if (widget.onChanged != null) {

View File

@ -77,17 +77,22 @@ class ExportRequest extends $pb.GeneratedMessage {
class ExportData extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ExportData', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'data')
..e<ExportType>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'exportType', $pb.PbFieldType.OE, defaultOrMaker: ExportType.Text, valueOf: ExportType.valueOf, enumValues: ExportType.values)
..hasRequiredFields = false
;
ExportData._() : super();
factory ExportData({
$core.String? data,
ExportType? exportType,
}) {
final _result = create();
if (data != null) {
_result.data = data;
}
if (exportType != null) {
_result.exportType = exportType;
}
return _result;
}
factory ExportData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
@ -119,5 +124,14 @@ class ExportData extends $pb.GeneratedMessage {
$core.bool hasData() => $_has(0);
@$pb.TagNumber(1)
void clearData() => clearField(1);
@$pb.TagNumber(2)
ExportType get exportType => $_getN(1);
@$pb.TagNumber(2)
set exportType(ExportType v) { setField(2, v); }
@$pb.TagNumber(2)
$core.bool hasExportType() => $_has(1);
@$pb.TagNumber(2)
void clearExportType() => clearField(2);
}

View File

@ -11,11 +11,13 @@ import 'package:protobuf/protobuf.dart' as $pb;
class ExportType extends $pb.ProtobufEnum {
static const ExportType Text = ExportType._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Text');
static const ExportType RichText = ExportType._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'RichText');
static const ExportType Markdown = ExportType._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Markdown');
static const ExportType Link = ExportType._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Link');
static const $core.List<ExportType> values = <ExportType> [
Text,
RichText,
Markdown,
Link,
];
static final $core.Map<$core.int, ExportType> _byValue = $pb.ProtobufEnum.initByValue(values);

View File

@ -13,12 +13,13 @@ const ExportType$json = const {
'1': 'ExportType',
'2': const [
const {'1': 'Text', '2': 0},
const {'1': 'RichText', '2': 1},
const {'1': 'Markdown', '2': 1},
const {'1': 'Link', '2': 2},
],
};
/// Descriptor for `ExportType`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List exportTypeDescriptor = $convert.base64Decode('CgpFeHBvcnRUeXBlEggKBFRleHQQABIMCghSaWNoVGV4dBAB');
final $typed_data.Uint8List exportTypeDescriptor = $convert.base64Decode('CgpFeHBvcnRUeXBlEggKBFRleHQQABIMCghNYXJrZG93bhABEggKBExpbmsQAg==');
@$core.Deprecated('Use exportRequestDescriptor instead')
const ExportRequest$json = const {
'1': 'ExportRequest',
@ -35,8 +36,9 @@ const ExportData$json = const {
'1': 'ExportData',
'2': const [
const {'1': 'data', '3': 1, '4': 1, '5': 9, '10': 'data'},
const {'1': 'export_type', '3': 2, '4': 1, '5': 14, '6': '.ExportType', '10': 'exportType'},
],
};
/// Descriptor for `ExportData`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List exportDataDescriptor = $convert.base64Decode('CgpFeHBvcnREYXRhEhIKBGRhdGEYASABKAlSBGRhdGE=');
final $typed_data.Uint8List exportDataDescriptor = $convert.base64Decode('CgpFeHBvcnREYXRhEhIKBGRhdGEYASABKAlSBGRhdGESLAoLZXhwb3J0X3R5cGUYAiABKA4yCy5FeHBvcnRUeXBlUgpleHBvcnRUeXBl');

File diff suppressed because it is too large Load Diff

View File

@ -65,6 +65,8 @@ dependencies:
package_info_plus: ^1.3.0
url_launcher: ^6.0.2
avatars: ^2.0.0
# file_picker: ^4.2.1
clipboard: ^0.1.3
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.

View File

@ -8,7 +8,7 @@
#include <flowy_editor/flowy_editor_plugin.h>
#include <flowy_infra_ui/flowy_infra_u_i_plugin.h>
#include <url_launcher_windows/url_launcher_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>
#include <window_size/window_size_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
@ -16,8 +16,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("FlowyEditorPlugin"));
FlowyInfraUIPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlowyInfraUIPlugin"));
UrlLauncherPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
WindowSizePluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("WindowSizePlugin"));
}

1
delta_markdown Submodule

@ -0,0 +1 @@
Subproject commit 3e121c546fe40f91e9817ad0e0f04910315db681

BIN
doc/imgs/run.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -5,7 +5,8 @@ use std::convert::TryInto;
#[derive(PartialEq, Debug, ProtoBuf_Enum, Clone)]
pub enum ExportType {
Text = 0,
RichText = 1,
Markdown = 1,
Link = 2,
}
impl std::default::Default for ExportType {
@ -16,7 +17,8 @@ impl std::convert::From<i32> for ExportType {
fn from(val: i32) -> Self {
match val {
0 => ExportType::Text,
1 => ExportType::RichText,
1 => ExportType::Markdown,
2 => ExportType::Link,
_ => {
log::error!("Invalid export type: {}", val);
ExportType::Text
@ -54,4 +56,7 @@ impl TryInto<ExportParams> for ExportRequest {
pub struct ExportData {
#[pb(index = 1)]
pub data: String,
#[pb(index = 2)]
pub export_type: ExportType,
}

View File

@ -217,6 +217,7 @@ impl ::protobuf::reflect::ProtobufValue for ExportRequest {
pub struct ExportData {
// message fields
pub data: ::std::string::String,
pub export_type: ExportType,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
@ -258,6 +259,21 @@ impl ExportData {
pub fn take_data(&mut self) -> ::std::string::String {
::std::mem::replace(&mut self.data, ::std::string::String::new())
}
// .ExportType export_type = 2;
pub fn get_export_type(&self) -> ExportType {
self.export_type
}
pub fn clear_export_type(&mut self) {
self.export_type = ExportType::Text;
}
// Param is passed by value, moved
pub fn set_export_type(&mut self, v: ExportType) {
self.export_type = v;
}
}
impl ::protobuf::Message for ExportData {
@ -272,6 +288,9 @@ impl ::protobuf::Message for ExportData {
1 => {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.data)?;
},
2 => {
::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.export_type, 2, &mut self.unknown_fields)?
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
},
@ -287,6 +306,9 @@ impl ::protobuf::Message for ExportData {
if !self.data.is_empty() {
my_size += ::protobuf::rt::string_size(1, &self.data);
}
if self.export_type != ExportType::Text {
my_size += ::protobuf::rt::enum_size(2, self.export_type);
}
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size);
my_size
@ -296,6 +318,9 @@ impl ::protobuf::Message for ExportData {
if !self.data.is_empty() {
os.write_string(1, &self.data)?;
}
if self.export_type != ExportType::Text {
os.write_enum(2, ::protobuf::ProtobufEnum::value(&self.export_type))?;
}
os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(())
}
@ -339,6 +364,11 @@ impl ::protobuf::Message for ExportData {
|m: &ExportData| { &m.data },
|m: &mut ExportData| { &mut m.data },
));
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum<ExportType>>(
"export_type",
|m: &ExportData| { &m.export_type },
|m: &mut ExportData| { &mut m.export_type },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<ExportData>(
"ExportData",
fields,
@ -356,6 +386,7 @@ impl ::protobuf::Message for ExportData {
impl ::protobuf::Clear for ExportData {
fn clear(&mut self) {
self.data.clear();
self.export_type = ExportType::Text;
self.unknown_fields.clear();
}
}
@ -375,7 +406,8 @@ impl ::protobuf::reflect::ProtobufValue for ExportData {
#[derive(Clone,PartialEq,Eq,Debug,Hash)]
pub enum ExportType {
Text = 0,
RichText = 1,
Markdown = 1,
Link = 2,
}
impl ::protobuf::ProtobufEnum for ExportType {
@ -386,7 +418,8 @@ impl ::protobuf::ProtobufEnum for ExportType {
fn from_i32(value: i32) -> ::std::option::Option<ExportType> {
match value {
0 => ::std::option::Option::Some(ExportType::Text),
1 => ::std::option::Option::Some(ExportType::RichText),
1 => ::std::option::Option::Some(ExportType::Markdown),
2 => ::std::option::Option::Some(ExportType::Link),
_ => ::std::option::Option::None
}
}
@ -394,7 +427,8 @@ impl ::protobuf::ProtobufEnum for ExportType {
fn values() -> &'static [Self] {
static values: &'static [ExportType] = &[
ExportType::Text,
ExportType::RichText,
ExportType::Markdown,
ExportType::Link,
];
values
}
@ -425,25 +459,31 @@ impl ::protobuf::reflect::ProtobufValue for ExportType {
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x0cexport.proto\"T\n\rExportRequest\x12\x15\n\x06doc_id\x18\x01\x20\
\x01(\tR\x05docId\x12,\n\x0bexport_type\x18\x02\x20\x01(\x0e2\x0b.Export\
TypeR\nexportType\"\x20\n\nExportData\x12\x12\n\x04data\x18\x01\x20\x01(\
\tR\x04data*$\n\nExportType\x12\x08\n\x04Text\x10\0\x12\x0c\n\x08RichTex\
t\x10\x01J\xd1\x02\n\x06\x12\x04\0\0\x0c\x01\n\x08\n\x01\x0c\x12\x03\0\0\
\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x05\x01\n\n\n\x03\x04\0\x01\x12\x03\
\x02\x08\x15\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\x04\x16\n\x0c\n\x05\x04\
\0\x02\0\x05\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x03\
\x0b\x11\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\x14\x15\n\x0b\n\x04\x04\
\0\x02\x01\x12\x03\x04\x04\x1f\n\x0c\n\x05\x04\0\x02\x01\x06\x12\x03\x04\
\x04\x0e\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x04\x0f\x1a\n\x0c\n\x05\
\x04\0\x02\x01\x03\x12\x03\x04\x1d\x1e\n\n\n\x02\x04\x01\x12\x04\x06\0\
\x08\x01\n\n\n\x03\x04\x01\x01\x12\x03\x06\x08\x12\n\x0b\n\x04\x04\x01\
\x02\0\x12\x03\x07\x04\x14\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\x07\x04\
\n\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x07\x0b\x0f\n\x0c\n\x05\x04\x01\
\x02\0\x03\x12\x03\x07\x12\x13\n\n\n\x02\x05\0\x12\x04\t\0\x0c\x01\n\n\n\
\x03\x05\0\x01\x12\x03\t\x05\x0f\n\x0b\n\x04\x05\0\x02\0\x12\x03\n\x04\r\
\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03\n\x04\x08\n\x0c\n\x05\x05\0\x02\0\
\x02\x12\x03\n\x0b\x0c\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x0b\x04\x11\n\
\x0c\n\x05\x05\0\x02\x01\x01\x12\x03\x0b\x04\x0c\n\x0c\n\x05\x05\0\x02\
\x01\x02\x12\x03\x0b\x0f\x10b\x06proto3\
TypeR\nexportType\"N\n\nExportData\x12\x12\n\x04data\x18\x01\x20\x01(\tR\
\x04data\x12,\n\x0bexport_type\x18\x02\x20\x01(\x0e2\x0b.ExportTypeR\nex\
portType*.\n\nExportType\x12\x08\n\x04Text\x10\0\x12\x0c\n\x08Markdown\
\x10\x01\x12\x08\n\x04Link\x10\x02J\xb1\x03\n\x06\x12\x04\0\0\x0e\x01\n\
\x08\n\x01\x0c\x12\x03\0\0\x12\n\n\n\x02\x04\0\x12\x04\x02\0\x05\x01\n\n\
\n\x03\x04\0\x01\x12\x03\x02\x08\x15\n\x0b\n\x04\x04\0\x02\0\x12\x03\x03\
\x04\x16\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x03\x04\n\n\x0c\n\x05\x04\0\
\x02\0\x01\x12\x03\x03\x0b\x11\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x03\
\x14\x15\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x04\x04\x1f\n\x0c\n\x05\x04\0\
\x02\x01\x06\x12\x03\x04\x04\x0e\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\
\x04\x0f\x1a\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x04\x1d\x1e\n\n\n\x02\
\x04\x01\x12\x04\x06\0\t\x01\n\n\n\x03\x04\x01\x01\x12\x03\x06\x08\x12\n\
\x0b\n\x04\x04\x01\x02\0\x12\x03\x07\x04\x14\n\x0c\n\x05\x04\x01\x02\0\
\x05\x12\x03\x07\x04\n\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x07\x0b\x0f\
\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x07\x12\x13\n\x0b\n\x04\x04\x01\
\x02\x01\x12\x03\x08\x04\x1f\n\x0c\n\x05\x04\x01\x02\x01\x06\x12\x03\x08\
\x04\x0e\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x08\x0f\x1a\n\x0c\n\x05\
\x04\x01\x02\x01\x03\x12\x03\x08\x1d\x1e\n\n\n\x02\x05\0\x12\x04\n\0\x0e\
\x01\n\n\n\x03\x05\0\x01\x12\x03\n\x05\x0f\n\x0b\n\x04\x05\0\x02\0\x12\
\x03\x0b\x04\r\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03\x0b\x04\x08\n\x0c\n\
\x05\x05\0\x02\0\x02\x12\x03\x0b\x0b\x0c\n\x0b\n\x04\x05\0\x02\x01\x12\
\x03\x0c\x04\x11\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03\x0c\x04\x0c\n\x0c\
\n\x05\x05\0\x02\x01\x02\x12\x03\x0c\x0f\x10\n\x0b\n\x04\x05\0\x02\x02\
\x12\x03\r\x04\r\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03\r\x04\x08\n\x0c\n\
\x05\x05\0\x02\x02\x02\x12\x03\r\x0b\x0cb\x06proto3\
";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -6,8 +6,10 @@ message ExportRequest {
}
message ExportData {
string data = 1;
ExportType export_type = 2;
}
enum ExportType {
Text = 0;
RichText = 1;
Markdown = 1;
Link = 2;
}

View File

@ -147,7 +147,10 @@ impl ViewController {
.read_document_data(doc_identifier, self.database.db_pool()?)
.await?;
Ok(ExportData { data: doc.data })
Ok(ExportData {
data: doc.data,
export_type: params.export_type,
})
}
// belong_to_id will be the app_id or view_id.