From 465cbf3fa5fd62e67dbf24ce2b6999fb139f1a85 Mon Sep 17 00:00:00 2001 From: soragui Date: Thu, 26 Feb 2026 06:40:52 +0800 Subject: [PATCH] fix: resolve Dart analysis errors and format code - Fixed unused field warning in phone_input_screen.dart - Resolved undefined getter 'isoCode' by removing unused code - Fixed undefined class 'User' error by adding proper Firebase import in user_model.dart - Ran dart format to ensure consistent code style across all files - All analyzer issues are now resolved Co-Authored-By: Claude Opus 4.6 --- .claude/settings.local.json | 6 +++++- lib/app.dart | 3 ++- lib/auth/phone_input_screen.dart | 12 ++++++------ lib/auth/sms_verification_screen.dart | 9 +++++++-- lib/home/home_screen.dart | 4 +++- lib/profile/profile_screen.dart | 15 ++++++++++++--- lib/services/auth_service.dart | 2 +- lib/shared/models/user_model.dart | 4 +++- lib/shared/widgets/loading_indicator.dart | 6 ++---- lib/theme/app_theme.dart | 2 +- 10 files changed, 42 insertions(+), 21 deletions(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index b6c4afc..e091fc5 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -2,7 +2,11 @@ "permissions": { "allow": [ "Bash(code .:*)", - "Bash(git add:*)" + "Bash(git add:*)", + "Bash(git commit:*)", + "Bash(flutter analyze:*)", + "Bash(flutter format:*)", + "Bash(dart format:*)" ] } } diff --git a/lib/app.dart b/lib/app.dart index 70fa812..6a91f81 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -29,7 +29,8 @@ final _router = GoRouter( final authState = Provider.of(context, listen: false); final bool loggedIn = authState.isLoggedIn; final bool loggingIn = - state.matchedLocation == '/login' || state.matchedLocation == '/sms_verify'; + state.matchedLocation == '/login' || + state.matchedLocation == '/sms_verify'; if (!loggedIn && !loggingIn) { return '/login'; diff --git a/lib/auth/phone_input_screen.dart b/lib/auth/phone_input_screen.dart index 9d3d400..fc1a144 100644 --- a/lib/auth/phone_input_screen.dart +++ b/lib/auth/phone_input_screen.dart @@ -13,7 +13,6 @@ class PhoneInputScreen extends StatefulWidget { class _PhoneInputScreenState extends State { final TextEditingController _phoneController = TextEditingController(); - String? _selectedCountry; String? _formattedPhone; @override @@ -42,9 +41,6 @@ class _PhoneInputScreenState extends State { onChanged: (phone) { _formattedPhone = phone.completeNumber; }, - onCountryChanged: (country) { - _selectedCountry = country.isoCode; - }, ), const SizedBox(height: 20), authState.isLoading @@ -53,12 +49,16 @@ class _PhoneInputScreenState extends State { onPressed: _formattedPhone != null ? () async { if (_formattedPhone != null) { - await authState.signInWithPhoneNumber(_formattedPhone!); + await authState.signInWithPhoneNumber( + _formattedPhone!, + ); if (!context.mounted) return; if (authState.errorMessage != null) { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(authState.errorMessage!)), + SnackBar( + content: Text(authState.errorMessage!), + ), ); } else { context.go('/sms_verify'); diff --git a/lib/auth/sms_verification_screen.dart b/lib/auth/sms_verification_screen.dart index cb5f073..05a9f1a 100644 --- a/lib/auth/sms_verification_screen.dart +++ b/lib/auth/sms_verification_screen.dart @@ -78,12 +78,17 @@ class _SmsVerificationScreenState extends State { ? () async { // In a real app, we'd have the verificationId from the previous step if (_verificationId != null) { - await authState.verifyOTP(_verificationId!, _pinController.text); + await authState.verifyOTP( + _verificationId!, + _pinController.text, + ); if (!context.mounted) return; if (authState.errorMessage != null) { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(authState.errorMessage!)), + SnackBar( + content: Text(authState.errorMessage!), + ), ); } else { context.go('/'); diff --git a/lib/home/home_screen.dart b/lib/home/home_screen.dart index 7dd18cc..fe971b3 100644 --- a/lib/home/home_screen.dart +++ b/lib/home/home_screen.dart @@ -52,7 +52,9 @@ class _LoggedInView extends StatelessWidget { child: ListTile( leading: const Icon(Icons.person), title: Text(authState.currentUser!.displayName ?? 'User'), - subtitle: Text(authState.currentUser!.phoneNumber ?? 'No phone number'), + subtitle: Text( + authState.currentUser!.phoneNumber ?? 'No phone number', + ), ), ), const Divider(), diff --git a/lib/profile/profile_screen.dart b/lib/profile/profile_screen.dart index 7d75109..7b63fde 100644 --- a/lib/profile/profile_screen.dart +++ b/lib/profile/profile_screen.dart @@ -27,9 +27,18 @@ class ProfileScreen extends StatelessWidget { ), ), const SizedBox(height: 16), - _buildProfileItem('Name', authState.currentUser!.displayName ?? 'Not set'), - _buildProfileItem('Phone', authState.currentUser!.phoneNumber ?? 'Not set'), - _buildProfileItem('Email', authState.currentUser!.email ?? 'Not set'), + _buildProfileItem( + 'Name', + authState.currentUser!.displayName ?? 'Not set', + ), + _buildProfileItem( + 'Phone', + authState.currentUser!.phoneNumber ?? 'Not set', + ), + _buildProfileItem( + 'Email', + authState.currentUser!.email ?? 'Not set', + ), const Spacer(), Center( child: authState.isLoading diff --git a/lib/services/auth_service.dart b/lib/services/auth_service.dart index e23735f..33ace33 100644 --- a/lib/services/auth_service.dart +++ b/lib/services/auth_service.dart @@ -44,4 +44,4 @@ class FirebaseAuthService implements AuthService { Future signOut() async { await _firebaseAuth.signOut(); } -} \ No newline at end of file +} diff --git a/lib/shared/models/user_model.dart b/lib/shared/models/user_model.dart index 9b4b5c7..5ec9db1 100644 --- a/lib/shared/models/user_model.dart +++ b/lib/shared/models/user_model.dart @@ -1,3 +1,5 @@ +import 'package:firebase_auth/firebase_auth.dart'; + class UserModel { final String uid; final String? displayName; @@ -27,4 +29,4 @@ class UserModel { String toString() { return 'UserModel(uid: $uid, displayName: $displayName, phoneNumber: $phoneNumber, email: $email, photoURL: $photoURL)'; } -} \ No newline at end of file +} diff --git a/lib/shared/widgets/loading_indicator.dart b/lib/shared/widgets/loading_indicator.dart index 88c393f..bd6d671 100644 --- a/lib/shared/widgets/loading_indicator.dart +++ b/lib/shared/widgets/loading_indicator.dart @@ -5,8 +5,6 @@ class LoadingIndicator extends StatelessWidget { @override Widget build(BuildContext context) { - return const Center( - child: CircularProgressIndicator(), - ); + return const Center(child: CircularProgressIndicator()); } -} \ No newline at end of file +} diff --git a/lib/theme/app_theme.dart b/lib/theme/app_theme.dart index 626b74d..2edd28d 100644 --- a/lib/theme/app_theme.dart +++ b/lib/theme/app_theme.dart @@ -16,4 +16,4 @@ class AppTheme { brightness: Brightness.dark, ), ); -} \ No newline at end of file +}