-
-
Notifications
You must be signed in to change notification settings - Fork 107
Description
Hey there! 👋
So I've been working with mason bricks and noticed something that could really improve the user experience. Right now, when you create a brick with multiple options (like different auth methods), users get bombarded with irrelevant questions.
The Problem
Imagine this scenario - you're creating a Flutter app and you select "no_auth" as your authentication method, but then mason still asks you:
- "Do you want to enable Google Sign-In with Firebase?"
- "Do you want to enable Apple Sign-In with Firebase?"
Like... what? 😅 That doesn't make any sense! If I chose no auth, why am I getting Firebase questions?
What I'm Proposing
Add a simple when
clause to brick.yaml variables so we can conditionally show questions based on previous answers. Something like this:
vars:
auth_method:
type: enum
values: [firebase, custom_jwt, no_auth]
default: firebase
prompt: Which authentication method do you want to use?
firebase_google:
type: boolean
default: true
prompt: Do you want to enable Google Sign-In with Firebase?
when: auth_method == firebase # Only show if firebase is selected
firebase_apple:
type: boolean
default: true
prompt: Do you want to enable Apple Sign-In with Firebase?
when: auth_method == firebase # Only show if firebase is selected
Why This Matters
Current Flow (Confusing):
? Which authentication method do you want to use? no_auth
? Do you want to enable Google Sign-In with Firebase? (Y/n) 🤔
? Do you want to enable Apple Sign-In with Firebase? (Y/n) ��
*
With when
clause (Clean):
What Needs to Be Done
Parser Stuff:
- Make brick.yaml understand
when
conditions - Add validation for condition syntax
- Support basic operators like
==
,!=
,in
,not in
Real-World Example
I'm building a Flutter Riverpod starter brick, and when someone selects "no_auth", they still get Firebase questions. It's super confusing! This feature would fix that instantly.
TL;DR: Add when
clauses to brick.yaml so questions only show when they're relevant. Makes mason way more user-friendly! 🚀