Skip to content

Commit 56884b7

Browse files
committed
update
1 parent 8f8466f commit 56884b7

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

lib/src/gen_screen_bindings_app.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,18 @@ String _screenSegment(ClassInsight<ModelGenerateScreenBindings> insight) {
206206
}
207207

208208
final _interpolator = TemplateInterpolator<ClassInsight<GenerateScreenBindings>>({
209+
'___CONDITION___': (insight) {
210+
if (insight.annotation.isAccessibleOnlyIfLoggedInAndVerified == true) {
211+
return 'isLoggedInAndVerified';
212+
}
213+
if (insight.annotation.isAccessibleOnlyIfLoggedIn == true) {
214+
return 'isLoggedIn';
215+
}
216+
if (insight.annotation.isAccessibleOnlyIfLoggedOut == true) {
217+
return 'isLoggedOut';
218+
}
219+
return 'null';
220+
},
209221
'___SCREEN_KEY___': _screenKey,
210222
'___SCREEN_SEGMENT___': _screenSegment,
211223
'___WIDGET_NAME___': (insight) {

templates/v2/_access.g.dart.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,22 @@
88
// ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
99
//.title~
1010
11-
import 'package:df_screen/df_screen.dart';
12-
import 'package:flutter/widgets.dart' show SizedBox;
13-
14-
import '_screens.g.dart';
11+
import '/_common.dart';
1512
1613
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
1714
15+
bool isLoggedInAndEmailVerified() {
16+
return DI.global<AuthServiceInterface>().map((e) => e.loggedInAndEmailVerified).unwrapOr(false);
17+
}
18+
19+
bool isLoggedIn() {
20+
return DI.global<AuthServiceInterface>().map((e) => e.loggedIn).unwrapOr(false);
21+
}
22+
23+
bool isLoggedOut() {
24+
return DI.global<AuthServiceInterface>().map((e) => e.loggedOut).unwrapOr(false);
25+
}
26+
1827
final class EmptyScreenState extends RouteState {
1928
EmptyScreenState() : super.parse('/empty');
2029
}

templates/v2/_bindings.g.dart.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class ___WIDGET_NAME___RouteBuilder extends RouteBuilder<___WIDGET_NAME___Extra?
7676
___WIDGET_NAME___RouteBuilder()
7777
: super(
7878
routeState: ___WIDGET_NAME___RouteState(),
79+
condition: ___CONDITION___,
7980
builder: (context, routeState) {
8081
return ___WIDGET_NAME___(routeState: routeState);
8182
},

templates/v2/widget.dart.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import 'package:flutter/material.dart';
55
import 'package:df_screen/df_screen.dart';
66
7+
import '../_access.g.dart';
78
part '_bindings.g.dart';
89
part '_controller.dart';
910
part '/_state.dart';

0 commit comments

Comments
 (0)