Skip to content

Commit 0842fbc

Browse files
committed
feat(authentication): display demo email hint in demo env
This change updates the request code page to conditionally display a hint for the demo email address (`[email protected]`) when the application is running in the demo environment. A `BlocSelector` is used to check the current environment from the `AppBloc`, ensuring the hint is only shown when appropriate, guiding users during demonstrations.
1 parent d221b6c commit 0842fbc

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

lib/authentication/view/request_code_page.dart

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
import 'package:flutter/material.dart';
55
import 'package:flutter_bloc/flutter_bloc.dart';
6+
import 'package:ht_dashboard/app/bloc/app_bloc.dart';
7+
import 'package:ht_dashboard/app/config/config.dart';
68
import 'package:go_router/go_router.dart';
79
import 'package:ht_dashboard/authentication/bloc/authentication_bloc.dart';
810
import 'package:ht_dashboard/l10n/l10n.dart';
@@ -129,6 +131,26 @@ class _RequestCodeView extends StatelessWidget {
129131
),
130132
textAlign: TextAlign.center,
131133
),
134+
// Display demo email if in demo environment
135+
BlocSelector<AppBloc, AppState, AppEnvironment?>(
136+
selector: (state) => state.environment,
137+
builder: (context, environment) {
138+
if (environment == AppEnvironment.demo) {
139+
return Padding(
140+
padding: const EdgeInsets.only(top: AppSpacing.lg),
141+
child: Text(
142+
'For demo, use email: [email protected]',
143+
style: textTheme.bodyMedium?.copyWith(
144+
color: colorScheme.secondary,
145+
fontWeight: FontWeight.bold,
146+
),
147+
textAlign: TextAlign.center,
148+
),
149+
);
150+
}
151+
return const SizedBox.shrink();
152+
},
153+
),
132154
const SizedBox(height: AppSpacing.xxl),
133155
_EmailLinkForm(isLoading: isLoading),
134156
],

0 commit comments

Comments
 (0)