mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-12-24 11:59:30 +00:00
feat: add shake detection functionality (#36)
* feat: add shake detection functionality and integrate vibration support * feat: add shake detector settings page
This commit is contained in:
parent
2e3b1de529
commit
b229c4f2f5
25 changed files with 1423 additions and 158 deletions
|
|
@ -16,6 +16,16 @@ extension DurationFormat on Duration {
|
|||
return '${seconds}s';
|
||||
}
|
||||
}
|
||||
|
||||
String get smartSingleFormat {
|
||||
if (inHours > 0) {
|
||||
return '${inHours}h';
|
||||
} else if (inMinutes > 0) {
|
||||
return '${inMinutes}m';
|
||||
} else {
|
||||
return '${inSeconds}s';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension OnlyTime on DateTime {
|
||||
|
|
|
|||
25
lib/shared/extensions/enum.dart
Normal file
25
lib/shared/extensions/enum.dart
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
extension TitleCase on Enum {
|
||||
String get properName {
|
||||
final name = toString().split('.').last;
|
||||
return name[0].toUpperCase() + name.substring(1);
|
||||
}
|
||||
|
||||
String get titleCase {
|
||||
return name
|
||||
.replaceAllMapped(RegExp(r'([A-Z])'), (match) => ' ${match.group(0)}')
|
||||
.trim();
|
||||
}
|
||||
|
||||
String get pascalCase {
|
||||
// capitalize the first letter of each word
|
||||
return name
|
||||
.replaceAllMapped(
|
||||
RegExp(r'([A-Z])'),
|
||||
(match) => ' ${match.group(0)}',
|
||||
)
|
||||
.trim()
|
||||
.split(' ')
|
||||
.map((word) => word[0].toUpperCase() + word.substring(1))
|
||||
.join(' ');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue