Skip to content

Commit c92719c

Browse files
committed
docs: cleaning up unnecessary memo-style comments from the Dart files within the feature directories in lib/.
1 parent 44fa1e8 commit c92719c

File tree

12 files changed

+52
-84
lines changed

12 files changed

+52
-84
lines changed

lib/account/view/account_page.dart

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_bloc/flutter_bloc.dart';
33
import 'package:go_router/go_router.dart';
4-
// Import the User model and AuthenticationStatus enum
54
import 'package:ht_authentication_client/ht_authentication_client.dart';
65
import 'package:ht_authentication_repository/ht_authentication_repository.dart';
76
import 'package:ht_main/account/bloc/account_bloc.dart';
8-
import 'package:ht_main/app/bloc/app_bloc.dart'; // Needed for AppBloc and AppState access
9-
// Remove direct import of app_state.dart when using part of
10-
import 'package:ht_main/l10n/l10n.dart'; // Added import
11-
import 'package:ht_main/router/routes.dart'; // Needed for route names
7+
import 'package:ht_main/app/bloc/app_bloc.dart';
8+
import 'package:ht_main/l10n/l10n.dart';
9+
import 'package:ht_main/router/routes.dart';
1210

1311
/// {@template account_page}
1412
/// Page widget for the Account feature.
@@ -115,7 +113,7 @@ class _AccountView extends StatelessWidget {
115113
_authenticationStatusToString(
116114
context,
117115
user.authenticationStatus,
118-
), // Pass context
116+
),
119117
style: textTheme.bodyMedium?.copyWith(
120118
color: theme.colorScheme.secondary,
121119
),
@@ -161,8 +159,8 @@ class _AccountView extends StatelessWidget {
161159
final l10n = context.l10n;
162160
return ListTile(
163161
leading: const Icon(Icons.link), // Icon suggesting connection/linking
164-
title: Text(l10n.accountConnectPrompt), // New l10n key needed
165-
subtitle: Text(l10n.accountConnectBenefit), // New l10n key needed
162+
title: Text(l10n.accountConnectPrompt),
163+
subtitle: Text(l10n.accountConnectBenefit),
166164
isThreeLine: true, // Allow more space for subtitle
167165
trailing: const Icon(Icons.chevron_right),
168166
onTap: () {

lib/app/view/app.dart

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33

44
import 'dart:async';
55
import 'package:firebase_dynamic_links/firebase_dynamic_links.dart'; // For dynamic links
6-
// Removed: import 'package:flex_color_scheme/flex_color_scheme.dart';
76
import 'package:flutter/material.dart';
87
import 'package:flutter_bloc/flutter_bloc.dart';
98
import 'package:go_router/go_router.dart';
10-
// Removed: import 'package:google_fonts/google_fonts.dart';
119
import 'package:ht_authentication_repository/ht_authentication_repository.dart';
1210
import 'package:ht_headlines_repository/ht_headlines_repository.dart';
1311
import 'package:ht_kv_storage_service/ht_kv_storage_service.dart'; // Import storage service
@@ -71,21 +69,15 @@ class _AppView extends StatefulWidget {
7169
}
7270

7371
class _AppViewState extends State<_AppView> {
74-
// Store the router and the status notifier
7572
late final GoRouter _router;
7673
late final ValueNotifier<AppStatus> _statusNotifier;
7774
StreamSubscription<PendingDynamicLinkData>? _linkSubscription;
7875

7976
@override
8077
void initState() {
8178
super.initState();
82-
// Get the AppBloc instance from the BlocProvider above
8379
final appBloc = context.read<AppBloc>();
84-
85-
// Create the ValueNotifier, initialized with the current status
8680
_statusNotifier = ValueNotifier<AppStatus>(appBloc.state.status);
87-
88-
// Create the router instance, passing the ValueNotifier as the listenable
8981
_router = createRouter(authStatusNotifier: _statusNotifier);
9082

9183
// --- Initialize Deep Link Handling ---
@@ -105,11 +97,9 @@ class _AppViewState extends State<_AppView> {
10597
// Handle links received while the app is running
10698
_linkSubscription = FirebaseDynamicLinks.instance.onLink.listen(
10799
(pendingDynamicLinkData) {
108-
// Handle link data
109100
_handleDynamicLink(pendingDynamicLinkData.link);
110101
},
111102
onError: (Object error) {
112-
// Handle errors (e.g., log them)
113103
debugPrint('Dynamic Link Listener Error: $error');
114104
},
115105
);
@@ -122,7 +112,6 @@ class _AppViewState extends State<_AppView> {
122112
}
123113
} catch (e) {
124114
debugPrint('Error getting initial dynamic link: $e');
125-
// Handle potential errors during initial link retrieval
126115
}
127116
}
128117

@@ -136,14 +125,14 @@ class _AppViewState extends State<_AppView> {
136125
final authBloc = context.read<AuthenticationBloc>();
137126
final linkString = deepLink.toString();
138127

139-
debugPrint('Handling dynamic link: $linkString'); // Log received link
128+
debugPrint('Handling dynamic link: $linkString');
140129

141130
try {
142131
// The async gap happens here
143132
final isSignInLink = await authRepo.isSignInWithEmailLink(
144133
emailLink: linkString,
145134
);
146-
debugPrint('Is sign-in link: $isSignInLink'); // Log validation result
135+
debugPrint('Is sign-in link: $isSignInLink');
147136

148137
// Check mounted again *after* the await before using BLoC/state
149138
if (!mounted) return;
@@ -153,9 +142,7 @@ class _AppViewState extends State<_AppView> {
153142
authBloc.add(
154143
AuthenticationSignInWithLinkAttempted(emailLink: linkString),
155144
);
156-
debugPrint(
157-
'Dispatched AuthenticationSignInWithLinkAttempted',
158-
); // Log dispatch
145+
debugPrint('Dispatched AuthenticationSignInWithLinkAttempted');
159146
} else {
160147
// Handle other types of deep links if necessary
161148
debugPrint(

lib/authentication/bloc/authentication_bloc.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class AuthenticationBloc
1919
/// {@macro authentication_bloc}
2020
AuthenticationBloc({
2121
required HtAuthenticationRepository authenticationRepository,
22-
// Remove kvStorageService from constructor
2322
}) : _authenticationRepository = authenticationRepository,
2423
super(AuthenticationInitial()) {
2524
on<AuthenticationSendSignInLinkRequested>(
@@ -70,7 +69,7 @@ class AuthenticationBloc
7069
/// Handles [AuthenticationSignInWithLinkAttempted] events.
7170
/// This assumes the event is dispatched after the app receives the deep link.
7271
Future<void> _onAuthenticationSignInWithLinkAttempted(
73-
AuthenticationSignInWithLinkAttempted event, // Event no longer has email
72+
AuthenticationSignInWithLinkAttempted event,
7473
Emitter<AuthenticationState> emit,
7574
) async {
7675
emit(AuthenticationLoading()); // General loading for sign-in attempt

lib/authentication/bloc/authentication_event.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,14 @@ final class AuthenticationSendSignInLinkRequested extends AuthenticationEvent {
3333
final class AuthenticationSignInWithLinkAttempted extends AuthenticationEvent {
3434
/// {@macro authentication_sign_in_with_link_attempted}
3535
const AuthenticationSignInWithLinkAttempted({
36-
// Remove email parameter
3736
required this.emailLink,
3837
});
3938

40-
// Remove email field
41-
4239
/// The sign-in link received by the app.
4340
final String emailLink;
4441

4542
@override
46-
List<Object> get props => [emailLink]; // Remove email from props
43+
List<Object> get props => [emailLink];
4744
}
4845

4946
/// {@template authentication_google_sign_in_requested}

lib/authentication/view/authentication_page.dart

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'package:ht_authentication_repository/ht_authentication_repository.dart';
77
import 'package:ht_main/authentication/bloc/authentication_bloc.dart';
88
import 'package:ht_main/l10n/l10n.dart';
99
import 'package:ht_main/router/routes.dart';
10-
import 'package:ht_main/shared/constants/app_spacing.dart'; // Use shared constants
10+
import 'package:ht_main/shared/constants/app_spacing.dart';
1111

1212
/// {@template authentication_page}
1313
/// Displays authentication options (Google, Email, Anonymous) based on context.
@@ -21,8 +21,7 @@ class AuthenticationPage extends StatelessWidget {
2121
required this.headline,
2222
required this.subHeadline,
2323
required this.showAnonymousButton,
24-
required this.isLinkingContext, // Add this parameter
25-
// this.iconData, // REMOVE optional icon data
24+
required this.isLinkingContext,
2625
super.key,
2726
});
2827

@@ -36,10 +35,7 @@ class AuthenticationPage extends StatelessWidget {
3635
final bool showAnonymousButton;
3736

3837
/// Whether this page is being shown in the account linking context.
39-
final bool isLinkingContext; // Add this field
40-
41-
/// Optional icon to display at the top of the page.
42-
// final IconData? iconData; // REMOVE this field
38+
final bool isLinkingContext;
4339

4440
@override
4541
Widget build(BuildContext context) {
@@ -57,28 +53,24 @@ class AuthenticationPage extends StatelessWidget {
5753
headline: headline,
5854
subHeadline: subHeadline,
5955
showAnonymousButton: showAnonymousButton,
60-
isLinkingContext: isLinkingContext, // Pass down the flag
61-
// iconData: iconData, // REMOVE passing down icon data
56+
isLinkingContext: isLinkingContext,
6257
),
6358
);
6459
}
6560
}
6661

67-
// Renamed from _AuthenticationView to follow convention
6862
class _AuthenticationView extends StatelessWidget {
6963
const _AuthenticationView({
7064
required this.headline,
7165
required this.subHeadline,
7266
required this.showAnonymousButton,
73-
required this.isLinkingContext, // Add this parameter
74-
// this.iconData, // REMOVE optional icon data
67+
required this.isLinkingContext,
7568
});
7669

7770
final String headline;
7871
final String subHeadline;
7972
final bool showAnonymousButton;
80-
final bool isLinkingContext; // Add this field
81-
// final IconData? iconData; // REMOVE this field
73+
final bool isLinkingContext;
8274

8375
@override
8476
Widget build(BuildContext context) {
@@ -130,7 +122,7 @@ class _AuthenticationView extends StatelessWidget {
130122
return Padding(
131123
padding: const EdgeInsets.all(
132124
AppSpacing.paddingLarge,
133-
), // Use constant
125+
),
134126
child: Center(
135127
child: SingleChildScrollView(
136128
child: Column(
@@ -139,35 +131,33 @@ class _AuthenticationView extends StatelessWidget {
139131
crossAxisAlignment: CrossAxisAlignment.stretch,
140132
children: [
141133
// --- Hardcoded Icon ---
142-
// REMOVE if check: if (iconData != null) ...[
143134
Padding(
144135
padding: const EdgeInsets.only(
145136
bottom: AppSpacing.xl,
146137
), // Spacing below icon
147138
child: Icon(
148139
Icons.security, // Hardcode the icon
149140
size: (Theme.of(context).iconTheme.size ?? AppSpacing.xl) *
150-
3.0, // Use ?? with AppSpacing constant
141+
3.0,
151142
color: Theme.of(context)
152143
.colorScheme
153-
.primary, // Use theme color
144+
.primary,
154145
),
155146
),
156147
const SizedBox(height: AppSpacing.lg), // Space between icon and headline
157-
// REMOVE closing bracket for if: ],
158148
// --- Headline and Subheadline ---
159149
Text(
160150
headline,
161151
style: textTheme.headlineMedium,
162152
textAlign: TextAlign.center,
163153
),
164-
const SizedBox(height: AppSpacing.sm), // Use constant
154+
const SizedBox(height: AppSpacing.sm),
165155
Text(
166156
subHeadline,
167157
style: textTheme.bodyLarge,
168158
textAlign: TextAlign.center,
169159
),
170-
const SizedBox(height: AppSpacing.xxl), // Use constant
160+
const SizedBox(height: AppSpacing.xxl),
171161
// --- Google Sign-In Button ---
172162
ElevatedButton.icon(
173163
icon: const Icon(
@@ -182,14 +172,14 @@ class _AuthenticationView extends StatelessWidget {
182172
),
183173
// Style adjustments can be made via ElevatedButtonThemeData
184174
),
185-
const SizedBox(height: AppSpacing.lg), // Use constant
175+
const SizedBox(height: AppSpacing.lg),
186176
// --- Email Sign-In Button ---
187177
ElevatedButton(
188178
// Consider an email icon
189179
// icon: const Icon(Icons.email_outlined),
190180
child: Text(
191181
l10n.authenticationEmailSignInButton,
192-
), // New l10n key needed
182+
),
193183
onPressed:
194184
isLoading
195185
? null
@@ -198,14 +188,14 @@ class _AuthenticationView extends StatelessWidget {
198188
// passing the linking context via 'extra'.
199189
context.goNamed(
200190
Routes.emailSignInName,
201-
extra: isLinkingContext, // Pass the flag
191+
extra: isLinkingContext,
202192
);
203193
},
204194
),
205195

206196
// --- Anonymous Sign-In Button (Conditional) ---
207197
if (showAnonymousButton) ...[
208-
const SizedBox(height: AppSpacing.lg), // Use constant
198+
const SizedBox(height: AppSpacing.lg),
209199
OutlinedButton(
210200
child: Text(l10n.authenticationAnonymousSignInButton),
211201
onPressed:

lib/authentication/view/email_sign_in_page.dart

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class _EmailSignInView extends StatelessWidget {
4242

4343
return Scaffold(
4444
appBar: AppBar(
45-
title: Text(l10n.emailSignInPageTitle), // New l10n key needed
45+
title: Text(l10n.emailSignInPageTitle),
4646
// Add a custom leading back button to control navigation based on context.
4747
leading: IconButton(
4848
icon: const Icon(Icons.arrow_back),
@@ -107,20 +107,22 @@ class _EmailSignInView extends StatelessWidget {
107107
), // Spacing below icon
108108
child: Icon(
109109
Icons.email_outlined, // Hardcoded icon
110-
size: (Theme.of(context).iconTheme.size ?? AppSpacing.xl) *
111-
3.0, // Use ?? with AppSpacing constant
110+
size:
111+
(Theme.of(context).iconTheme.size ??
112+
AppSpacing.xl) *
113+
3.0,
112114
color:
113115
Theme.of(
114116
context,
115-
).colorScheme.primary, // Use theme color
117+
).colorScheme.primary,
116118
),
117119
),
118120
const SizedBox(
119121
height: AppSpacing.lg,
120122
), // Space between icon and text
121123
// --- Explanation Text ---
122124
Text(
123-
l10n.emailSignInExplanation, // New l10n key needed
125+
l10n.emailSignInExplanation,
124126
style: Theme.of(context).textTheme.bodyLarge,
125127
textAlign: TextAlign.center,
126128
),
@@ -181,7 +183,7 @@ class _EmailLinkFormState extends State<_EmailLinkForm> {
181183
TextFormField(
182184
controller: _emailController,
183185
decoration: InputDecoration(
184-
labelText: l10n.authenticationEmailLabel, // Re-use existing key
186+
labelText: l10n.authenticationEmailLabel,
185187
border: const OutlineInputBorder(),
186188
// Consider adding hint text if needed
187189
),
@@ -191,9 +193,8 @@ class _EmailLinkFormState extends State<_EmailLinkForm> {
191193
enabled: !widget.isLoading,
192194
validator: (value) {
193195
if (value == null || value.isEmpty || !value.contains('@')) {
194-
// Add a specific validation error message key if needed
195196
return l10n
196-
.accountLinkingEmailValidationError; // Re-use for now
197+
.accountLinkingEmailValidationError;
197198
}
198199
return null;
199200
},
@@ -206,13 +207,13 @@ class _EmailLinkFormState extends State<_EmailLinkForm> {
206207
child:
207208
widget.isLoading
208209
? const SizedBox(
209-
height: 24, // Consistent height
210+
height: 24,
210211
width: 24,
211212
child: CircularProgressIndicator(strokeWidth: 2),
212213
)
213214
: Text(
214215
l10n.authenticationSendLinkButton,
215-
), // Re-use existing key
216+
),
216217
),
217218
],
218219
),

0 commit comments

Comments
 (0)