Skip to content

Commit

Permalink
docs: Return to the explanation of normal usage instead of method chain.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Aug 24, 2023
1 parent be9816d commit ed8a4fc
Show file tree
Hide file tree
Showing 72 changed files with 1,646 additions and 1,376 deletions.
34 changes: 18 additions & 16 deletions README.md
Expand Up @@ -203,8 +203,8 @@ class TestPage extends PageScopedWidget {
/// Used to transition to the TestPage screen.
///
/// ```dart
/// TestPage.query(parameters).push(router); // Push page to TestPage.
/// TestPage.query(parameters).replace(router); // Replace page to TestPage.
/// router.push(TestPage.query(parameters)); // Push page to TestPage.
/// router.replace(TestPage.query(parameters)); // Replace page to TestPage.
/// ```
@pageRouteQuery
static const query = _$TestPageQuery();
Expand Down Expand Up @@ -353,26 +353,28 @@ class TestModel with _$TestModel {
/// Query for document.
///
/// ```dart
/// TestModel.document(id).read(appRef); // Get the document.
/// TestModel.document(id).watch(ref)..load(); // Load the document.
/// appRef.model(TestModel.document(id)); // Get the document.
/// ref.model(TestModel.document(id))..load(); // Load the document.
/// ```
static const document = _$TestModelDocumentQuery();

/// Query for collection.
///
/// ```dart
/// TestModel.collection().read(appRef); // Get the collection.
/// TestModel.collection().watch(ref)..load(); // Load the collection.
/// TestModel.collection().data.equal(
/// "data",
/// ).watch(ref)..load(); // Load the collection with filter.
/// appRef.model(TestModel.collection()); // Get the collection.
/// ref.model(TestModel.collection())..load(); // Load the collection.
/// ref.model(
/// TestModel.collection().data.equal(
/// "data",
/// )
/// )..load(); // Load the collection with filter.
/// ```
static const collection = _$TestModelCollectionQuery();

/// Query for form value.
///
/// ```dart
/// TestModel.form(TestModel()).watch(ref); // Get the form controller.
/// ref.page.controller(TestModel.form(TestModel())); // Get the form controller.
/// ```
static const form = _$TestModelFormQuery();
}
Expand Down Expand Up @@ -503,7 +505,7 @@ It can also be written concisely in a method chain by using the `watch` and `rea

```dart
final testModelCollection = TestModel.collection().watch(ref);
final testModelCollection = TestModel.collection().read(appRef);
final testModelCollection = appRef.model(TestModel.collection());
```

### SharedPreferences feature
Expand Down Expand Up @@ -601,9 +603,9 @@ class TestController extends ChangeNotifier {
/// Query for TestController.
///
/// ```dart
/// TestController.query(parameters).read(appRef); // Get from application scope.
/// TestController.query(parameters).watchOnApp(ref); // Watch at application scope.
/// TestController.query(parameters).watchOnPage(ref); // Watch at page scope.
/// appRef.controller(TestController.query(parameters)); // Get from application scope.
/// ref.app.controller(TestController.query(parameters)); // Watch at application scope.
/// ref.page.controller(TestController.query(parameters)); // Watch at page scope.
/// ```
static const query = _$TestControllerQuery();
}
Expand Down Expand Up @@ -812,7 +814,7 @@ When creating a form that targets a `data model`, such as editing profile data,
/// Query for form value.
///
/// ```dart
/// TestModel.form(TestModel()).watch(ref); // Get the form controller.
/// ref.page.controller(TestModel.form(TestModel())); // Get the form controller.
/// ```
static const form = _$TestModelFormQuery();
```
Expand Down Expand Up @@ -875,7 +877,7 @@ class LoginValue with _$LoginValue {
/// Query for form value.
///
/// ```dart
/// LoginValue.form(LoginValue()).watch(ref); // Get the form controller.
/// ref.page.controller(LoginValue.form(LoginValue())); // Get the form controller.
/// ```
static const form = _$LoginValueFormQuery();
}
Expand Down
14 changes: 7 additions & 7 deletions packages/katana_cli/lib/command/code/collection.dart
Expand Up @@ -91,26 +91,26 @@ class ${className}Model with _\$${className}Model {
/// Query for document.
///
/// ```dart
/// ${className}Model.document(id).read(appRef); // Get the document.
/// ${className}Model.document(id).watch(ref)..load(); // Load the document.
/// appRef.model(${className}Model.document(id)); // Get the document.
/// ref.model(${className}Model.document(id))..load(); // Load the document.
/// ```
static const document = _\$${className}ModelDocumentQuery();
/// Query for collection.
///
/// ```dart
/// ${className}Model.collection().read(appRef); // Get the collection.
/// ${className}Model.collection().watch(ref)..load(); // Load the collection.
/// ${className}Model.collection().data.equal(
/// appRef.model(${className}Model.collection()); // Get the collection.
/// ref.model(${className}Model.collection())..load(); // Load the collection.
/// ref.model(${className}Model.collection().data.equal(
/// "data",
/// ).watch(ref)..load(); // Load the collection with filter.
/// ))..load(); // Load the collection with filter.
/// ```
static const collection = _\$${className}ModelCollectionQuery();
/// Query for form value.
///
/// ```dart
/// ${className}Model.form(${className}Model()).watch(ref); // Get the form controller.
/// ref.page.controller(${className}Model.form(${className}Model())); // Get the form controller.
/// ```
static const form = _\$${className}ModelFormQuery();
}
Expand Down
6 changes: 3 additions & 3 deletions packages/katana_cli/lib/command/code/controller.dart
Expand Up @@ -79,9 +79,9 @@ class ${className}Controller extends ChangeNotifier {
/// Query for ${className}Controller.
///
/// ```dart
/// ${className}Controller.query(parameters).read(appRef); // Get from application scope.
/// ${className}Controller.query(parameters).watchOnApp(ref); // Watch at application scope.
/// ${className}Controller.query(parameters).watchOnPage(ref); // Watch at page scope.
/// appRef.controller(${className}Controller.query(parameters)); // Get from application scope.
/// ref.app.controller(${className}Controller.query(parameters)); // Watch at application scope.
/// ref.page.controller(${className}Controller.query(parameters)); // Watch at page scope.
/// ```
static const query = _\$${className}ControllerQuery();
}
Expand Down
6 changes: 3 additions & 3 deletions packages/katana_cli/lib/command/code/document.dart
Expand Up @@ -95,15 +95,15 @@ class ${className}Model with _\$${className}Model {
/// Query for document.
///
/// ```dart
/// ${className}Model.document().read(appRef); // Get the document.
/// ${className}Model.document().watch(ref); // Load the document.
/// appRef.model(${className}Model.document()); // Get the document.
/// ref.model(${className}Model.document())..load(); // Load the document.
/// ```
static const document = _\$${className}ModelDocumentQuery();
/// Query for form value.
///
/// ```dart
/// ${className}Model.form(${className}Model()).watch(ref); // Get the form controller.
/// ref.page.controller(${className}Model.form(${className}Model())); // Get the form controller.
/// ```
static const form = _\$${className}ModelFormQuery();
}
Expand Down
6 changes: 3 additions & 3 deletions packages/katana_cli/lib/command/code/group.dart
Expand Up @@ -79,9 +79,9 @@ class ${className}ControllerGroup with _\$${className}ControllerGroup, ChangeNot
/// Query for ${className}ControllerGroup.
///
/// ```dart
/// ${className}ControllerGroup.query(parameters).read(appRef); // Get from application scope.
/// ${className}ControllerGroup.query(parameters).watchOnApp(ref); // Watch at application scope.
/// ${className}ControllerGroup.query(parameters).watchOnPage(ref); // Watch at page scope.
/// appRef.controller(${className}ControllerGroup.query(parameters)); // Get from application scope.
/// ref.app.controller(${className}ControllerGroup.query(parameters)); // Watch at application scope.
/// ref.page.controller(${className}ControllerGroup.query(parameters)); // Watch at page scope.
/// ```
static const query = _\$${className}ControllerGroupQuery();
}
Expand Down
4 changes: 2 additions & 2 deletions packages/katana_cli/lib/command/code/page.dart
Expand Up @@ -82,8 +82,8 @@ class ${className}Page extends PageScopedWidget {
/// Used to transition to the ${className}Page screen.
///
/// ```dart
/// ${className}Page.query(parameters).push(router); // Push page to ${className}Page.
/// ${className}Page.query(parameters).replace(router); // Replace page to ${className}Page.
/// router.push(${className}Page.query(parameters)); // Push page to ${className}Page.
/// router.replace(${className}Page.query(parameters)); // Replace page to ${className}Page.
/// ```
@pageRouteQuery
static const query = _\$${className}PageQuery();
Expand Down
16 changes: 8 additions & 8 deletions packages/katana_cli/lib/command/code/tmp/basic.dart
Expand Up @@ -73,8 +73,8 @@ class ${className}Page extends PageScopedWidget {
/// Used to transition to the ${className}Page screen.
///
/// ```dart
/// ${className}Page.query(parameters).push(router); // Push page to ${className}Page.
/// ${className}Page.query(parameters).replace(router); // Replace page to ${className}Page.
/// router.push(${className}Page.query(parameters)); // Push page to ${className}Page.
/// router.replace(${className}Page.query(parameters)); // Replace page to ${className}Page.
/// ```
@pageRouteQuery
static const query = _\$${className}PageQuery();
Expand Down Expand Up @@ -136,8 +136,8 @@ class ${className}DetailPage extends PageScopedWidget {
/// Used to transition to the ${className}DetailPage screen.
///
/// ```dart
/// ${className}DetailPage.query(parameters).push(router); // Push page to ${className}DetailPage.
/// ${className}DetailPage.query(parameters).replace(router); // Replace page to ${className}DetailPage.
/// router.push(${className}DetailPage.query(parameters)); // Push page to ${className}DetailPage.
/// router.replace(${className}DetailPage.query(parameters)); // Replace page to ${className}DetailPage.
/// ```
@pageRouteQuery
static const query = _\$${className}DetailPageQuery();
Expand Down Expand Up @@ -166,8 +166,8 @@ class ${className}AddPage extends FormAddPageScopedWidget {
/// Used to transition to the ${className}AddPage screen.
///
/// ```dart
/// ${className}AddPage.query(parameters).push(router); // Push page to ${className}AddPage.
/// ${className}AddPage.query(parameters).replace(router); // Replace page to ${className}AddPage.
/// router.push(${className}AddPage.query(parameters)); // Push page to ${className}AddPage.
/// router.replace(${className}AddPage.query(parameters)); // Replace page to ${className}AddPage.
/// ```
@pageRouteQuery
static const query = _\$${className}AddPageQuery();
Expand All @@ -189,8 +189,8 @@ class ${className}EditPage extends FormEditPageScopedWidget {
/// Used to transition to the ${className}EditPage screen.
///
/// ```dart
/// ${className}EditPage.query(parameters).push(router); // Push page to ${className}EditPage.
/// ${className}EditPage.query(parameters).replace(router); // Replace page to ${className}EditPage.
/// router.push(${className}EditPage.query(parameters)); // Push page to ${className}EditPage.
/// router.replace(${className}EditPage.query(parameters)); // Replace page to ${className}EditPage.
/// ```
@pageRouteQuery
static const query = _\$${className}EditPageQuery();
Expand Down
8 changes: 4 additions & 4 deletions packages/katana_cli/lib/command/code/tmp/form.dart
Expand Up @@ -70,8 +70,8 @@ class ${className}AddPage extends FormAddPageScopedWidget {
/// Used to transition to the ${className}AddPage screen.
///
/// ```dart
/// ${className}AddPage.query(parameters).push(router); // Push page to ${className}AddPage.
/// ${className}AddPage.query(parameters).replace(router); // Replace page to ${className}AddPage.
/// router.push(${className}AddPage.query(parameters)); // Push page to ${className}AddPage.
/// router.replace(${className}AddPage.query(parameters)); // Replace page to ${className}AddPage.
/// ```
@pageRouteQuery
static const query = _\$${className}AddPageQuery();
Expand All @@ -93,8 +93,8 @@ class ${className}EditPage extends FormEditPageScopedWidget {
/// Used to transition to the ${className}EditPage screen.
///
/// ```dart
/// ${className}EditPage.query(parameters).push(router); // Push page to ${className}EditPage.
/// ${className}EditPage.query(parameters).replace(router); // Replace page to ${className}EditPage.
/// router.push(${className}EditPage.query(parameters)); // Push page to ${className}EditPage.
/// router.replace(${className}EditPage.query(parameters)); // Replace page to ${className}EditPage.
/// ```
@pageRouteQuery
static const query = _\$${className}EditPageQuery();
Expand Down
12 changes: 6 additions & 6 deletions packages/katana_cli/lib/command/create.dart
Expand Up @@ -1678,8 +1678,8 @@ class HomePage extends PageScopedWidget {
/// Used to transition to the HomePage screen.
///
/// ```dart
/// HomePage.query(parameters).push(router); // Push page to HomePage.
/// HomePage.query(parameters).replace(router); // Replace page to HomePage.
/// router.push(HomePage.query(parameters)); // Push page to HomePage.
/// router.replace(HomePage.query(parameters)); // Replace page to HomePage.
/// ```
@pageRouteQuery
static const query = _\$HomePageQuery();
Expand All @@ -1688,7 +1688,7 @@ class HomePage extends PageScopedWidget {
Widget build(BuildContext context, PageRef ref) {
// Describes the process of loading
// and defining variables required for the page.
final model = CounterModel.document().watch(ref);
final model = ref.model(CounterModel.document())..load();
// Describes the structure of the page.
return UniversalScaffold(
Expand Down Expand Up @@ -1802,15 +1802,15 @@ class CounterModel with _\$CounterModel {
/// Query for document.
///
/// ```dart
/// CounterModel.document().read(appRef); // Get the document.
/// CounterModel.document().watch(ref)..load(); // Load the document.
/// appRef.model(CounterModel.document()); // Get the document.
/// ref.model(CounterModel.document())..load(); // Load the document.
/// ```
static const document = _\$CounterModelDocumentQuery();
/// Query for form value.
///
/// ```dart
/// CounterModel.form(CounterModel()).watch(ref); // Get the form controller.
/// ref.page.controller(CounterModel.form(CounterModel())); // Get the form controller.
/// ```
static const form = _\$CounterModelFormQuery();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/katana_cli/pubspec.lock
Expand Up @@ -159,7 +159,7 @@ packages:
path: "../katana"
relative: true
source: path
version: "2.4.0"
version: "2.4.1"
lints:
dependency: "direct main"
description:
Expand Down
34 changes: 18 additions & 16 deletions packages/masamune/README.md
Expand Up @@ -203,8 +203,8 @@ class TestPage extends PageScopedWidget {
/// Used to transition to the TestPage screen.
///
/// ```dart
/// TestPage.query(parameters).push(router); // Push page to TestPage.
/// TestPage.query(parameters).replace(router); // Replace page to TestPage.
/// router.push(TestPage.query(parameters)); // Push page to TestPage.
/// router.replace(TestPage.query(parameters)); // Replace page to TestPage.
/// ```
@pageRouteQuery
static const query = _$TestPageQuery();
Expand Down Expand Up @@ -353,26 +353,28 @@ class TestModel with _$TestModel {
/// Query for document.
///
/// ```dart
/// TestModel.document(id).read(appRef); // Get the document.
/// TestModel.document(id).watch(ref)..load(); // Load the document.
/// appRef.model(TestModel.document(id)); // Get the document.
/// ref.model(TestModel.document(id))..load(); // Load the document.
/// ```
static const document = _$TestModelDocumentQuery();

/// Query for collection.
///
/// ```dart
/// TestModel.collection().read(appRef); // Get the collection.
/// TestModel.collection().watch(ref)..load(); // Load the collection.
/// TestModel.collection().data.equal(
/// "data",
/// ).watch(ref)..load(); // Load the collection with filter.
/// appRef.model(TestModel.collection()); // Get the collection.
/// ref.model(TestModel.collection())..load(); // Load the collection.
/// ref.model(
/// TestModel.collection().data.equal(
/// "data",
/// )
/// )..load(); // Load the collection with filter.
/// ```
static const collection = _$TestModelCollectionQuery();

/// Query for form value.
///
/// ```dart
/// TestModel.form(TestModel()).watch(ref); // Get the form controller.
/// ref.page.controller(TestModel.form(TestModel())); // Get the form controller.
/// ```
static const form = _$TestModelFormQuery();
}
Expand Down Expand Up @@ -503,7 +505,7 @@ It can also be written concisely in a method chain by using the `watch` and `rea

```dart
final testModelCollection = TestModel.collection().watch(ref);
final testModelCollection = TestModel.collection().read(appRef);
final testModelCollection = appRef.model(TestModel.collection());
```

### SharedPreferences feature
Expand Down Expand Up @@ -601,9 +603,9 @@ class TestController extends ChangeNotifier {
/// Query for TestController.
///
/// ```dart
/// TestController.query(parameters).read(appRef); // Get from application scope.
/// TestController.query(parameters).watchOnApp(ref); // Watch at application scope.
/// TestController.query(parameters).watchOnPage(ref); // Watch at page scope.
/// appRef.controller(TestController.query(parameters)); // Get from application scope.
/// ref.app.controller(TestController.query(parameters)); // Watch at application scope.
/// ref.page.controller(TestController.query(parameters)); // Watch at page scope.
/// ```
static const query = _$TestControllerQuery();
}
Expand Down Expand Up @@ -812,7 +814,7 @@ When creating a form that targets a `data model`, such as editing profile data,
/// Query for form value.
///
/// ```dart
/// TestModel.form(TestModel()).watch(ref); // Get the form controller.
/// ref.page.controller(TestModel.form(TestModel())); // Get the form controller.
/// ```
static const form = _$TestModelFormQuery();
```
Expand Down Expand Up @@ -875,7 +877,7 @@ class LoginValue with _$LoginValue {
/// Query for form value.
///
/// ```dart
/// LoginValue.form(LoginValue()).watch(ref); // Get the form controller.
/// ref.page.controller(LoginValue.form(LoginValue())); // Get the form controller.
/// ```
static const form = _$LoginValueFormQuery();
}
Expand Down

0 comments on commit ed8a4fc

Please sign in to comment.