Mobile Code Conventions - bounswe/bounswe2022group5 GitHub Wiki
Variable Naming Conventions
- When naming a class, record, or struct, PascalCasing should be used.
- When naming variables, and methods, camelCasing should be used.
Comment Conventions
- When commenting, there should be a space between '//' and the text.
- When commenting, the comment should start with uppercase letter.
- When commenting, the comment should end with a period(.).
- When commenting, the comment should be in a seperate line, not at the end of the line of code.
Layout Conventions
- Write only one statement per line.
- Write only one declaration per line.
Other Conventions
App theme and colors
- We are using Flex Color Scheme Library to create a consistent view among all app.
- We are using
FlexScheme.aquaBlue
scheme. More info about this scheme can be found in this playground after choosing the correct color scheme.
So, to use colors in our app:
- Instead of using constant colors (e.g.
Color(0xFF43A4)
orColors.blue
), we can useTheme.of(context)
object.- Predefined colors in the context theme:
Theme.of(context).primaryColor
,Theme.of(context).canvasColor
,Theme.of(context).backgroundColor
,... (more color options can be seen by using AndroidStudio's auto fill options.) - Predefined colors in the color scheme of this context theme:
Theme.of(context).colorScheme.primary
,Theme.of(context).colorScheme.secondary
,Theme.of(context).colorScheme.tertiary
,Theme.of(context).colorScheme.surface
, ... (more color options can be seen by using AndroidStudio's auto fill options.)
- Predefined colors in the context theme: