Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2323f19
- Cursor rules
urvashi-k-7span Jun 17, 2025
898cef7
Imp: Update auto-route rules to use BackButtonListener instead of Pop…
avni-7span Jun 18, 2025
70dc67d
fix: Replaced AppBar with CustomAppBar in multiple screens for consis…
avni-7span Jun 18, 2025
001bcb6
fix: Updated atomic design rule documentation for app_translations pa…
avni-7span Jun 18, 2025
9075f12
imp: Updated color usage guidelines and removed unnecessary guidelines.
avni-7span Jun 18, 2025
3065f13
imp: Removd unnecessary rules for Rest API Client documentation
avni-7span Jun 18, 2025
7ad8977
imp: added project rules for trae
avni-7span Jun 18, 2025
a000869
Updated firebase_remote_config_service.dart
avni-7span Jun 24, 2025
99158bd
feat: Implemented forgot password and verify OTP functionality
tulsi-7span Jun 26, 2025
ce06d46
Fix: Moved pinput dependency from dev_dependencies to dependencies
tulsi-7span Jun 26, 2025
d67d597
Add const keyword for ResendEmailEvent in VerifyOTPBloc
tulsi-7span Jun 26, 2025
3c6cfc8
- Added `did_not_receive_otp` key to `en.i18n.json`.
tulsi-7span Jun 26, 2025
0919b04
Refactor: Improve OTP verification and UI elements
tulsi-7span Jun 26, 2025
5c7c47a
Fix: Added mounted checks in VerifyOTPScreen timer callbacks
tulsi-7span Jun 26, 2025
e155fb7
Update COUNTER
tulsi-7span Jun 26, 2025
dece445
Updated app_textfield.dart
avni-7span Jun 26, 2025
20dea33
Feat: Add AppTimer widget and integrate with OTP verification
tulsi-7span Jun 26, 2025
afb98c8
Refactor: Streamline AppTimer and Verify OTP UI
tulsi-7span Jun 27, 2025
800c80b
Fix: Prevent `AppTimer` from starting if initial seconds is 0
tulsi-7span Jun 27, 2025
f997923
Fix: AppTimer displays minutes and seconds
tulsi-7span Jun 27, 2025
2de49f7
Refactor: Improve OTP verification and UI
tulsi-7span Jun 27, 2025
566257d
Refactor: Update OTP verification and forgot password functionality
tulsi-7span Jun 27, 2025
042b7be
Refactor: Standardize email property in SetEmailEvent
tulsi-7span Jun 27, 2025
81917b5
Refactor: Update VerifyOTPScreen and related BLoC
tulsi-7span Jun 27, 2025
a6c47a3
Refactor: Removed unused `EmailValidator` import
tulsi-7span Jun 27, 2025
956581d
Remove unused initState from VerifyOTPScreen
tulsi-7span Jun 27, 2025
57757e3
Fix: Adjusted button padding on Verify OTP screen
tulsi-7span Jun 27, 2025
d269391
Refactor: Removed unnecessary Padding from VerifyOTPScreen
tulsi-7span Jun 27, 2025
b6c5722
Refactor: Introduce AppOtpInput widget and update dependencies
tulsi-7span Jun 27, 2025
fd4c8ca
chore: Added documentation in the build-apk so that devs using puro o…
cavin-7span Jul 4, 2025
a6411d4
Updated app_textfield.dart
avni-7span Jul 16, 2025
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
227 changes: 227 additions & 0 deletions .cursor/rules/assets-rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
---
description:
globs:
alwaysApply: true
---
description: "Flutter Assets Management Rule (flutter_gen)"
alwaysApply: true

## Overview
This rule enforces the use of `flutter_gen` package for type-safe asset management in Flutter projects, replacing raw string asset paths with generated code.

## Rule Application

### ❌ NEVER Use Raw String Paths
**Avoid this pattern:**
```dart
// DON'T DO THIS
Image.asset("assets/demo.png")
Image.asset("assets/icons/home.svg")
Image.asset("assets/images/profile.jpg")
```

### ✅ ALWAYS Use Generated Asset Classes
**Use this pattern instead:**
```dart
// DO THIS
Assets.images.demo.image()
Assets.icons.home.svg()
Assets.images.profile.image()
```

## Implementation Steps

### 1. Asset Placement
- **ALWAYS** add assets to the `assets` folder in the **app_ui** package
- Organize assets by type (images, icons, fonts, etc.)
- Use descriptive, snake_case naming for asset files

### 2. Directory Structure
```
app_ui/
├── assets/
│ ├── images/
│ │ ├── demo.png
│ │ ├── profile.jpg
│ │ └── background.png
│ ├── icons/
│ │ ├── home.svg
│ │ ├── search.svg
│ │ └── settings.svg
│ └── fonts/
│ └── custom_font.ttf
```

### 3. Code Generation
After adding new assets, **ALWAYS** run:
```bash
melos run asset-gen
```

### 4. Usage Patterns

#### Images
```dart
// For PNG/JPG images
Assets.images.demo.image()
Assets.images.profile.image()
Assets.images.background.image()

// With additional properties
Assets.images.demo.image(
width: 100,
height: 100,
fit: BoxFit.cover,
)
```

#### SVG Icons
```dart
// For SVG assets
Assets.icons.home.svg()
Assets.icons.search.svg()
Assets.icons.settings.svg()

// With color and size
Assets.icons.home.svg(
color: Colors.blue,
width: 24,
height: 24,
)
```

#### Raw Asset Paths (when needed)
```dart
// If you need the path string
Assets.images.demo.path
Assets.icons.home.path
```

## Asset Type Mappings

### Common Asset Extensions and Usage
| Extension | Usage Pattern | Example |
|-----------|---------------|---------|
| `.png`, `.jpg`, `.jpeg` | `.image()` | `Assets.images.photo.image()` |
| `.svg` | `.svg()` | `Assets.icons.star.svg()` |
| `.json` | `.path` | `Assets.animations.loading.path` |
| `.ttf`, `.otf` | Reference in theme | Font family name |

## Implementation Checklist

### Adding New Assets:
- [ ] Place asset in appropriate folder within `app_ui/assets/`
- [ ] Use descriptive, snake_case naming
- [ ] Run `melos run asset-gen` command
- [ ] Verify asset appears in generated `Assets` class
- [ ] Update existing raw string references to use generated code

### Code Review Checklist:
- [ ] No raw string asset paths (`"assets/..."`)
- [ ] All assets use `Assets.category.name.method()` pattern
- [ ] Asset generation command run after adding new assets
- [ ] Unused assets removed from assets folder

## Common Patterns

### Image Widget
```dart
// Basic image
Assets.images.logo.image()

// Image with properties
Assets.images.banner.image(
width: double.infinity,
height: 200,
fit: BoxFit.cover,
)

// Image in Container
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: Assets.images.background.provider(),
fit: BoxFit.cover,
),
),
)
```

### SVG Usage
```dart
// Basic SVG
Assets.icons.menu.svg()

// Styled SVG
Assets.icons.heart.svg(
color: theme.primaryColor,
width: 20,
height: 20,
)

// SVG in IconButton
IconButton(
onPressed: () {},
icon: Assets.icons.settings.svg(),
)
```

### Asset Provider (for advanced usage)
```dart
// For use with other widgets that need ImageProvider
CircleAvatar(
backgroundImage: Assets.images.avatar.provider(),
)

// For precaching
precacheImage(Assets.images.splash.provider(), context);
```

## Best Practices

### Naming Conventions
- Use `snake_case` for asset file names
- Be descriptive: `user_profile.png` instead of `img1.png`
- Group related assets: `icon_home.svg`, `icon_search.svg`

### Organization
- **images/**: Photos, illustrations, backgrounds
- **icons/**: SVG icons, small graphics
- **animations/**: Lottie files, GIFs
- **fonts/**: Custom font files

### Performance
- Use appropriate image formats (SVG for icons, PNG/JPG for photos)
- Optimize image sizes before adding to assets
- Consider using `precacheImage()` for critical images

## Migration from Raw Strings

### Find and Replace Pattern
1. Search for: `Image.asset("assets/`
2. Replace with appropriate `Assets.` pattern
3. Run asset generation if needed
4. Test all asset references

### Example Migration
```dart
// Before
Image.asset("assets/images/logo.png", width: 100)

// After
Assets.images.logo.image(width: 100)
```

## Troubleshooting

### Asset Not Found
1. Verify asset exists in `app_ui/assets/` folder
2. Check file naming (no spaces, special characters)
3. Run `melos run asset-gen` command
4. Restart IDE/hot restart app

### Generated Code Not Updated
1. Run `melos run asset-gen` command
2. Check for build errors in terminal
3. Verify `flutter_gen` is properly configured in `pubspec.yaml`
4. Clean and rebuild project if necessary
Loading
Loading