Skip to content

Commit 2203430

Browse files
committed
Add dedicated annotations package to stac_core with @StacScreen annotation for marking methods that return StacWidget instances.
- Create new `packages/stac_core/lib/annotations/` directory - Add `stac_screen.dart` with @StacScreen annotation class - Add `annotations.dart` export file for the annotations package - Update `core.dart` to export annotations package ```dart import 'package:stac_core/stac_core.dart'; @StacScreen('home') StacWidget buildHomeScreen() => StacWidget(); ```
1 parent 0cf7c4b commit 2203430

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
library;
2+
3+
export 'stac_screen.dart';
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/// Annotation to mark methods that return StacWidget instances.
2+
///
3+
/// This annotation is used to identify screen-level widgets in the Stac framework.
4+
/// Methods that return StacWidget should be annotated with this to indicate
5+
/// they represent screen definitions.
6+
///
7+
/// Example usage:
8+
/// ```dart
9+
/// @StacScreen('home')
10+
/// StacWidget buildHomeScreen() {
11+
/// return StacWidget(jsonData: {'type': 'scaffold', 'body': '...'});
12+
/// }
13+
/// ```
14+
class StacScreen {
15+
/// Creates a [StacScreen] annotation with the given screen name.
16+
const StacScreen(this.screenName);
17+
18+
/// The name identifier for this screen.
19+
final String screenName;
20+
}

packages/stac_core/lib/core/core.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ library;
22

33
export 'stac_action.dart';
44
export 'stac_widget.dart';
5+
export '../annotations/annotations.dart';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
library;
22

33
export 'actions/actions.dart';
4+
export 'annotations/annotations.dart';
45
export 'core/core.dart';
56
export 'foundation/foundation.dart';
67
export 'widgets/widgets.dart';

0 commit comments

Comments
 (0)