true_design_system_component 1.0.2
true_design_system_component: ^1.0.2 copied to clipboard
Hick's law (Welford, 1980) states that mean response time in simple decision tasks is a linear function of the transmitted information.
true | dtac design system Guidelines
1. Classes:
- Use
UpperCamelCase
(also known as PascalCase). - Classes should be named after what they represent. For example, if you have a class that represents a user profile, you might name it
UserProfile
. - Avoid using abbreviations unless they are widely accepted (like
Http
for HTTP).
2. Files:
- Use
snake_case
for file names. For example,user_profile.dart
. - For Dart files that contain a single class, it’s common to match the file name to the class name but in
snake_case
. - Name files so that they easily hint at their contents. For instance, if you have utilities related to network operations, you might have a
network_utils.dart
.
3. Folders:
- Use
snake_case
for folder names. - Organize your project in a modular fashion. Instead of having a single folder for all models or views, consider grouping related files together. For example:
/users
/models
user_model.dart
/views
user_profile_view.dart
user_list_view.dart
/controllers
user_controller.dart
- For shared components that can be used across different parts of your app, consider creating a
shared
orcommon
folder. - For constants, utilities, and other shared logic, you can use folders named
constants
,utils
, orhelpers
.
4. Special Types of Files:
- For widgets, consider suffixing with
Widget
. For example,ProfileCardWidget
. - For models, consider suffixing with
Model
. For example,UserModel
. - For controllers, consider suffixing with
Controller
. For example,UserController
.
5. Extensions and Packages:
- When creating package-like structures or extensions inside your project, you might use a folder structure similar to how Dart packages are organized with
lib
andsrc
subdirectories. This can be useful for larger projects.
6. Private Files and Members:
- In Dart, if you want something to be private to its library, you can start its name with an underscore (
_
). This can apply to file names as well. For instance,_private_helper.dart
.
7. Consistency:
- Perhaps the most important rule is to be consistent. Choose a naming convention and folder structure and stick to it throughout your project.