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,33 +98,33 @@ class RisksFormPageState extends State<RisksFormPage> {
|
|||
// Handle the form submission logic here
|
||||
bool success = await _saveDataToFirebase();
|
||||
if (success) {
|
||||
if (widget.isRegProcess) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
//
|
||||
// TODO set following registration page HERE
|
||||
//
|
||||
builder: (context) => const RegistrationCompletePage(),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
if (widget.isEditMode == true) {
|
||||
// pass selectedOptions data back to caller
|
||||
Navigator.pop(context, {
|
||||
Constants.dbFieldUsersCommunication: communicationPreference,
|
||||
Constants.dbFieldUsersRiskTolerance: riskPreference,
|
||||
});
|
||||
} else {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
}
|
||||
_navigate();
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Failed to save data.'),
|
||||
_showSnackBar('Failed to save data.');
|
||||
}
|
||||
}
|
||||
|
||||
void _navigate() {
|
||||
if (widget.isRegProcess) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
//
|
||||
// TODO set following registration page HERE
|
||||
//
|
||||
builder: (context) => const RegistrationCompletePage(),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
if (widget.isEditMode == true) {
|
||||
// pass selectedOptions data back to caller
|
||||
Navigator.pop(context, {
|
||||
Constants.dbFieldUsersCommunication: communicationPreference,
|
||||
Constants.dbFieldUsersRiskTolerance: riskPreference,
|
||||
});
|
||||
} else {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,21 +42,24 @@ class UserVisionPageState extends State<UserVisionPage> {
|
|||
|
||||
if (snapshot.exists) {
|
||||
final data = snapshot.data();
|
||||
setState(() {
|
||||
// Load Vision options
|
||||
if (data?[Constants.dbFieldUsersVisions] != null) {
|
||||
for (var option in VisionOption.values) {
|
||||
selectedVisionOptions[option] = data?[Constants.dbFieldUsersVisions]
|
||||
.contains(option.toString());
|
||||
setState(
|
||||
() {
|
||||
// Load Vision options
|
||||
if (data?[Constants.dbFieldUsersVisions] != null) {
|
||||
for (var option in VisionOption.values) {
|
||||
selectedVisionOptions[option] =
|
||||
data?[Constants.dbFieldUsersVisions]
|
||||
.contains(option.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
// Load Availability option
|
||||
if (data?[Constants.dbFieldUsersAvailability] != null) {
|
||||
availability = AvailabilityOption.values.firstWhereOrNull(
|
||||
(e) => e.toString() == data?[Constants.dbFieldUsersAvailability],
|
||||
);
|
||||
}
|
||||
});
|
||||
// Load Availability option
|
||||
if (data?[Constants.dbFieldUsersAvailability] != null) {
|
||||
availability = AvailabilityOption.values.firstWhereOrNull(
|
||||
(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,53 +98,49 @@ 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) {
|
||||
if (widget.isRegProcess) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
//
|
||||
// set following registration page HERE
|
||||
//
|
||||
builder: (context) => CultureValuesFormPage(
|
||||
isRegProcess: widget.isRegProcess,
|
||||
isEditMode: false,
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
if (widget.isEditMode == true) {
|
||||
// pass selectedOptions data back to caller
|
||||
Navigator.pop(context, {
|
||||
Constants.dbFieldUsersVisions: selectedVisionOptions.entries
|
||||
.where((entry) => entry.value)
|
||||
.map((entry) => entry.key)
|
||||
.toList(),
|
||||
Constants.dbFieldUsersAvailability: availability,
|
||||
});
|
||||
} else {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
}
|
||||
_navigate();
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Failed to save data.'),
|
||||
_showSnackBar('Failed to save data.');
|
||||
}
|
||||
}
|
||||
|
||||
void _navigate() {
|
||||
if (widget.isRegProcess) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
//
|
||||
// set following registration page HERE
|
||||
//
|
||||
builder: (context) => CultureValuesFormPage(
|
||||
isRegProcess: widget.isRegProcess,
|
||||
isEditMode: false,
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
if (widget.isEditMode == true) {
|
||||
// pass selectedOptions data back to caller
|
||||
Navigator.pop(context, {
|
||||
Constants.dbFieldUsersVisions: selectedVisionOptions.entries
|
||||
.where((entry) => entry.value)
|
||||
.map((entry) => entry.key)
|
||||
.toList(),
|
||||
Constants.dbFieldUsersAvailability: availability,
|
||||
});
|
||||
} else {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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