Skip to content

Commit 82f9fc7

Browse files
authored
Merge pull request #51 from xsoulspace/light-experiments
Light experiments
2 parents 6f7db2c + 6eeec52 commit 82f9fc7

678 files changed

Lines changed: 721031 additions & 244015 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cursor/rules/dart_dev.mdc

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
description:
3+
globs: *.dart
4+
alwaysApply: false
5+
---
6+
You are a senior Dart programmer specializing in Flutter, Flame and Game development. Generate code adhering to:
7+
8+
1. **Dart and Flutter best practices**:
9+
10+
- Clean code and design patterns
11+
- Use Dart 3.8, Flutter 3.32
12+
- Use async / await instead of then
13+
14+
2. **Enhanced Documentation**:
15+
- Write precise, future-proof dartdoc comments that focus on the specific purpose
16+
- Include cross-references to related classes and real usage examples
17+
- Document relationships between related components
18+
- Avoid scope limitations unless absolutely necessary
19+
- Use {@template} for reusable component documentation
20+
- Include practical code samples showing real usage patterns
21+
- Document all parameters with `///`
22+
- Add warning comments for important usage notes
23+
- Reference concrete implementations in the codebase
24+
25+
```dart
26+
/// {@template game_button}
27+
/// Custom button widget for game interactions
28+
/// {@endtemplate}
29+
class GameButton extends StatelessWidget {
30+
/// {@macro game_button}
31+
const GameButton({
32+
required this.onPressed,
33+
this.icon,
34+
super.key,
35+
});
36+
```
37+
38+
39+
2. Coding standards:
40+
41+
- Explicit type declarations
42+
- Dart naming conventions (PascalCase for classes, camelCase for variables/functions)
43+
- Prefer const constructors
44+
- Extension methods for added functionality (e.g., GameId)
45+
- Use required commas linter rule in dart
46+
- Prefer arrow functions style for dart
47+
- Prefer const constructors with named parameters with const values instead of nullable ones
48+
49+
3. Flutter widgets and concepts:
50+
51+
- Dart 3.8 syntax for null safety, pattern matching, and more
52+
- Appropriate use of StatelessWidget or Stateful widgets
53+
- Custom reusable widgets (use ui_kit) instead of methods
54+
- Cupertino or Material Design as appropriate
55+
- Proper error handling and async/await for asynchronous operations
56+
- flutter_animate for animations
57+
58+
4. Project structure:
59+
60+
- Follow existing organization
61+
- Use common imports (lib/common_imports.dart)
62+
63+
5. Additional requirements:
64+
- Implement routing using go_router
65+
- Write unit tests for business logic and widget tests for UI components
66+
- Implement proper form validation and user input handling
67+
- Use [] when referencing code
68+
- Generate readable, short, and concise documentation
69+
- Use {@template} and {@macro} to create and use dart doc code snippets
70+
71+
Generate concise, efficient code following these guidelines while maintaining existing project structure and conventions.

.cursor/rules/dart_doc.mdc

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
description: when generating dartdoc or documentation for dart
3+
globs:
4+
alwaysApply: false
5+
---
6+
Please add comprehensive Dart documentation comments to the specified classes, following these guidelines:
7+
8+
1. Use /// for documentation comments.
9+
2. Start with a brief, single-sentence summary of the class's purpose.
10+
3. Follow with a more detailed description if necessary, keeping it concise.
11+
4. Include an @ai annotation with specific instructions for AI tools on how to interpret and use this class.
12+
5. Document all public members (methods, properties, etc.) with clear, concise explanations of their purpose and usage.
13+
6. Use [bracketed] references for any mentioned identifiers within the class.
14+
7. Include code examples where appropriate, using ```dart code fences.
15+
8. Mention any important relationships with other classes or libraries.
16+
9. Use PREFER, AVOID, or CONSIDER for recommendations about usage patterns.
17+
10. Add @deprecated tags with explanations for any deprecated members.
18+
11. Place doc comments before metadata annotations.
19+
12. Use prose to explain parameters, return values, and exceptions.
20+
13. For boolean properties, start comments with "Whether" followed by a description.
21+
14. Document only the getter for properties with both a getter and setter.
22+
15. Consider including a code sample in the class-level comment.
23+
24+
Example format:
25+
26+
````dart
27+
/// A widget that displays a customizable progress indicator.
28+
///
29+
/// This class provides a flexible way to show loading progress in your app.
30+
/// It supports both determinate and indeterminate progress modes.
31+
///
32+
/// Use [ProgressIndicator.circular] for a circular indicator, or
33+
/// [ProgressIndicator.linear] for a linear one.
34+
///
35+
/// ```dart
36+
/// ProgressIndicator(
37+
/// value: 0.7,
38+
/// backgroundColor: Colors.grey[300],
39+
/// valueColor: AlwaysStoppedAnimation<Color>(Colors.blue),
40+
/// )
41+
/// ```
42+
///
43+
/// See also:
44+
///
45+
/// * [CircularProgressIndicator], which shows progress along a circular arc.
46+
/// * [LinearProgressIndicator], which displays progress along a line.
47+
///
48+
/// @ai When generating code involving this class, ensure proper initialization
49+
/// of [value] and consider the appropriate use of [backgroundColor] and [valueColor].
50+
class ProgressIndicator extends StatefulWidget {
51+
/// Creates a progress indicator.
52+
///
53+
/// The [value] argument should be null for an indeterminate progress indicator.
54+
/// For determinate progress indicators, [value] should be a non-null value
55+
/// between 0.0 and 1.0, inclusive.
56+
///
57+
/// @ai Ensure [value] is within the valid range when provided.
58+
const ProgressIndicator({
59+
Key? key,
60+
this.value,
61+
this.backgroundColor,
62+
this.valueColor,
63+
this.semanticsLabel,
64+
this.semanticsValue,
65+
}) : super(key: key);
66+
67+
/// The progress value between 0.0 and 1.0.
68+
///
69+
/// If null, the progress indicator is indeterminate.
70+
///
71+
/// @ai Use this property to control the progress. Ensure it's between 0.0 and 1.0.
72+
final double? value;
73+
74+
/// The progress indicator's background color.
75+
///
76+
/// @ai Consider using a contrasting color to [valueColor] for better visibility.
77+
final Color? backgroundColor;
78+
79+
/// The progress indicator's color as an animated value.
80+
///
81+
/// @ai Use [AlwaysStoppedAnimation] for a solid color, or custom animations for dynamic effects.
82+
final Animation<Color?>? valueColor;
83+
84+
/// Creates a circular progress indicator.
85+
///
86+
/// @ai Use this constructor for a circular representation of progress.
87+
const ProgressIndicator.circular({Key? key}) : this(key: key);
88+
89+
/// Creates a linear progress indicator.
90+
///
91+
/// @ai Use this constructor for a linear representation of progress.
92+
const ProgressIndicator.linear({Key? key}) : this(key: key);
93+
94+
/// This method is deprecated and will be removed in the next major version.
95+
///
96+
/// Use [newMethod] instead.
97+
@Deprecated('Use newMethod() instead')
98+
void oldMethod() {
99+
// ...
100+
}
101+
102+
@override
103+
State<ProgressIndicator> createState() => _ProgressIndicatorState();
104+
}
105+
````
106+
107+
Please apply this documentation style to the following classes:
108+
109+
1. ClassA
110+
2. ClassB
111+
3. ClassC
112+
113+
Ensure that the documentation is clear, concise, and provides valuable information for both human developers and AI tools. Use `dart format` to format the code correctly.
114+
115+
References:
116+
@Dart

0 commit comments

Comments
 (0)