-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(DX-353): display IsJammed State if device supports it (#37)
* refactor(device_provider): move String literal to file containing strings * test(lock-related): change LockTrait instantiation signatures * refactor(lock_slim_widget.dart): small refactor * feat(DX-353): display isJammed State if device supports it * test(lock_widget_testing): add missing stub * feat(lock_widget): use warning text color if jammed state is True * fix(lock_widget): use warning text color for whole row if Jammed State * test(test/providers/lock_provider_test.dart): Improve test coverage * fix(lock_widget): follow Figma style guide * test(lock_widget): update tests * refactor(lock_widget): remove unused method * refactor(lock_widget): extract notification to new widget * test(lock_widget_test): add more tests * fix(lock_widget_test): fix onTap behavior test Co-authored-by: CircleCI <developer@yonomi.co> Co-authored-by: Rigoberto L. Perez <rigoberto.perez@allegion.com>
- Loading branch information
1 parent
f254bd9
commit e82f8d4
Showing
35 changed files
with
1,070 additions
and
19 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
doc/api/providers_lock_provider/LockProvider/getIsJammedState.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
|
||
|
||
# getIsJammedState property | ||
|
||
|
||
|
||
|
||
*[<Null safety>](https://dart.dev/null-safety)* | ||
|
||
|
||
|
||
|
||
[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) getIsJammedState | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
## Implementation | ||
|
||
```dart | ||
bool get getIsJammedState => | ||
getLockTrait()?.stateWhereType<IsJammed>().value ?? false; | ||
``` | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
|
||
|
||
|
||
# buildIsJammedRow method | ||
|
||
|
||
|
||
|
||
*[<Null safety>](https://dart.dev/null-safety)* | ||
|
||
|
||
|
||
|
||
[Widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) buildIsJammedRow | ||
([BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html) context) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
## Implementation | ||
|
||
```dart | ||
Widget buildIsJammedRow(BuildContext context) { | ||
return Container( | ||
height: 48, | ||
margin: const EdgeInsets.only(left: 8.0, right: 8.0), | ||
child: Card( | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Row( | ||
children: [ | ||
SizedBox(width: 16), | ||
Icon(BootstrapIcons.exclamation_diamond_fill), | ||
SizedBox(width: 8), | ||
Text(StringConstants.DEVICE_IS_JAMMED), | ||
], | ||
), | ||
Container( | ||
width: 50, | ||
alignment: Alignment.center, | ||
decoration: BoxDecoration( | ||
border: Border( | ||
left: BorderSide(width: 1.0, color: Colors.white))), | ||
child: Icon(BootstrapIcons.x), | ||
), | ||
], | ||
), | ||
color: _warningTextColor, | ||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), | ||
elevation: 2, | ||
), | ||
); | ||
} | ||
``` | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
39 changes: 39 additions & 0 deletions
39
doc/api/traits_lock_widget/LockWidget/shouldDisplayJammedState.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
|
||
|
||
# shouldDisplayJammedState method | ||
|
||
|
||
|
||
|
||
*[<Null safety>](https://dart.dev/null-safety)* | ||
|
||
|
||
|
||
|
||
[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) shouldDisplayJammedState | ||
() | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
## Implementation | ||
|
||
```dart | ||
bool shouldDisplayJammedState() { | ||
final bool supportsIsJammed = | ||
_lockProvider.getLockTrait()?.supportsIsJammed ?? false; | ||
return supportsIsJammed && _lockProvider.getIsJammedState; | ||
} | ||
``` | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.