6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit c268f33d

AuthorNKL<nikolaj.king@gmail.com>
Date2024-11-04 14:51:22 +0100
added new view for the keycard page.

Changed files

comwell_key_app/assets/images/room_key.png         | Bin 0 -> 5865 bytes
 .../assets/images/seos_by_assa_logo.png            | Bin 0 -> 2336 bytes
 comwell_key_app/assets/translations/da-DK.json     |   7 +-
 comwell_key_app/assets/translations/en-US.json     |   7 +-
 comwell_key_app/lib/key/key_page.dart              | 105 +++++++++++++--------
 5 files changed, 78 insertions(+), 41 deletions(-)

Diff

diff --git a/comwell_key_app/assets/images/room_key.png b/comwell_key_app/assets/images/room_key.png
new file mode 100644
index 00000000..bfb65b90
Binary files /dev/null and b/comwell_key_app/assets/images/room_key.png differ
diff --git a/comwell_key_app/assets/images/seos_by_assa_logo.png b/comwell_key_app/assets/images/seos_by_assa_logo.png
new file mode 100644
index 00000000..9c9bc5e7
Binary files /dev/null and b/comwell_key_app/assets/images/seos_by_assa_logo.png differ
diff --git a/comwell_key_app/assets/translations/da-DK.json b/comwell_key_app/assets/translations/da-DK.json
index 4ea1b04a..062c4f7b 100644
--- a/comwell_key_app/assets/translations/da-DK.json
+++ b/comwell_key_app/assets/translations/da-DK.json
@@ -36,7 +36,12 @@
"child": "barn",
"prepare_room":"Klargør dit værelse",
"jump_line_text": "Spring køen over med digital check-in",
- "overview_add_booking": "Find booking"
+ "overview_add_booking": "Find booking",
+ "open_room": "Åben værelse",
+ "hold_phone_to_door": "Hold tæt på læser",
+ "open_room_success": "Succes",
+ "open_room_error": "Prøv igen!"
+
diff --git a/comwell_key_app/assets/translations/en-US.json b/comwell_key_app/assets/translations/en-US.json
index 8accede7..371e0b3d 100644
--- a/comwell_key_app/assets/translations/en-US.json
+++ b/comwell_key_app/assets/translations/en-US.json
@@ -5,7 +5,6 @@
"room_key": "Room key",
"room_keys": "Room keys",
"redeem_code": "Redeem code",
- "hold_phone_to_door": "Hold your phone to the door",
"error_opening_door": "An error occurred",
"try_again": "Try again",
"room_key_description": "This is your room key",
@@ -36,5 +35,9 @@
"child": "child",
"prepare_room":"Prepare your room",
"jump_line_text": "Skip the line with digital check-in",
- "overview_add_booking": "Find booking"
+ "overview_add_booking": "Find booking",
+ "open_room": "Åben værelse",
+ "hold_phone_to_door": "Hold tæt på læser",
+ "open_room_success": "Succes",
+ "open_room_error": "Prøv igen!"
}
\ No newline at end of file
diff --git a/comwell_key_app/lib/key/key_page.dart b/comwell_key_app/lib/key/key_page.dart
index a433f1c2..efab0756 100644
--- a/comwell_key_app/lib/key/key_page.dart
+++ b/comwell_key_app/lib/key/key_page.dart
@@ -1,3 +1,4 @@
+import 'package:comwell_key_app/components/round_icon_button.dart';
import 'package:comwell_key_app/key/bloc/key_bloc.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:easy_localization/easy_localization.dart';
@@ -12,54 +13,69 @@ class KeyPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
- context.read<KeyBloc>().add(SearchForKeys());
+ //context.read<KeyBloc>().add(SearchForKeys());
return BlocBuilder<KeyBloc, KeyState>(builder: (context, state) {
//if (state.status == KeyStatus.scanning || state.status != KeyStatus.openClosestReaderSuccess) {
return FocusDetector(
child: Container(
padding: const EdgeInsets.all(20),
- color: Theme.of(context).colorScheme.primary,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.end,
- children: [
- Text(
- 'hold_phone_to_door'.tr(),
- style: Theme.of(context).textTheme.displayLarge,
- textAlign: TextAlign.center,
- maxLines: 2,
- ),
- const SizedBox(height: 40),
- Lottie.asset(
- 'assets/animations/loading_key.json',
- height: 200,
- width: 200,
- fit: BoxFit.cover,
- animate: true,
- ),
- const SizedBox(height: 150),
- Image.asset(
- 'assets/images/seos_key_logo.png',
- height: 150,
- fit: BoxFit.cover,
- ),
- const SizedBox(height: 40),
- ElevatedButton(
- onPressed: () {
-
- context.read<KeyBloc>().add(RemoveRootOpeningTrigger());
- context.goNamed(AppRoutes.home.name);
- },
- child: const Text('go back'),
- ),
- ],
+ color: Colors.black,
+ child: SafeArea(
+ child: Column(
+ children: [
+ Stack(
+ children: [
+ Center(
+ heightFactor: 2,
+ child: Text(
+ "open_room".tr(),
+ style: Theme.of(context)
+ .textTheme
+ .headlineMedium
+ ?.copyWith(color: Colors.white),
+ ),
+ ),
+ Align(
+ alignment: AlignmentDirectional.centerEnd,
+ child: RoundIconButton(
+ onPressed: () {
+ context.pop();
+ },
+ icon: "assets/icons/close-icon.svg",
+ ),
+ ),
+ ],
+ ),
+ const SizedBox(height: 10),
+ Image.asset(
+ 'assets/images/room_key.png',
+ height: 212,
+ ),
+ const SizedBox(height: 20),
+ Lottie.asset(
+ 'assets/animations/loading_key.json',
+ height: 64,
+ width: 64,
+ fit: BoxFit.cover,
+ animate: true,
+ ),
+ const SizedBox(height: 10),
+ _buildStatusText(state.status, context),
+ const Spacer(),
+ Image.asset(
+ 'assets/images/seos_by_assa_logo.png',
+ height: 42,
+ fit: BoxFit.cover,
+ ),
+ const SizedBox(height: 40),
+ ],
+ ),
),
),
onFocusGained: () {
context.read<KeyBloc>().add(SetRootOpeningTrigger());
},
- onFocusLost: () {
-
- },
+ onFocusLost: () {},
);
} /* else if(state.status == KeyStatus.openClosestReaderSuccess) {
context.pop(); // Go back to the previous page and stop scanning
@@ -85,4 +101,17 @@ class KeyPage extends StatelessWidget {
// },
);
}
+
+ Widget _buildStatusText(KeyStatus status, BuildContext context) {
+ if(status == KeyStatus.scanning) {
+ return Text('hold_phone_to_door'.tr(), style: Theme.of(context).textTheme.headlineMedium?.copyWith(color: Colors.white));
+ } else if(status == KeyStatus.scanningError) {
+ return Text('open_room_error'.tr(), style: Theme.of(context).textTheme.headlineMedium?.copyWith(color: Colors.white));
+ } else if(status == KeyStatus.openClosestReaderSuccess) {
+ return Text('open_room_success'.tr(), style: Theme.of(context).textTheme.headlineMedium?.copyWith(color: Colors.white));
+ } else {
+ return Text('hold_phone_to_door'.tr(), style: Theme.of(context).textTheme.headlineMedium?.copyWith(color: Colors.white));
+ }
+
+ }
}