dart analyze warnings fixed
parent
6d776874c7
commit
a4aa0ed18f
|
@ -171,7 +171,7 @@ class LocationSelectorState extends State<LocationSelector> {
|
|||
'Location permissions are permanently denied, we cannot request permissions.');
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error getting location permission: $e');
|
||||
debugPrint('Error getting location permission: $e');
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -194,7 +194,7 @@ class LocationSelectorState extends State<LocationSelector> {
|
|||
triggerCallback();
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error getting current location: $e');
|
||||
debugPrint('Error getting current location: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ class CultureValuesFormPageState extends State<CultureValuesFormPage> {
|
|||
}
|
||||
// Handle the form submission logic here
|
||||
bool success = await _saveDataToFirebase();
|
||||
if (success) {
|
||||
if (success && mounted) {
|
||||
if (widget.isRegProcess) {
|
||||
Navigator.push(
|
||||
context,
|
||||
|
|
|
@ -77,9 +77,9 @@ class RisksFormPageState extends State<RisksFormPage> {
|
|||
}
|
||||
|
||||
void _showSnackBar(String message) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content: Text(message),
|
||||
));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(message)),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> handleSubmit() async {
|
||||
|
@ -98,6 +98,13 @@ class RisksFormPageState extends State<RisksFormPage> {
|
|||
// Handle the form submission logic here
|
||||
bool success = await _saveDataToFirebase();
|
||||
if (success) {
|
||||
_navigate();
|
||||
} else {
|
||||
_showSnackBar('Failed to save data.');
|
||||
}
|
||||
}
|
||||
|
||||
void _navigate() {
|
||||
if (widget.isRegProcess) {
|
||||
Navigator.push(
|
||||
context,
|
||||
|
@ -119,13 +126,6 @@ class RisksFormPageState extends State<RisksFormPage> {
|
|||
Navigator.pop(context);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Failed to save data.'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -66,7 +66,7 @@ class EditProfilePageState extends State<EditProfilePage> {
|
|||
title: 'Cropper',
|
||||
minimumAspectRatio: 1.0,
|
||||
),
|
||||
if (kIsWeb)
|
||||
if (kIsWeb && mounted)
|
||||
WebUiSettings(
|
||||
context: context,
|
||||
presentStyle: CropperPresentStyle.page,
|
||||
|
@ -227,7 +227,7 @@ class EditProfilePageState extends State<EditProfilePage> {
|
|||
child: Stack(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 50,
|
||||
radius: 80,
|
||||
backgroundImage: _profileImage != null
|
||||
? FileImage(_profileImage!)
|
||||
: (_webProfileImage != null
|
||||
|
@ -240,7 +240,7 @@ class EditProfilePageState extends State<EditProfilePage> {
|
|||
child: _profileImage == null &&
|
||||
_webProfileImage == null &&
|
||||
widget.userData.profilePictureUrl == null
|
||||
? const Icon(Icons.person, size: 50)
|
||||
? const Icon(Icons.person, size: 80)
|
||||
: null,
|
||||
),
|
||||
),
|
||||
|
@ -253,7 +253,7 @@ class EditProfilePageState extends State<EditProfilePage> {
|
|||
color: Theme.of(context).colorScheme.primary,
|
||||
shape: const CircleBorder(),
|
||||
),
|
||||
child: const Icon(Icons.edit),
|
||||
child: const Icon(Icons.camera_alt),
|
||||
),
|
||||
onPressed: _pickImage,
|
||||
),
|
||||
|
|
|
@ -17,10 +17,8 @@ class HomePage extends StatelessWidget {
|
|||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Home'),
|
||||
// TODO appbar style: remove background and set elevation to 0 ?
|
||||
// different appbar style for homepage
|
||||
backgroundColor: Colors.transparent,
|
||||
foregroundColor: Colors.grey.shade800,
|
||||
elevation: 0,
|
||||
),
|
||||
drawer: const MyDrawer(),
|
||||
body: _buildUserList(),
|
||||
|
|
|
@ -608,13 +608,13 @@ class _UserProfilePageState extends State<UserProfilePage> {
|
|||
),
|
||||
),
|
||||
CircleAvatar(
|
||||
radius: 50,
|
||||
radius: 80,
|
||||
backgroundImage:
|
||||
((profileImageUrl != null && profileImageUrl!.isNotEmpty))
|
||||
? NetworkImage(profileImageUrl!)
|
||||
: null,
|
||||
child: (profileImageUrl == null || profileImageUrl!.isEmpty)
|
||||
? const Icon(Icons.person, size: 50)
|
||||
? const Icon(Icons.person, size: 80)
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
|
|
@ -26,7 +26,6 @@ class UserVisionPageState extends State<UserVisionPage> {
|
|||
};
|
||||
AvailabilityOption? availability;
|
||||
|
||||
// get instance of auth
|
||||
final AuthService _authService = AuthService();
|
||||
|
||||
@override
|
||||
|
@ -43,11 +42,13 @@ class UserVisionPageState extends State<UserVisionPage> {
|
|||
|
||||
if (snapshot.exists) {
|
||||
final data = snapshot.data();
|
||||
setState(() {
|
||||
setState(
|
||||
() {
|
||||
// Load Vision options
|
||||
if (data?[Constants.dbFieldUsersVisions] != null) {
|
||||
for (var option in VisionOption.values) {
|
||||
selectedVisionOptions[option] = data?[Constants.dbFieldUsersVisions]
|
||||
selectedVisionOptions[option] =
|
||||
data?[Constants.dbFieldUsersVisions]
|
||||
.contains(option.toString());
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +58,8 @@ class UserVisionPageState extends State<UserVisionPage> {
|
|||
(e) => e.toString() == data?[Constants.dbFieldUsersAvailability],
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,9 +87,9 @@ class UserVisionPageState extends State<UserVisionPage> {
|
|||
}
|
||||
|
||||
void _showSnackBar(String message) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content: Text(message),
|
||||
));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(message)),
|
||||
);
|
||||
}
|
||||
|
||||
bool isVisionSelected() {
|
||||
|
@ -96,20 +98,23 @@ class UserVisionPageState extends State<UserVisionPage> {
|
|||
|
||||
Future<void> handleSubmit() async {
|
||||
if (!isVisionSelected()) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||
content: Text('Please select at least one long-term vision.'),
|
||||
));
|
||||
_showSnackBar('Please select at least one long-term vision.');
|
||||
return;
|
||||
}
|
||||
if (availability == null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||
content: Text('Please select an availability option.'),
|
||||
));
|
||||
_showSnackBar('Please select an availability option.');
|
||||
return;
|
||||
}
|
||||
// Handle the form submission logic here
|
||||
bool success = await _saveDataToFirebase();
|
||||
if (success) {
|
||||
_navigate();
|
||||
} else {
|
||||
_showSnackBar('Failed to save data.');
|
||||
}
|
||||
}
|
||||
|
||||
void _navigate() {
|
||||
if (widget.isRegProcess) {
|
||||
Navigator.push(
|
||||
context,
|
||||
|
@ -137,13 +142,6 @@ class UserVisionPageState extends State<UserVisionPage> {
|
|||
Navigator.pop(context);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Failed to save data.'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -93,7 +93,7 @@ class AuthGate extends StatelessWidget {
|
|||
Constants.dbFieldUsersEmail: email,
|
||||
});
|
||||
} catch (e) {
|
||||
print("Error creating user document: $e");
|
||||
debugPrint("Error creating user document: $e");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ class AuthGate extends StatelessWidget {
|
|||
await _checkUsersCollectionExists(Constants.dbCollectionLocations);
|
||||
return languagesExist && locationsExist;
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
debugPrint(e.toString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ class AuthGate extends StatelessWidget {
|
|||
final snapshot = await collection.limit(1).get();
|
||||
return snapshot.docs.isNotEmpty;
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
debugPrint(e.toString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue