Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ mason-lock.json
.cursor/

# FVM Version Cache
.fvm/
.fvm/
9 changes: 4 additions & 5 deletions docs/concepts/custom_actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Custom actions enable you to:

Before creating a custom action, ensure you have:

1. **Dependencies**: `stac_core` and `json_annotation` packages
1. **Dependencies**: `stac` and `json_annotation` packages
2. **Code Generation**: `build_runner` for generating JSON serialization code
3. **Parser**: A corresponding action parser to execute your action.

Expand All @@ -35,8 +35,7 @@ Create a new file (e.g., `lib/actions/stac_share_action.dart`) and define your a

```dart
import 'package:json_annotation/json_annotation.dart';
import 'package:stac_core/core/stac_action.dart';
import 'package:stac_core/foundation/specifications/action_type.dart';
import 'package:stac/stac_core.dart';

part 'stac_share_action.g.dart';

Expand Down Expand Up @@ -188,7 +187,7 @@ Similar to widgets, actions can use converters for special types:
For `double` fields that may come as integers in JSON:

```dart
import 'package:stac_core/core/converters/double_converter.dart';
import 'package:stac/stac_core.dart';

@JsonSerializable()
class StacCustomAction extends StacAction {
Expand All @@ -211,7 +210,7 @@ class StacCustomAction extends StacAction {
**In Dart (stac/ folder)**

```dart
import 'package:stac_core/stac_core.dart';
import 'package:stac/stac_core.dart';
import 'package:your_app/actions/stac_share_action.dart';

@StacScreen(screenName: 'article')
Expand Down
11 changes: 5 additions & 6 deletions docs/concepts/custom_widgets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Custom widgets enable you to:

Before creating a custom widget, ensure you have:

1. **Dependencies**: `stac_core` and `json_annotation` packages
1. **Dependencies**: `stac` and `json_annotation` packages
2. **Code Generation**: `build_runner` for generating JSON serialization code
3. **Parser**: A corresponding parser to render your widget.

Expand All @@ -35,8 +35,7 @@ Create a new file (e.g., `lib/widgets/stac_custom_badge.dart`) and define your w

```dart
import 'package:json_annotation/json_annotation.dart';
import 'package:stac_core/core/stac_widget.dart';
import 'package:stac_core/foundation/foundation.dart';
import 'package:stac/stac_core.dart';

part 'stac_custom_badge.g.dart';

Expand Down Expand Up @@ -182,7 +181,7 @@ Stac provides converters for special types. Use them when needed:
For `double` fields that may come as integers in JSON:

```dart
import 'package:stac_core/core/converters/double_converter.dart';
import 'package:stac/stac_core.dart';

@JsonSerializable()
class StacCustomWidget extends StacWidget {
Expand All @@ -205,7 +204,7 @@ class StacCustomWidget extends StacWidget {
For child widgets in your custom widget:

```dart
import 'package:stac_core/core/converters/stac_widget_converter.dart';
import 'package:stac/stac_core.dart';

@JsonSerializable(explicitToJson: true)
class StacCustomContainer extends StacWidget {
Expand Down Expand Up @@ -249,7 +248,7 @@ class StacCustomWidget extends StacWidget {
**In Dart (stac/ folder)**

```dart
import 'package:stac_core/stac_core.dart';
import 'package:stac/stac_core.dart';
import 'package:your_app/widgets/stac_custom_badge.dart';

@StacScreen(screenName: 'profile')
Expand Down
3 changes: 1 addition & 2 deletions docs/concepts/rendering_stac_widgets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The `home_screen` is defined in your `/stac` folder as a Dart file. Here's an ex
**`stac/home_screen.dart`:**

```dart
import 'package:stac_core/stac_core.dart';
import 'package:stac/stac_core.dart';

@StacScreen(screenName: 'home_screen')
StacWidget homeScreen() {
Expand Down Expand Up @@ -268,7 +268,6 @@ Stac.fromNetwork(
```dart
import 'package:flutter/material.dart';
import 'package:stac/stac.dart';
import 'package:stac_core/actions/network_request/stac_network_request.dart';

class ApiDrivenScreen extends StatelessWidget {
const ApiDrivenScreen({super.key});
Expand Down
2 changes: 1 addition & 1 deletion docs/concepts/theming.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Here's the complete workflow:
**Step 1: Define your theme** in `stac/app_theme.dart`:

```dart
import 'package:stac_core/stac_core.dart';
import 'package:stac/stac_core.dart';

@StacThemeRef(name: "movie_app_dark")
StacTheme get darkTheme => _buildTheme(
Expand Down
6 changes: 3 additions & 3 deletions docs/dsl.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ flutter_project/
Screens are defined in the `stac/screens/` folder (or directly in `stac/`). Each screen is a Dart function annotated with `@StacScreen`:

```dart
import 'package:stac_core/stac_core.dart';
import 'package:stac/stac_core.dart';

@StacScreen(screenName: 'home_screen')
StacWidget homeScreen() {
Expand All @@ -79,7 +79,7 @@ StacWidget homeScreen() {
Themes are defined in the `stac/theme/` folder using the `@StacThemeRef` annotation:

```dart
import 'package:stac_core/stac_core.dart';
import 'package:stac/stac_core.dart';

@StacThemeRef(name: "app_theme")
StacTheme get appTheme => StacTheme(
Expand Down Expand Up @@ -189,7 +189,7 @@ stac deploy --verbose
Here's a complete example showing a screen with navigation, network requests, and theming:

```dart
import 'package:stac_core/stac_core.dart';
import 'package:stac/stac_core.dart';

@StacScreen(screenName: 'movie_detail')
StacWidget movieDetailScreen() {
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ padding: StacEdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0)

**After (Dart file: `stac/home_screen.dart`):**
```dart
import 'package:stac_core/stac_core.dart';
import 'package:stac/stac_core.dart';

@StacScreen(screenName: 'home_screen')
StacWidget homeScreen() {
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ results: [

1. **Missing imports:**
```dart
import 'package:stac_core/stac_core.dart'; // Add this
import 'package:stac/stac_core.dart'; // Add this
```

2. **Trailing commas:** Dart benefits from trailing commas:
Expand Down
2 changes: 1 addition & 1 deletion docs/project_structure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This guide explains the overall structure of a Stac project. It covers where the
Contains the `StacOptions` configuration for your project, including project name and ID.

```dart
import 'package:stac_core/stac_core.dart';
import 'package:stac/stac_core.dart';

StacOptions get defaultStacOptions => StacOptions(
name: 'your-project-name',
Expand Down
5 changes: 2 additions & 3 deletions docs/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ We'll select "Create a new project". Name it `stac demo` and press enter.
Stac will now initialize the project and you'll see a message saying

```bash
[SUCCESS] ✓ Added dependency: stac_core
[SUCCESS] ✓ Project initialized successfully!
[INFO] Next steps:
[INFO] 1. Add your Stac widgets definitions to /stac
Expand All @@ -113,7 +112,7 @@ Stac will now initialize the project and you'll see a message saying

`stac init` will add the following to your project:
- `stac/hello_world.dart` – A Hello World example widget. All your Stac widgets live in the `stac` folder.
- Adds `stac` and `stac_core` to your `pubspec.yaml`.
- Adds `stac` to your `pubspec.yaml`.
- Creates `default_stac_options.dart`, which defines your `StacOptions` (e.g., project name and ID).


Expand All @@ -122,7 +121,7 @@ Stac will now initialize the project and you'll see a message saying
Head over to `stac/hello_world.dart` and build the widget. Use the `@StacScreen` annotation to mark the widget as a screen.

```dart
import 'package:stac_core/stac_core.dart';
import 'package:stac/stac_core.dart';

@StacScreen(screenName: 'hello_world')
StacWidget helloWorld() {
Expand Down
2 changes: 1 addition & 1 deletion examples/movie_app/lib/default_stac_options.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is automatically generated by stac init.

import 'package:stac/stac.dart';
import 'package:stac/stac_core.dart';

/// Default [StacOptions] for use with your stac project.
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:stac/stac.dart';
import 'package:stac/stac_core.dart';

part 'movie_carousel.g.dart';

Expand Down
2 changes: 1 addition & 1 deletion examples/movie_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
stac:
stac: ^1.3.1

dio: ^5.8.0+1
smooth_page_indicator: ^1.2.1
Expand Down
21 changes: 21 additions & 0 deletions packages/stac_cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# https://dart.dev/guides/libraries/private-files
# Created by `dart pub`
.dart_tool/
.packages
build/

# Environment / secrets
.env
.env.dev
.env.local
.env.*.local

# Melos local overrides
pubspec_overrides.yaml

# IDE
.idea/
*.iml

# OS
.DS_Store
21 changes: 21 additions & 0 deletions packages/stac_cli/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Stac

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
36 changes: 36 additions & 0 deletions packages/stac_cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# stac_cli

Official CLI for managing Stac SDUI projects.

## Install

```bash
dart pub global activate --source path .
```

## Quick start

```bash
stac --version
stac login
stac init
stac build
stac deploy
```

## Environment

The CLI reads credentials from:

- `~/.stac/.env` (prod)
- `~/.stac/.env.dev` (dev)

Required keys:

- `STAC_BASE_API_URL`
- `STAC_GOOGLE_CLIENT_ID`
- `STAC_GOOGLE_CLIENT_SECRET` (optional)
- `STAC_FIREBASE_API_KEY`

Set environment in code via `currentEnvironment` in `lib/src/config/env.dart`.

30 changes: 30 additions & 0 deletions packages/stac_cli/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.

include: package:lints/recommended.yaml

# Uncomment the following section to specify additional rules.

# linter:
# rules:
# - camel_case_types

# analyzer:
# exclude:
# - path/to/excluded/files/**

# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints

# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options
Loading