Skip to content

Commit 5441894

Browse files
robelatorclaude
andcommitted
+Update docs and add working example
- Add simple working example - Simplify README documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 555ed95 commit 5441894

9 files changed

Lines changed: 118 additions & 97 deletions

File tree

README.md

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,53 @@
1-
<a href="https://www.buymeacoffee.com/dev_cetera" target="_blank"><img align="right" src="https://cdn.buymeacoffee.com/buttons/default-orange.png" height="48"></a>
2-
<a href="https://discord.gg/gEQ8y2nfyX" target="_blank"><img align="right" src="https://raw.githubusercontent.com/dev-cetera/.github/refs/heads/main/assets/icons/discord_icon/discord_icon.svg" height="48"></a>
1+
[![banner](https://github.com/dev-cetera/df_screen_core/blob/v0.5.7/doc/assets/banner.png?raw=true)](https://github.com/dev-cetera)
32

4-
Dart & Flutter Packages by dev-cetera.com & contributors.
5-
6-
[![sponsor](https://img.shields.io/badge/sponsor-grey?logo=github-sponsors)](https://github.com/sponsors/dev-cetera)
7-
[![patreon](https://img.shields.io/badge/patreon-grey?logo=patreon)](https://www.patreon.com/c/RobertMollentze)
83
[![pub](https://img.shields.io/pub/v/df_screen_core.svg)](https://pub.dev/packages/df_screen_core)
9-
[![tag](https://img.shields.io/badge/tag-v0.5.5-purple?logo=github)](https://github.com/dev-cetera/df_screen_core/tree/v0.5.5)
10-
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/dev-cetera/df_screen_core/main/LICENSE)
4+
[![tag](https://img.shields.io/badge/Tag-v0.5.7-purple?logo=github)](https://github.com/dev-cetera/df_screen_core/tree/v0.5.7)
5+
[![buymeacoffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-FFDD00?logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/dev_cetera)
6+
[![sponsor](https://img.shields.io/badge/Sponsor-grey?logo=github-sponsors&logoColor=pink)](https://github.com/sponsors/dev-cetera)
7+
[![patreon](https://img.shields.io/badge/Patreon-grey?logo=patreon)](https://www.patreon.com/robelator)
8+
[![discord](https://img.shields.io/badge/Discord-5865F2?logo=discord&logoColor=white)](https://discord.gg/gEQ8y2nfyX)
9+
[![instagram](https://img.shields.io/badge/Instagram-E4405F?logo=instagram&logoColor=white)](https://www.instagram.com/dev_cetera/)
10+
[![license](https://img.shields.io/badge/License-MIT-blue.svg)](https://raw.githubusercontent.com/dev-cetera/df_screen_core/main/LICENSE)
1111

1212
---
1313

14-
[![banner](https://github.com/dev-cetera/df_safer_dart/blob/v0.5.5/doc/assets/banner.png?raw=true)](https://github.com/dev-cetera)
15-
1614
<!-- BEGIN _README_CONTENT -->
1715

1816
## Summary
1917

20-
A package that provides core code for the df_screen package.
18+
Core data models for the [df_screen](https://pub.dev/packages/df_screen) package.
2119

22-
<!-- END _README_CONTENT -->
20+
## Usage
2321

24-
---
22+
```dart
23+
import 'package:df_screen_core/df_screen_core.dart';
2524
26-
☝️ Please refer to the [API reference](https://pub.dev/documentation/df_screen_core/) for more information.
25+
final config = ModelScreenConfiguration(
26+
path: '/home',
27+
title: 'Home Screen',
28+
isAccessibleOnlyIfLoggedIn: true,
29+
args: {'userId': '123'},
30+
);
2731
28-
---
32+
print(config.path); // /home
33+
print(config.arg<String>('userId')); // 123
34+
```
2935

30-
## 💬 Contributing and Discussions
36+
## Models
3137

32-
This is an open-source project, and we warmly welcome contributions from everyone, regardless of experience level. Whether you're a seasoned developer or just starting out, contributing to this project is a fantastic way to learn, share your knowledge, and make a meaningful impact on the community.
38+
- `ModelScreenConfiguration` - Screen config with path, title, access control, and args
39+
- `ModelGenerateScreenBindings` - Code generation config for screen bindings
3340

34-
### ☝️ Ways you can contribute
35-
36-
- **Buy me a coffee:** If you'd like to support the project financially, consider [buying me a coffee](https://www.buymeacoffee.com/dev_cetera). Your support helps cover the costs of development and keeps the project growing.
37-
- **Find us on Discord:** Feel free to ask questions and engage with the community here: https://discord.gg/gEQ8y2nfyX.
38-
- **Share your ideas:** Every perspective matters, and your ideas can spark innovation.
39-
- **Help others:** Engage with other users by offering advice, solutions, or troubleshooting assistance.
40-
- **Report bugs:** Help us identify and fix issues to make the project more robust.
41-
- **Suggest improvements or new features:** Your ideas can help shape the future of the project.
42-
- **Help clarify documentation:** Good documentation is key to accessibility. You can make it easier for others to get started by improving or expanding our documentation.
43-
- **Write articles:** Share your knowledge by writing tutorials, guides, or blog posts about your experiences with the project. It's a great way to contribute and help others learn.
44-
45-
No matter how you choose to contribute, your involvement is greatly appreciated and valued!
41+
<!-- END _README_CONTENT -->
4642

47-
### ☕ We drink a lot of coffee...
43+
---
4844

49-
If you're enjoying this package and find it valuable, consider showing your appreciation with a small donation. Every bit helps in supporting future development. You can donate here: https://www.buymeacoffee.com/dev_cetera
45+
For more details, see the [API reference](https://pub.dev/documentation/df_screen_core/).
5046

51-
<a href="https://www.buymeacoffee.com/dev_cetera" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" height="40"></a>
47+
## Contributing
5248

53-
## 🧑‍⚖️ License
49+
Join our [Discord](https://discord.gg/gEQ8y2nfyX) or support us on [Buy Me A Coffee](https://www.buymeacoffee.com/dev_cetera).
5450

55-
This project is released under the [MIT License](https://raw.githubusercontent.com/dev-cetera/df_screen_core/main/LICENSE). See [LICENSE](https://raw.githubusercontent.com/dev-cetera/df_screen_core/main/LICENSE) for more information.
51+
## License
5652

53+
[MIT License](https://raw.githubusercontent.com/dev-cetera/df_screen_core/main/LICENSE)

_README_CONTENT.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
11
## Summary
22

3-
A package that provides core code for the df_screen package.
3+
Core data models for the [df_screen](https://pub.dev/packages/df_screen) package.
4+
5+
## Usage
6+
7+
```dart
8+
import 'package:df_screen_core/df_screen_core.dart';
9+
10+
final config = ModelScreenConfiguration(
11+
path: '/home',
12+
title: 'Home Screen',
13+
isAccessibleOnlyIfLoggedIn: true,
14+
args: {'userId': '123'},
15+
);
16+
17+
print(config.path); // /home
18+
print(config.arg<String>('userId')); // 123
19+
```
20+
21+
## Models
22+
23+
- `ModelScreenConfiguration` - Screen config with path, title, access control, and args
24+
- `ModelGenerateScreenBindings` - Code generation config for screen bindings

analysis_options.yaml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
##.title
2-
## ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
3-
##
4-
## Copyright © dev-cetera.com & contributors.
5-
##
6-
## The use of this source code is governed by an MIT-style license described in
7-
## the LICENSE file located in this project's root directory.
8-
##
9-
## See: https://opensource.org/license/mit
10-
##
11-
## ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
12-
##.title~
1+
# For dev-cetera.com
2+
# Version: 1
133

144
include: package:lints/recommended.yaml
155

@@ -31,6 +21,7 @@ linter:
3121
prefer_relative_imports: true
3222
prefer_single_quotes: true
3323
require_trailing_commas: true
24+
unawaited_futures: true
3425
unnecessary_this: true
3526

3627
analyzer:
@@ -42,21 +33,26 @@ analyzer:
4233
strict-raw-types: true
4334
exclude:
4435
- build/**
36+
# - '**.g.dart'
4537

4638
errors:
47-
unused_label: ignore
4839
always_declare_return_types: error
4940
avoid_renaming_method_parameters: error
5041
avoid_type_to_string: error
42+
close_sinks: error
43+
collection_methods_unrelated_type: error
5144
depend_on_referenced_packages: error
5245
flutter_style_todos: error
5346
invalid_override_of_non_virtual_member: error
5447
invalid_use_of_protected_member: error
48+
missing_return: error
5549
no_leading_underscores_for_local_identifiers: error
5650
prefer_final_in_for_each: error
5751
prefer_relative_imports: error
52+
record_literal_one_positional_no_trailing_comma: error
5853
unnecessary_new: error
5954
unrelated_type_equality_checks: error
55+
unused_label: ignore
6056
use_key_in_widget_constructors: error
6157

6258
formatter:

example/example.dart

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
// Unavailable. Please check in later.
1+
import 'package:df_screen_core/df_screen_core.dart';
2+
3+
void main() {
4+
// Create a screen configuration.
5+
final config = const ModelScreenConfiguration(
6+
path: '/home',
7+
title: 'Home Screen',
8+
isAccessibleOnlyIfLoggedIn: true,
9+
args: {'userId': '123'},
10+
);
11+
12+
print('Path: ${config.path}');
13+
print('Title: ${config.title}');
14+
print('User ID: ${config.arg<String>('userId')}');
15+
16+
// Create config from current URL.
17+
final currentConfig = currentBaseConfiguration();
18+
print('Current path: ${currentConfig.path}');
19+
}

lib/src/data_models/model_generate_screen_bindings/_model_generate_screen_bindings.g.dart

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,8 @@ class ModelGenerateScreenBindings extends _ModelGenerateScreenBindings {
244244
final title = json?['title']?.toString().trim().nullIfEmpty;
245245
final className = json?['className']?.toString().trim().nullIfEmpty;
246246
final screenKey = json?['screenKey']?.toString().trim().nullIfEmpty;
247-
final keyStringCase = json?['keyStringCase']
248-
?.toString()
249-
.trim()
250-
.nullIfEmpty;
247+
final keyStringCase =
248+
json?['keyStringCase']?.toString().trim().nullIfEmpty;
251249
return ModelGenerateScreenBindings(
252250
args: args,
253251
isAccessibleOnlyIfLoggedInAndVerified:
@@ -298,26 +296,18 @@ class ModelGenerateScreenBindings extends _ModelGenerateScreenBindings {
298296
@override
299297
Map<String, dynamic> toJson({bool includeNulls = false}) {
300298
try {
301-
final args0 = args
302-
?.map((p0, p1) => MapEntry(p0, p1))
303-
.nonNulls
304-
.nullIfEmpty;
299+
final args0 =
300+
args?.map((p0, p1) => MapEntry(p0, p1)).nonNulls.nullIfEmpty;
305301
final isAccessibleOnlyIfLoggedInAndVerified0 =
306302
isAccessibleOnlyIfLoggedInAndVerified;
307303
final isAccessibleOnlyIfLoggedIn0 = isAccessibleOnlyIfLoggedIn;
308304
final isAccessibleOnlyIfLoggedOut0 = isAccessibleOnlyIfLoggedOut;
309305
final isRedirectable0 = isRedirectable;
310306
final path0 = path?.trim().nullIfEmpty;
311-
final queryParameters0 = queryParameters
312-
?.map((p0) => p0)
313-
.nonNulls
314-
.nullIfEmpty
315-
?.toList();
316-
final internalParameters0 = internalParameters
317-
?.map((p0) => p0)
318-
.nonNulls
319-
.nullIfEmpty
320-
?.toList();
307+
final queryParameters0 =
308+
queryParameters?.map((p0) => p0).nonNulls.nullIfEmpty?.toList();
309+
final internalParameters0 =
310+
internalParameters?.map((p0) => p0).nonNulls.nullIfEmpty?.toList();
321311
final title0 = title?.trim().nullIfEmpty;
322312
final className0 = className?.trim().nullIfEmpty;
323313
final screenKey0 = screenKey?.trim().nullIfEmpty;
@@ -491,7 +481,7 @@ extension ModelGenerateScreenBindingsX on ModelGenerateScreenBindings {
491481
args: args ?? this.args,
492482
isAccessibleOnlyIfLoggedInAndVerified:
493483
isAccessibleOnlyIfLoggedInAndVerified ??
494-
this.isAccessibleOnlyIfLoggedInAndVerified,
484+
this.isAccessibleOnlyIfLoggedInAndVerified,
495485
isAccessibleOnlyIfLoggedIn:
496486
isAccessibleOnlyIfLoggedIn ?? this.isAccessibleOnlyIfLoggedIn,
497487
isAccessibleOnlyIfLoggedOut:
@@ -526,14 +516,12 @@ extension ModelGenerateScreenBindingsX on ModelGenerateScreenBindings {
526516
args: args ? this.args : null,
527517
isAccessibleOnlyIfLoggedInAndVerified:
528518
isAccessibleOnlyIfLoggedInAndVerified
529-
? this.isAccessibleOnlyIfLoggedInAndVerified
530-
: null,
531-
isAccessibleOnlyIfLoggedIn: isAccessibleOnlyIfLoggedIn
532-
? this.isAccessibleOnlyIfLoggedIn
533-
: null,
534-
isAccessibleOnlyIfLoggedOut: isAccessibleOnlyIfLoggedOut
535-
? this.isAccessibleOnlyIfLoggedOut
536-
: null,
519+
? this.isAccessibleOnlyIfLoggedInAndVerified
520+
: null,
521+
isAccessibleOnlyIfLoggedIn:
522+
isAccessibleOnlyIfLoggedIn ? this.isAccessibleOnlyIfLoggedIn : null,
523+
isAccessibleOnlyIfLoggedOut:
524+
isAccessibleOnlyIfLoggedOut ? this.isAccessibleOnlyIfLoggedOut : null,
537525
isRedirectable: isRedirectable ? this.isRedirectable : null,
538526
path: path ? this.path : null,
539527
queryParameters: queryParameters ? this.queryParameters : null,

lib/src/data_models/model_generate_screen_bindings/model_generate_screen_bindings.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ part '_model_generate_screen_bindings.g.dart';
4848
fieldPath: ['isRedirectable'],
4949
fieldType: bool,
5050
nullable: true,
51-
description: 'Enables URL redirection to this screen. If false, URL redirection is disabled.',
51+
description:
52+
'Enables URL redirection to this screen. If false, URL redirection is disabled.',
5253
),
5354
Field(
5455
fieldPath: ['path'],
@@ -90,7 +91,8 @@ part '_model_generate_screen_bindings.g.dart';
9091
fieldPath: ['keyStringCase'],
9192
fieldType: String,
9293
nullable: true,
93-
description: 'The string case for the keys of query and internal parameters.',
94+
description:
95+
'The string case for the keys of query and internal parameters.',
9496
),
9597
},
9698
)

lib/src/data_models/model_screen_configuration/_model_screen_configuration.g.dart

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,8 @@ class ModelScreenConfiguration extends _ModelScreenConfiguration {
254254
@override
255255
Map<String, dynamic> toJson({bool includeNulls = false}) {
256256
try {
257-
final args0 = args
258-
?.map((p0, p1) => MapEntry(p0, p1))
259-
.nonNulls
260-
.nullIfEmpty;
257+
final args0 =
258+
args?.map((p0, p1) => MapEntry(p0, p1)).nonNulls.nullIfEmpty;
261259
final isAccessibleOnlyIfLoggedInAndVerified0 =
262260
isAccessibleOnlyIfLoggedInAndVerified;
263261
final isAccessibleOnlyIfLoggedIn0 = isAccessibleOnlyIfLoggedIn;
@@ -391,7 +389,7 @@ extension ModelScreenConfigurationX on ModelScreenConfiguration {
391389
args: args ?? this.args,
392390
isAccessibleOnlyIfLoggedInAndVerified:
393391
isAccessibleOnlyIfLoggedInAndVerified ??
394-
this.isAccessibleOnlyIfLoggedInAndVerified,
392+
this.isAccessibleOnlyIfLoggedInAndVerified,
395393
isAccessibleOnlyIfLoggedIn:
396394
isAccessibleOnlyIfLoggedIn ?? this.isAccessibleOnlyIfLoggedIn,
397395
isAccessibleOnlyIfLoggedOut:
@@ -418,14 +416,12 @@ extension ModelScreenConfigurationX on ModelScreenConfiguration {
418416
args: args ? this.args : null,
419417
isAccessibleOnlyIfLoggedInAndVerified:
420418
isAccessibleOnlyIfLoggedInAndVerified
421-
? this.isAccessibleOnlyIfLoggedInAndVerified
422-
: null,
423-
isAccessibleOnlyIfLoggedIn: isAccessibleOnlyIfLoggedIn
424-
? this.isAccessibleOnlyIfLoggedIn
425-
: null,
426-
isAccessibleOnlyIfLoggedOut: isAccessibleOnlyIfLoggedOut
427-
? this.isAccessibleOnlyIfLoggedOut
428-
: null,
419+
? this.isAccessibleOnlyIfLoggedInAndVerified
420+
: null,
421+
isAccessibleOnlyIfLoggedIn:
422+
isAccessibleOnlyIfLoggedIn ? this.isAccessibleOnlyIfLoggedIn : null,
423+
isAccessibleOnlyIfLoggedOut:
424+
isAccessibleOnlyIfLoggedOut ? this.isAccessibleOnlyIfLoggedOut : null,
429425
isRedirectable: isRedirectable ? this.isRedirectable : null,
430426
path: path ? this.path : null,
431427
prevConfiguration: prevConfiguration ? this.prevConfiguration : null,

lib/src/data_models/model_screen_configuration/model_screen_configuration.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ ModelScreenConfiguration urlToScreenConfiguration({
107107
return ModelScreenConfiguration(
108108
args: args,
109109
isAccessibleOnlyIfLoggedIn: isAccessibleOnlyIfLoggedIn,
110-
isAccessibleOnlyIfLoggedInAndVerified: isAccessibleOnlyIfLoggedInAndVerified,
110+
isAccessibleOnlyIfLoggedInAndVerified:
111+
isAccessibleOnlyIfLoggedInAndVerified,
111112
isAccessibleOnlyIfLoggedOut: isAccessibleOnlyIfLoggedOut,
112113
isRedirectable: isRedirectable,
113114
path: path,

pubspec.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313

1414
name: df_screen_core
1515
homepage: https://dev-cetera.com/
16-
repository: https://github.com/robmllze/df_screen_core
1716
funding:
1817
- https://www.buymeacoffee.com/dev_cetera
19-
- https://www.patreon.com/c/RobertMollentze
20-
- https://github.com/sponsors/robmllze
18+
- https://www.patreon.com/c/robelator
19+
- https://github.com/sponsors/robelator
20+
- https://www.patreon.com/c/robelator
21+
- https://github.com/sponsors/robelator
22+
- https://www.buymeacoffee.com/dev_cetera
2123
description: A package that provides core code for the df_screen package.
22-
version: 0.5.5
24+
version: 0.5.7
2325
topics:
2426
- user-interface
2527
- widgets
@@ -35,7 +37,7 @@ environment:
3537
## -----------------------------------------------------------------------------
3638

3739
dependencies:
38-
df_generate_dart_models_core: ^0.9.22
40+
df_generate_dart_models_core: ^0.9.23
3941
df_log: ^0.3.20
4042

4143
## -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)