Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Add support for double default values #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
zhangruiyu merged 1 commit into fluttercandies:master from ikku47:fix-double-support
Oct 11, 2025

Conversation

Copy link

@ikku47 ikku47 commented Jun 30, 2025

🐛 Problem

When using the "set default values" option, double fields were not getting default values assigned, causing inconsistent behavior compared to other primitive types (int, bool, String, List).

This could lead to:

  • Runtime issues in Dart when double fields are not nullable
  • Inconsistent code generation
  • Missing default values for double properties

✅ Solution

Added complete support for double default values across the entire codebase:

Changes Made:

  1. Settings.kt:

    • Added doubleDefaultValue: String = "0.0" field
    • Added doubleFieldDefaultValue(): String? method
  2. ClassDefinition.kt:

    • Added double case in field generation logic
    • Bonus fix: Fixed existing bugs where bool and int checks incorrectly used stringFieldDefaultValue()
  3. JsonInputDialog.kt:

    • Added UI input field for double default values
    • Positioned logically between int and bool fields

🧪 Testing

  • All files compile without errors
  • UI properly displays double default value input field
  • Generated code includes double default values when enabled
  • Existing functionality for other types remains unchanged

📸 Before vs After

Before: double fields had no default values
After: double fields get configurable default values (default: "0.0")

🔗 Related Issues

Fixes the missing double default value support identified during codebase analysis.

shabeer3508 reacted with thumbs up emoji
- Add doubleDefaultValue field and doubleFieldDefaultValue() method to Settings
- Add double case in ClassDefinition field generation logic
- Add UI input field for double default values in JsonInputDialog
- Fix existing bugs where bool/int checks used stringFieldDefaultValue()
Fixes issue where double fields didn't get default values when 'set default'
option was enabled, causing inconsistent behavior compared to other primitive types.
@ikku47 ikku47 requested a review from zhangruiyu as a code owner June 30, 2025 11:07
@zhangruiyu zhangruiyu merged commit 6d03126 into fluttercandies:master Oct 11, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@zhangruiyu zhangruiyu Awaiting requested review from zhangruiyu zhangruiyu is a code owner

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /