Skip to content

Fixes/fix issues#34

Merged
Arjun544 merged 12 commits into
mainfrom
fixes/fix_issues
May 2, 2026
Merged

Fixes/fix issues#34
Arjun544 merged 12 commits into
mainfrom
fixes/fix_issues

Conversation

@Arjun544
Copy link
Copy Markdown
Owner

@Arjun544 Arjun544 commented May 2, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added input validation for app name and package ID with auto-fix functionality
    • Visual error state indicators now display during wizard configuration
    • Enhanced backend configuration with granular provider-specific options
  • Refactoring

    • Consolidated icon rendering system for consistency across the application
    • Optimized API caching strategy for improved performance

@vercel
Copy link
Copy Markdown

vercel Bot commented May 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flutter-init Ready Ready Preview, Comment May 2, 2026 5:29pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 2, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3d578d80-f247-4045-b7a2-bd7a5acb955c

📥 Commits

Reviewing files that changed from the base of the PR and between 26e88b4 and c649b20.

📒 Files selected for processing (37)
  • app/api/stats/route.ts
  • app/components/landing/GitHubStars.tsx
  • app/components/landing/MobileNodePattern.tsx
  • app/components/landing/StatsSection.tsx
  • app/components/wizard/SummaryItem.tsx
  • app/components/wizard/WizardShell.tsx
  • app/components/wizard/steps/BasicsStep.tsx
  • app/components/wizard/steps/GenerateStep.tsx
  • app/lib/config/schema.ts
  • app/lib/generator/index.ts
  • templates/flutter/base/lib/src/shared/helpers/show_toast.dart.hbs
  • templates/flutter/base/lib/src/shared/widgets/app_empty_state.dart.hbs
  • templates/flutter/base/lib/src/shared/widgets/app_error_widget.dart.hbs
  • templates/flutter/base/lib/src/shared/widgets/app_icon.dart.hbs
  • templates/flutter/base/lib/src/shared/widgets/app_top_bar.dart.hbs
  • templates/flutter/base/lib/src/shared/widgets/widgets.dart.hbs
  • templates/flutter/overlays/backend/appwrite/lib/src/services/(usesAppwriteAuth)@auth_service.dart.hbs
  • templates/flutter/overlays/backend/firebase/lib/src/services/(usesFirebaseAuth)@auth_service.dart.hbs
  • templates/flutter/overlays/backend/supabase/lib/src/services/(usesSupabaseAuth)@auth_service.dart.hbs
  • templates/flutter/overlays/device/app_version_update/lib/src/services/(usesAppVersionUpdate)@version_update_service.dart.hbs
  • templates/flutter/overlays/device/device_info/lib/src/services/(usesDeviceInfoPlus)@device_info_service.dart.hbs
  • templates/flutter/overlays/media/lib/src/services/(usesImagePicker,usesFilePicker)@media_service.dart.hbs
  • templates/flutter/overlays/networking/dio/lib/src/services/(usesDio)@dio_service.dart.hbs
  • templates/flutter/overlays/networking/http/lib/src/services/(usesHttp)@http_service.dart.hbs
  • templates/flutter/overlays/storage/hive/lib/src/services/(usesHive)@hive_service.dart.hbs
  • templates/flutter/overlays/storage/secure_storage/lib/src/services/(usesSecureStorage)@secure_storage_service.dart.hbs
  • templates/flutter/overlays/storage/shared_preferences/lib/src/services/(usesSharedPreferences)@storage_service.dart.hbs
  • templates/flutter/overlays/utilities/geolocator/lib/src/services/(usesGeolocator)@location_service.dart.hbs
  • templates/flutter/overlays/utilities/path_provider/lib/src/services/(usesPathProvider)@path_service.dart.hbs
  • templates/flutter/overlays/utilities/permission_handler/lib/src/services/(usesPermissionHandler)@permission_service.dart.hbs
  • templates/flutter/overlays/utilities/share_plus/lib/src/services/(usesSharePlus)@share_service.dart.hbs
  • templates/flutter/overlays/utilities/url_launcher/lib/src/services/(usesUrlLauncher)@url_launcher_service.dart.hbs
  • templates/flutter/partials/features/auth/forgot_password_screen.hbs
  • templates/flutter/partials/features/auth/login_screen.hbs
  • templates/flutter/partials/features/auth/signup_screen.hbs
  • templates/flutter/partials/features/home/home_page.hbs
  • templates/flutter/partials/features/onboarding/onboarding_page.hbs

📝 Walkthrough

Walkthrough

This PR tightens API caching for stats endpoints (300s→60s), adds backend capability flags to the template context, introduces an AppIcon abstraction widget for conditional icon rendering across Flutter templates, enhances wizard form validation with auto-fix buttons and stricter schema rules, and refactors authentication screens to support Flutter Hooks with centralized UI components and improved loading/validation state management.

Changes

API Caching Optimization

Layer / File(s) Summary
Route Configuration
app/api/stats/route.ts
revalidate reduced from 300 to 60 seconds; Cache-Control header s-maxage and stale-while-revalidate reduced from 300/600 to 60/120.
Client-Side Fetch
app/components/landing/StatsSection.tsx
Stats fetch URL switched to NEXT_PUBLIC_VERCEL_URL and next.revalidate timing reduced to 60 seconds.

Configuration Validation & Wizard UI

Layer / File(s) Summary
Data Schema
app/lib/config/schema.ts
appName and packageId fields now enforce regex patterns (/^[a-z][a-z0-9_]*$/ and dotted variant); derivePackageId sanitizes non-alphanumeric chars; defaultConfig uses fixed com.example.flutter_starter.
Validation State
app/components/wizard/WizardShell.tsx
Added memoized validation via scaffoldConfigSchema.safeParse(config); handleGenerate blocks on invalid config; "Next/Finish" button disabled when config invalid.
Component UI
app/components/wizard/SummaryItem.tsx
Added optional error prop to conditionally apply destructive styling (border, background, text color).
Input Validation UI
app/components/wizard/steps/BasicsStep.tsx
"App name" and "Package ID" inputs now show validation state with auto-fix buttons, destructive styling, and inline error messages.
Summary Validation Display
app/components/wizard/steps/GenerateStep.tsx
SummaryItem components for app name and package ID now display validation errors via the error prop.

Icon System Abstraction

Layer / File(s) Summary
New Widget
templates/flutter/base/lib/src/shared/widgets/app_icon.dart.hbs
Added AppIcon stateless widget that conditionally renders HugeIcon (when flags.usesHugeicons) or standard Icon, with nullable icon support.
Widget Exports
templates/flutter/base/lib/src/shared/widgets/widgets.dart.hbs
Added barrel export for app_icon.dart.
Icon Signatures
templates/flutter/base/lib/src/shared/helpers/show_toast.dart.hbs, templates/flutter/base/lib/src/shared/widgets/app_empty_state.dart.hbs, templates/flutter/base/lib/src/shared/widgets/app_error_widget.dart.hbs
Updated icon parameter types from IconData? to dynamic to support AppIcon's flexible icon input.
Icon Usage
templates/flutter/base/lib/src/shared/..., templates/flutter/partials/features/home/home_page.hbs
Switched from built-in Icon to AppIcon in toast, empty-state, error-widget, and home-page components.
Import Updates
templates/flutter/base/lib/src/shared/widgets/app_top_bar.dart.hbs, templates/flutter/partials/features/onboarding/onboarding_page.hbs
Updated imports from core_imports.dart to imports.dart.
Image Loading
app/components/landing/MobileNodePattern.tsx
Supabase and Firebase node icons now use Next.js Image component instead of HugeiconsIcon.

Backend Capability Flags

Layer / File(s) Summary
Template Context Type
app/lib/generator/index.ts
Extended TemplateContext.flags with 7 new boolean fields: usesFirebaseAuth, usesFirebaseFirestore, usesFirebaseStorage, usesSupabaseAuth, usesSupabaseDb, usesAppwriteAuth, usesAppwriteDb.
Flag Population
app/lib/generator/index.ts
buildTemplateContext() now sets each flag based on config.backend.provider and provider-specific options, enabling conditional template generation.

Auth Screen Hooks Refactoring

Layer / File(s) Summary
Conditional Template Logic
templates/flutter/overlays/backend/firebase/lib/src/services/(usesFirebaseAuth)@auth_service.dart.hbs
Wrapped login, signUp, and forgotPassword methods in {{#if backend.options.authEmail}} conditional blocks for conditional generation.
Hooks-Based Screen State
templates/flutter/partials/features/auth/login_screen.hbs, templates/flutter/partials/features/auth/signup_screen.hbs, templates/flutter/partials/features/auth/forgot_password_screen.hbs
When flags.usesFlutterHooks is enabled, screens are now HookConsumerWidget (Riverpod) or HookWidget, with hook-based form state, loading state management per framework (Riverpod/Bloc/Provider/GetX/MobX/NoneState).
Non-Hooks Stateful Implementation
templates/flutter/partials/features/auth/login_screen.hbs, templates/flutter/partials/features/auth/signup_screen.hbs, templates/flutter/partials/features/auth/forgot_password_screen.hbs
When hooks are disabled, screens use ConsumerStatefulWidget (Riverpod) or StatefulWidget with dedicated state classes owning controllers and loading flags; setState manages loading state with mounted guards.
Centralized UI Components
templates/flutter/partials/features/auth/login_screen.hbs, templates/flutter/partials/features/auth/signup_screen.hbs, templates/flutter/partials/features/auth/forgot_password_screen.hbs
New private _LoginView, _SignupView, _ForgotPasswordView widgets extract and centralize UI rendering, decoupling state management from presentation.
Handler Logic & Validation
templates/flutter/partials/features/auth/login_screen.hbs, templates/flutter/partials/features/auth/signup_screen.hbs, templates/flutter/partials/features/auth/forgot_password_screen.hbs
Enhanced error handling with showToast on failures; loading state reset guarded by mounted in non-hooks paths and finally blocks in hooks paths; email/password inputs trimmed before submission.
Navigation Updates
templates/flutter/partials/features/auth/signup_screen.hbs
"Already have account" tap now navigates to login route (router-package-dependent) instead of popping.

Sequence Diagram

sequenceDiagram
    participant User as User
    participant Screen as Auth Screen<br/>(Hooks/Stateful)
    participant Handler as handleLogin/<br/>handleSignup
    participant Service as AuthService /<br/>Controller
    participant Backend as Backend<br/>(Firebase/Supabase)
    participant UI as _LoginView /<br/>_SignupView

    User->>Screen: Input credentials & tap submit
    Screen->>UI: Pass form state, obscure flag, isLoading
    UI->>Handler: Call onLogin / onSignup
    Handler->>Handler: Validate form, set isLoading = true
    Handler->>Service: Call login() / signup()
    Service->>Backend: Send auth request
    Backend-->>Service: Return result
    Service-->>Handler: Return fold(error, success)
    Handler->>Handler: Show toast on error
    Handler->>Handler: Navigate on success
    Handler->>Handler: Reset isLoading = false
    Handler-->>Screen: Update state / notify via setState
    Screen->>UI: Re-render with updated isLoading
    UI-->>User: Display loading state / success/error
Loading

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly Related PRs

  • PR #30: Modifies the same stats endpoint caching behavior (revalidate 300→60 and Cache-Control timing reduction) in app/api/stats/route.ts and StatsSection.tsx fetch configuration.
  • PR #15: Updates the same TemplateContext.flags in app/lib/generator/index.ts to manage backend-specific template generation configuration.
  • PR #27: Previously introduced the stats API caching configuration that is now being tightened in this PR's app/api/stats/route.ts.

Poem

🐰 A wizard once cluttered with icons galore,
Till AppIcon came knocking upon the door—
With validation so bright and flags shining true,
The auth screens now dance in the hooks' morning dew.
Cache whispers faster, forms validate clean,
The finest refactor I've ever seen!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fixes/fix_issues

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@Arjun544 Arjun544 merged commit bf38516 into main May 2, 2026
3 of 4 checks passed
@Arjun544 Arjun544 deleted the fixes/fix_issues branch May 2, 2026 17:30
@coderabbitai coderabbitai Bot mentioned this pull request May 22, 2026
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.

1 participant