Skip to content

Commit

Permalink
fix: Added AuthAdapter.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Dec 16, 2022
1 parent 93cd39b commit 2c83d9c
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 35 deletions.
30 changes: 15 additions & 15 deletions packages/masamune/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -328,105 +328,105 @@ packages:
name: katana
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.10"
version: "0.15.10+1"
katana_auth:
dependency: transitive
description:
name: katana_auth
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
version: "1.1.2"
katana_form:
dependency: transitive
description:
name: katana_form
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.5"
version: "1.2.6"
katana_indicator:
dependency: transitive
description:
name: katana_indicator
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
version: "1.1.3"
katana_listenables:
dependency: transitive
description:
name: katana_listenables
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.8"
version: "1.2.9"
katana_listenables_annotation:
dependency: transitive
description:
name: katana_listenables_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.7"
version: "1.2.8"
katana_localization:
dependency: transitive
description:
name: katana_localization
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.19"
version: "1.1.20"
katana_localization_annotation:
dependency: transitive
description:
name: katana_localization_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.17"
version: "1.1.18"
katana_model:
dependency: transitive
description:
name: katana_model
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.8"
version: "1.3.12"
katana_router:
dependency: transitive
description:
name: katana_router
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.1"
version: "1.10.2"
katana_router_annotation:
dependency: transitive
description:
name: katana_router_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
version: "1.10.1"
katana_scoped:
dependency: transitive
description:
name: katana_scoped
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
version: "1.6.2"
katana_shorten:
dependency: transitive
description:
name: katana_shorten
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
version: "1.1.4"
katana_theme:
dependency: transitive
description:
name: katana_theme
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.5"
version: "1.2.6"
katana_theme_annotation:
dependency: transitive
description:
name: katana_theme_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.3"
version: "1.2.4"
lints:
dependency: transitive
description:
Expand Down
25 changes: 20 additions & 5 deletions packages/masamune/lib/src/masamune_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class MasamuneApp extends StatelessWidget {
const MasamuneApp({
super.key,
this.appRef,
this.auth,
this.localize,
this.routerConfig,
this.modelAdapter = const RuntimeModelAdapter(),
Expand All @@ -27,6 +28,7 @@ class MasamuneApp extends StatelessWidget {
});

final AppRef? appRef;
final AuthAdapter? auth;
final AppThemeData? theme;
final ModelAdapter? modelAdapter;
final AppLocalizeBase? localize;
Expand All @@ -50,15 +52,18 @@ class MasamuneApp extends StatelessWidget {

@override
Widget build(BuildContext context) {
return buildModelAdapter(
return buildAppAuth(
context,
buildAppScoped(
buildModelAdapter(
context,
buildAppTheme(
buildAppScoped(
context,
buildAppLocalize(
buildAppTheme(
context,
buildAppRouter(context),
buildAppLocalize(
context,
buildAppRouter(context),
),
),
),
),
Expand All @@ -85,6 +90,16 @@ class MasamuneApp extends StatelessWidget {
return child;
}

Widget buildAppAuth(BuildContext context, Widget child) {
if (auth != null) {
return AuthAdapterScope(
adapter: auth!,
child: child,
);
}
return child;
}

Widget buildAppTheme(BuildContext context, Widget child) {
if (theme != null) {
return AppThemeScope(
Expand Down
30 changes: 15 additions & 15 deletions packages/masamune/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -153,105 +153,105 @@ packages:
name: katana
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.10"
version: "0.15.10+1"
katana_auth:
dependency: "direct main"
description:
name: katana_auth
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
version: "1.1.2"
katana_form:
dependency: "direct main"
description:
name: katana_form
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.5"
version: "1.2.6"
katana_indicator:
dependency: "direct main"
description:
name: katana_indicator
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
version: "1.1.3"
katana_listenables:
dependency: "direct main"
description:
name: katana_listenables
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.8"
version: "1.2.9"
katana_listenables_annotation:
dependency: transitive
description:
name: katana_listenables_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.7"
version: "1.2.8"
katana_localization:
dependency: "direct main"
description:
name: katana_localization
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.19"
version: "1.1.20"
katana_localization_annotation:
dependency: transitive
description:
name: katana_localization_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.17"
version: "1.1.18"
katana_model:
dependency: "direct main"
description:
name: katana_model
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.8"
version: "1.3.12"
katana_router:
dependency: "direct main"
description:
name: katana_router
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.1"
version: "1.10.2"
katana_router_annotation:
dependency: transitive
description:
name: katana_router_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
version: "1.10.1"
katana_scoped:
dependency: "direct main"
description:
name: katana_scoped
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
version: "1.6.2"
katana_shorten:
dependency: "direct main"
description:
name: katana_shorten
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
version: "1.1.4"
katana_theme:
dependency: "direct main"
description:
name: katana_theme
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.5"
version: "1.2.6"
katana_theme_annotation:
dependency: transitive
description:
name: katana_theme_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.3"
version: "1.2.4"
masamune_annotation:
dependency: "direct main"
description:
Expand Down

0 comments on commit 2c83d9c

Please sign in to comment.