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 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,11 @@
|
|||||||
"permissions": {
|
"permissions": {
|
||||||
"allow": [
|
"allow": [
|
||||||
"Bash(code .:*)",
|
"Bash(code .:*)",
|
||||||
"Bash(git add:*)"
|
"Bash(git add:*)",
|
||||||
|
"Bash(git commit:*)",
|
||||||
|
"Bash(flutter analyze:*)",
|
||||||
|
"Bash(flutter format:*)",
|
||||||
|
"Bash(dart format:*)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ final _router = GoRouter(
|
|||||||
final authState = Provider.of<AuthState>(context, listen: false);
|
final authState = Provider.of<AuthState>(context, listen: false);
|
||||||
final bool loggedIn = authState.isLoggedIn;
|
final bool loggedIn = authState.isLoggedIn;
|
||||||
final bool loggingIn =
|
final bool loggingIn =
|
||||||
state.matchedLocation == '/login' || state.matchedLocation == '/sms_verify';
|
state.matchedLocation == '/login' ||
|
||||||
|
state.matchedLocation == '/sms_verify';
|
||||||
|
|
||||||
if (!loggedIn && !loggingIn) {
|
if (!loggedIn && !loggingIn) {
|
||||||
return '/login';
|
return '/login';
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ class PhoneInputScreen extends StatefulWidget {
|
|||||||
|
|
||||||
class _PhoneInputScreenState extends State<PhoneInputScreen> {
|
class _PhoneInputScreenState extends State<PhoneInputScreen> {
|
||||||
final TextEditingController _phoneController = TextEditingController();
|
final TextEditingController _phoneController = TextEditingController();
|
||||||
String? _selectedCountry;
|
|
||||||
String? _formattedPhone;
|
String? _formattedPhone;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -42,9 +41,6 @@ class _PhoneInputScreenState extends State<PhoneInputScreen> {
|
|||||||
onChanged: (phone) {
|
onChanged: (phone) {
|
||||||
_formattedPhone = phone.completeNumber;
|
_formattedPhone = phone.completeNumber;
|
||||||
},
|
},
|
||||||
onCountryChanged: (country) {
|
|
||||||
_selectedCountry = country.isoCode;
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
authState.isLoading
|
authState.isLoading
|
||||||
@@ -53,12 +49,16 @@ class _PhoneInputScreenState extends State<PhoneInputScreen> {
|
|||||||
onPressed: _formattedPhone != null
|
onPressed: _formattedPhone != null
|
||||||
? () async {
|
? () async {
|
||||||
if (_formattedPhone != null) {
|
if (_formattedPhone != null) {
|
||||||
await authState.signInWithPhoneNumber(_formattedPhone!);
|
await authState.signInWithPhoneNumber(
|
||||||
|
_formattedPhone!,
|
||||||
|
);
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
|
|
||||||
if (authState.errorMessage != null) {
|
if (authState.errorMessage != null) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(authState.errorMessage!)),
|
SnackBar(
|
||||||
|
content: Text(authState.errorMessage!),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
context.go('/sms_verify');
|
context.go('/sms_verify');
|
||||||
|
|||||||
@@ -78,12 +78,17 @@ class _SmsVerificationScreenState extends State<SmsVerificationScreen> {
|
|||||||
? () async {
|
? () async {
|
||||||
// In a real app, we'd have the verificationId from the previous step
|
// In a real app, we'd have the verificationId from the previous step
|
||||||
if (_verificationId != null) {
|
if (_verificationId != null) {
|
||||||
await authState.verifyOTP(_verificationId!, _pinController.text);
|
await authState.verifyOTP(
|
||||||
|
_verificationId!,
|
||||||
|
_pinController.text,
|
||||||
|
);
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
|
|
||||||
if (authState.errorMessage != null) {
|
if (authState.errorMessage != null) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(authState.errorMessage!)),
|
SnackBar(
|
||||||
|
content: Text(authState.errorMessage!),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
context.go('/');
|
context.go('/');
|
||||||
|
|||||||
@@ -52,7 +52,9 @@ class _LoggedInView extends StatelessWidget {
|
|||||||
child: ListTile(
|
child: ListTile(
|
||||||
leading: const Icon(Icons.person),
|
leading: const Icon(Icons.person),
|
||||||
title: Text(authState.currentUser!.displayName ?? 'User'),
|
title: Text(authState.currentUser!.displayName ?? 'User'),
|
||||||
subtitle: Text(authState.currentUser!.phoneNumber ?? 'No phone number'),
|
subtitle: Text(
|
||||||
|
authState.currentUser!.phoneNumber ?? 'No phone number',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
|
|||||||
@@ -27,9 +27,18 @@ class ProfileScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
_buildProfileItem('Name', authState.currentUser!.displayName ?? 'Not set'),
|
_buildProfileItem(
|
||||||
_buildProfileItem('Phone', authState.currentUser!.phoneNumber ?? 'Not set'),
|
'Name',
|
||||||
_buildProfileItem('Email', authState.currentUser!.email ?? 'Not set'),
|
authState.currentUser!.displayName ?? 'Not set',
|
||||||
|
),
|
||||||
|
_buildProfileItem(
|
||||||
|
'Phone',
|
||||||
|
authState.currentUser!.phoneNumber ?? 'Not set',
|
||||||
|
),
|
||||||
|
_buildProfileItem(
|
||||||
|
'Email',
|
||||||
|
authState.currentUser!.email ?? 'Not set',
|
||||||
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Center(
|
Center(
|
||||||
child: authState.isLoading
|
child: authState.isLoading
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
|
|
||||||
class UserModel {
|
class UserModel {
|
||||||
final String uid;
|
final String uid;
|
||||||
final String? displayName;
|
final String? displayName;
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ class LoadingIndicator extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Center(
|
return const Center(child: CircularProgressIndicator());
|
||||||
child: CircularProgressIndicator(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user