Skip to content

Add example as a template #104#212

Open
Amoghhosamane wants to merge 1 commit intoanusii:devfrom
Amoghhosamane:feature/issue-104-template
Open

Add example as a template #104#212
Amoghhosamane wants to merge 1 commit intoanusii:devfrom
Amoghhosamane:feature/issue-104-template

Conversation

@Amoghhosamane
Copy link

@Amoghhosamane Amoghhosamane commented Feb 19, 2026

This PR implements a Mason-based template for SolidUI applications, fulfilling the request to have a template that users can use to quickly start new projects.

Associated Issue

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Verified the Mason template structure.
  • Created a new project using 'mason make solidui' and verified the generated files.
  • Verified the sync script 'support/sync_template_to_example.py' correctly updates the example app from the template.
  • Verified that 'flutter analyze' passes on the root project.

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • No lint check errors are related to these changes

This PR implements a Mason-based template for SolidUI applications. It includes:
- A new templates/solidui/brick directory with the template files.
- Replacing hardcoded values with Mason variables.
- A mason.yaml file to register the brick.
- A sync script support/sync_template_to_example.py to keep the example app in sync with the template.
- Updated README.md with instructions on how to use the template with Mason.
Closes anusii#104
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a Mason-based template system for SolidUI applications, addressing issue #104. The template enables users to quickly scaffold new SolidUI applications using the Mason CLI tool, while maintaining the existing example app through a synchronization script.

Changes:

  • Added Mason brick template structure under templates/solidui/brick/ with configurable project name, description, and author variables
  • Created Python synchronization script to keep the example app in sync with the template
  • Updated README.md with Mason installation and usage instructions, replacing previous flutter create approach

Reviewed changes

Copilot reviewed 16 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
templates/solidui/brick/brick.yaml Mason brick configuration with template variables
templates/solidui/brick/__brick__/pubspec.yaml Template pubspec with Mason variable substitution
templates/solidui/brick/__brick__/lib/*.dart Template Dart source files including main, app, home, and utilities
templates/solidui/brick/__brick__/lib/screens/*.dart Screen components for sample page and POD file browsing
templates/solidui/brick/__brick__/lib/constants/app.dart App constants with template variable support
templates/solidui/brick/__brick__/lib/home.dart.old Corrupted backup file that should be removed
templates/solidui/brick/__brick__/assets/images/* Template app icons and images
templates/solidui/brick/__brick__/analysis_options.yaml Linter configuration for generated projects
templates/solidui/brick/__brick__/README.md Template README with variable substitution
templates/solidui/brick/__brick__/.gitignore Comprehensive gitignore for Flutter projects
support/sync_template_to_example.py Script to sync template changes to example directory
mason.yaml Mason configuration registering the solidui brick
example/lib/home.dart.old Corrupted backup file in example that should be removed
README.md Updated quick start documentation for Mason-based workflow

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

description: A starting point for a SolidUI application.
version: 0.0.1
environment:
mason: 0.1.0-dev.50
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Mason version constraint 0.1.0-dev.50 specifies a pre-release development version. This may cause compatibility issues for users. Consider using a stable version constraint like ">=0.1.0-dev.50 <1.0.0" or update to a stable Mason version if available. This ensures better compatibility and stability for template users.

Suggested change
mason: 0.1.0-dev.50
mason: ">=0.1.0-dev.50 <1.0.0"

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +28
subprocess.run(['mason', 'get'], cwd=root_dir, check=True)

# 2. Run mason make to a temporary directory
temp_gen_dir = os.path.join(root_dir, '.temp_template_gen')
if os.path.exists(temp_gen_dir):
shutil.rmtree(temp_gen_dir)
os.makedirs(temp_gen_dir)

subprocess.run([
'mason', 'make', 'solidui',
'--projectName', 'myapp',
'--description', 'My App - A SolidUI Template Application',
'--author', 'Software Innovation Institute, ANU',
'-o', temp_gen_dir
], cwd=root_dir, check=True)
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subprocess calls lack error handling beyond check=True. If mason is not installed or fails for other reasons, the error message may not be clear to users. Consider adding try-except blocks around the subprocess calls to provide more informative error messages, such as "Mason CLI not found. Please install it with: dart pub global activate mason_cli".

Copilot uses AI. Check for mistakes.

# 3. Copy generated files back to example
# Generated files are usually lib/, assets/, pubspec.yaml, etc.
gen_content_dir = os.path.join(temp_gen_dir) # mason make -o temp_gen_dir puts files directly there
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 32 has a redundant os.path.join() call that doesn't add any path components. This can be simplified to gen_content_dir = temp_gen_dir. The comment already clarifies that mason outputs files directly to the specified directory.

Suggested change
gen_content_dir = os.path.join(temp_gen_dir) # mason make -o temp_gen_dir puts files directly there
gen_content_dir = temp_gen_dir # mason make -o temp_gen_dir puts files directly there

Copilot uses AI. Check for mistakes.
Comment on lines +168 to +185
### Using Mason (Recommended)

1. Install Mason:
```bash
dart pub global activate mason_cli
```
2. Initialize Mason in your project (if not already):
```bash
mason init
```
3. Add the SolidUI brick:
```bash
mason add solidui --path templates/solidui/brick
```
4. Create a new app from the template:
```bash
mason make solidui
```
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instructions at step 3 use --path templates/solidui/brick which assumes the user is running the command from the SolidUI repository root. This won't work for external users who want to create a new SolidUI app. Consider clarifying this is for contributors, or provide instructions for external users to either: 1) Clone the repository first, or 2) Use a published brick URL when available. The instructions should differentiate between contributors and end-users.

Copilot uses AI. Check for mistakes.
window_manager: ^0.5.1

dev_dependencies:
flutter_lints: ^5.0.0
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template uses flutter_lints: ^5.0.0 while the main project uses flutter_lints: ^6.0.0. This version mismatch could lead to inconsistent linting rules between the template output and the main project. Consider updating the template to use ^6.0.0 to match the main project, or document the reason for the version difference.

Suggested change
flutter_lints: ^5.0.0
flutter_lints: ^6.0.0

Copilot uses AI. Check for mistakes.
@tonypioneer
Copy link
Collaborator

Hi @Amoghhosamane, as per #127 (comment), the solidui/example will be moved to a new repository and the solidpod/example will be moved to solidui/example. I’m not sure if we should include the current example as a template for now. We could discuss this with @gjwgit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants