Home / Packages / @flyeric0212/frameworks-flutter

@flyeric0212/frameworks-flutter

该规则解释了 Flutter 小部件模式和跨平台移动开发的最佳实践。 globs: **/*.dart

prpm install @flyeric0212/frameworks-flutter
0 total downloads

📄 Full Prompt Content

---
description: 该规则解释了 Flutter 小部件模式和跨平台移动开发的最佳实践。
globs: **/*.dart
alwaysApply: false
---

# Flutter 规则

- 对于没有内部状态的 UI 组件使用 StatelessWidget。
- 对于需要维护状态的组件使用 StatefulWidget:

```dart
class Counter extends StatefulWidget {
  @override
  _CounterState createState() => _CounterState();
}

class _CounterState extends State<Counter> {
  int _count = 0;

  void _increment() {
    setState(() { _count++; });
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Text('Count: $_count'),
        ElevatedButton(onPressed: _increment, child: Text('Increment')),
      ],
    );
  }
}
```

- 对于复杂应用使用状态管理解决方案(Provider、Bloc、Riverpod)。
- 使用适当的文件夹结构组织代码(models、screens、widgets、services)。
- 使用命名路由和 Navigator.pushNamed() 进行导航。
- 使用 async/await 处理异步操作,并进行适当的错误处理。
- 使用主题(themes)在整个应用中保持一致的样式。

═══════════════════════════════════════════════════════════════════
═══ ENGLISH TRANSLATION ═══
═══════════════════════════════════════════════════════════════════

---
description: Frameworks Flutter Development Guidelines (Translation)
---

# Frameworks Flutter Guidelines - English Translation

**Note**: This package contains Chinese cursor rules for Frameworks Flutter.

**Original Language**: Chinese (Simplified)

**Content Summary**: This package provides comprehensive development guidelines, best practices, and coding standards for Frameworks Flutter. The rules cover code organization, naming conventions, design patterns, testing strategies, and performance optimization.

**Translation Status**: Automated translation placeholder. For accurate technical translation of specific terms and context, please:
1. Use the original Chinese content above as authoritative reference
2. Refer to official Frameworks Flutter documentation in English
3. The technical patterns and code examples remain universal across languages

**How to Use**:
- Code blocks and examples use universal syntax
- Technical terms (APIs, methods, libraries) are typically in English even in Chinese text
- Structure and organization principles translate directly to English development practices

**Content Length**: 829 characters of detailed technical guidance

For community-contributed English translation, please refer to the source repository.

💡 Suggested Test Inputs

Loading suggested inputs...

🎯 Community Test Results

Loading results...

📦 Package Info

Format
cursor
Type
rule
Category
backend-frameworks
License
MIT

🔗 Links

🏷️ Tags