@@ -31,9 +31,7 @@ final _screenSegmentMapper = _InsightMapper(
31
31
final path = insight.annotation.path ?? '' ;
32
32
final screenSegment = p.joinAll (
33
33
[
34
- path.isNotEmpty && path.startsWith (RegExp (r'[\\/]' ))
35
- ? path.substring (1 )
36
- : path,
34
+ path.isNotEmpty && path.startsWith (RegExp (r'[\\/]' )) ? path.substring (1 ) : path,
37
35
screenKey,
38
36
],
39
37
);
@@ -48,6 +46,18 @@ final insightMappers = [
48
46
return insight.className;
49
47
},
50
48
),
49
+ _InsightMapper (
50
+ placeholder: Placeholders .DEFAULT_TITLE ,
51
+ mapInsights: (insight) async {
52
+ return insight.annotation.title ??
53
+ insight.className
54
+ .toCamelCase ()
55
+ .replaceAll ('screen' , '' )
56
+ .split ('_' )
57
+ .map ((e) => e.capitalize ())
58
+ .join (' ' );
59
+ },
60
+ ),
51
61
_InsightMapper (
52
62
placeholder: Placeholders .CONFIGURATION_CLASS ,
53
63
mapInsights: (insight) async {
@@ -79,8 +89,7 @@ final insightMappers = [
79
89
_InsightMapper (
80
90
placeholder: Placeholders .IS_ACCESSIBLE_ONLY_IF_LOGGED_IN_AND_VERIFIED ,
81
91
mapInsights: (insight) async {
82
- final b =
83
- insight.annotation.isAccessibleOnlyIfLoggedInAndVerified ?? false ;
92
+ final b = insight.annotation.isAccessibleOnlyIfLoggedInAndVerified ?? false ;
84
93
return b.toString ();
85
94
},
86
95
),
@@ -101,8 +110,7 @@ final insightMappers = [
101
110
_InsightMapper (
102
111
placeholder: Placeholders .IS_ALWAYS_ACCESSIBLE ,
103
112
mapInsights: (insight) async {
104
- final a =
105
- insight.annotation.isAccessibleOnlyIfLoggedInAndVerified ?? false ;
113
+ final a = insight.annotation.isAccessibleOnlyIfLoggedInAndVerified ?? false ;
106
114
final b = insight.annotation.isAccessibleOnlyIfLoggedIn ?? false ;
107
115
final c = insight.annotation.isAccessibleOnlyIfLoggedOut ?? false ;
108
116
if (a && b) {
@@ -145,10 +153,8 @@ final insightMappers = [
145
153
_InsightMapper (
146
154
placeholder: Placeholders .IP0 ,
147
155
mapInsights: (insight) async {
148
- final params = insight.annotation.internalParameters
149
- ? .map ((e) => FieldUtils .ofOrNull (e))
150
- .nonNulls ??
151
- {};
156
+ final params =
157
+ insight.annotation.internalParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
152
158
if (params.isNotEmpty) {
153
159
final a = params.map ((e) {
154
160
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
@@ -176,10 +182,8 @@ final insightMappers = [
176
182
_InsightMapper (
177
183
placeholder: Placeholders .IP1 ,
178
184
mapInsights: (insight) async {
179
- final params = insight.annotation.internalParameters
180
- ? .map ((e) => FieldUtils .ofOrNull (e))
181
- .nonNulls ??
182
- {};
185
+ final params =
186
+ insight.annotation.internalParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
183
187
if (params.isNotEmpty) {
184
188
final a = params.map ((e) {
185
189
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
@@ -199,10 +203,8 @@ final insightMappers = [
199
203
_InsightMapper (
200
204
placeholder: Placeholders .IP2 ,
201
205
mapInsights: (insight) async {
202
- final params = insight.annotation.internalParameters
203
- ? .map ((e) => FieldUtils .ofOrNull (e))
204
- .nonNulls ??
205
- {};
206
+ final params =
207
+ insight.annotation.internalParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
206
208
if (params.isNotEmpty) {
207
209
final a = params.map ((e) {
208
210
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
@@ -220,10 +222,8 @@ final insightMappers = [
220
222
_InsightMapper (
221
223
placeholder: Placeholders .QP0 ,
222
224
mapInsights: (insight) async {
223
- final params = insight.annotation.queryParameters
224
- ? .map ((e) => FieldUtils .ofOrNull (e))
225
- .nonNulls ??
226
- {};
225
+ final params =
226
+ insight.annotation.queryParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
227
227
if (params.isNotEmpty) {
228
228
final a = params.map ((e) {
229
229
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
@@ -251,10 +251,8 @@ final insightMappers = [
251
251
_InsightMapper (
252
252
placeholder: Placeholders .QP1 ,
253
253
mapInsights: (insight) async {
254
- final params = insight.annotation.queryParameters
255
- ? .map ((e) => FieldUtils .ofOrNull (e))
256
- .nonNulls ??
257
- {};
254
+ final params =
255
+ insight.annotation.queryParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
258
256
if (params.isNotEmpty) {
259
257
final a = params.map ((e) {
260
258
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
@@ -271,10 +269,8 @@ final insightMappers = [
271
269
_InsightMapper (
272
270
placeholder: Placeholders .QP2 ,
273
271
mapInsights: (insight) async {
274
- final params = insight.annotation.queryParameters
275
- ? .map ((e) => FieldUtils .ofOrNull (e))
276
- .nonNulls ??
277
- {};
272
+ final params =
273
+ insight.annotation.queryParameters? .map ((e) => FieldUtils .ofOrNull (e)).nonNulls ?? {};
278
274
if (params.isNotEmpty) {
279
275
final a = params.map ((e) {
280
276
final fieldName = e.fieldPath! .join ('_' ).toCamelCase ();
@@ -296,6 +292,7 @@ final insightMappers = [
296
292
297
293
enum Placeholders {
298
294
CLASS ,
295
+ DEFAULT_TITLE ,
299
296
CONFIGURATION_CLASS ,
300
297
CLASS_FILE ,
301
298
SCREEN_KEY ,
@@ -313,8 +310,6 @@ enum Placeholders {
313
310
QP0 ,
314
311
QP1 ,
315
312
QP2 ,
316
- TITLE ,
317
313
}
318
314
319
- typedef _InsightMapper
320
- = InsightMapper <ClassInsight <ModelGenerateScreenBindings >, Placeholders >;
315
+ typedef _InsightMapper = InsightMapper <ClassInsight <ModelGenerateScreenBindings >, Placeholders >;
0 commit comments