|
@@ -8,12 +8,16 @@ enum _TimeOfDay {
|
|
|
|
|
|
const _TimeOfDay();
|
|
const _TimeOfDay();
|
|
|
|
|
|
- String greeting(BuildContext context) => switch(this) {
|
|
|
|
- _TimeOfDay.morning => AppLocalizations.of(context)!.homePageUserCardGreetingMorning,
|
|
|
|
- _TimeOfDay.noon => AppLocalizations.of(context)!.homePageUserCardGreetingNoon,
|
|
|
|
- _TimeOfDay.afternoon => AppLocalizations.of(context)!.homePageUserCardGreetingAfternoon,
|
|
|
|
- _TimeOfDay.evening => AppLocalizations.of(context)!.homePageUserCardGreetingEvening,
|
|
|
|
- };
|
|
|
|
|
|
+ String greeting(BuildContext context) => switch (this) {
|
|
|
|
+ _TimeOfDay.morning =>
|
|
|
|
+ AppLocalizations.of(context)!.homePageUserCardGreetingMorning,
|
|
|
|
+ _TimeOfDay.noon =>
|
|
|
|
+ AppLocalizations.of(context)!.homePageUserCardGreetingNoon,
|
|
|
|
+ _TimeOfDay.afternoon =>
|
|
|
|
+ AppLocalizations.of(context)!.homePageUserCardGreetingAfternoon,
|
|
|
|
+ _TimeOfDay.evening =>
|
|
|
|
+ AppLocalizations.of(context)!.homePageUserCardGreetingEvening,
|
|
|
|
+ };
|
|
|
|
|
|
static const _table = [
|
|
static const _table = [
|
|
evening,
|
|
evening,
|
|
@@ -88,7 +92,8 @@ class _UserCard extends StatelessWidget {
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
children: [
|
|
- Text(_TimeOfDay.fromDateTime(DateTime.now()).greeting(context)),
|
|
|
|
|
|
+ Text(_TimeOfDay.fromDateTime(DateTime.now())
|
|
|
|
+ .greeting(context)),
|
|
Text(
|
|
Text(
|
|
user.displayName,
|
|
user.displayName,
|
|
style: const TextStyle(
|
|
style: const TextStyle(
|
|
@@ -103,12 +108,16 @@ class _UserCard extends StatelessWidget {
|
|
IconButton(
|
|
IconButton(
|
|
icon: const Icon(Icons.qr_code_scanner),
|
|
icon: const Icon(Icons.qr_code_scanner),
|
|
onPressed: () async {
|
|
onPressed: () async {
|
|
|
|
+ LOGGER.i("_UserCard: ");
|
|
final qrCodeValue = await context.push<String?>(
|
|
final qrCodeValue = await context.push<String?>(
|
|
RoutePath.scanPage,
|
|
RoutePath.scanPage,
|
|
extra: AppLocalizations.of(context)!.homePageUserCardScanPage,
|
|
extra: AppLocalizations.of(context)!.homePageUserCardScanPage,
|
|
);
|
|
);
|
|
|
|
|
|
- if (qrCodeValue == null) return;
|
|
|
|
|
|
+ if (qrCodeValue == null) {
|
|
|
|
+ LOGGER.w("No QR code.");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
await MaxKey.instance.authnService.scanCode(
|
|
await MaxKey.instance.authnService.scanCode(
|
|
expectedErrorHandler: (msg) {
|
|
expectedErrorHandler: (msg) {
|
|
@@ -118,6 +127,11 @@ class _UserCard extends StatelessWidget {
|
|
},
|
|
},
|
|
code: qrCodeValue,
|
|
code: qrCodeValue,
|
|
);
|
|
);
|
|
|
|
+ if (context.mounted) {
|
|
|
|
+ ScaffoldMessenger.of(context).showSnackBar(
|
|
|
|
+ SnackBar(content: Text(AppLocalizations.of(context)!.homePageUserCardScanSucceed)),
|
|
|
|
+ );
|
|
|
|
+ }
|
|
},
|
|
},
|
|
),
|
|
),
|
|
const SizedBox(width: 8),
|
|
const SizedBox(width: 8),
|