feat(profile): Replaced the diet and calendar icons, reduced the height of the bottom nav bar, added the first version of the measurements graph, added the time of the chat message and changed the design slightly

This commit is contained in:
mso7nueh
2024-08-27 16:59:37 +03:00
parent ec19861eb2
commit 7e919d8f4c
18 changed files with 1102 additions and 138 deletions

View File

@@ -15,4 +15,11 @@ abstract class ProfileService {
@GET('/api/profile/index')
Future<ProfileModel> getMyProfile();
@POST('/api/profile/addCircumference')
Future<Map<String, Circumference>> addCircumference({
@Part(name: 'chest_circumference') required int chestCircumference,
@Part(name: 'waist_circumference') required int waistCircumference,
@Part(name: 'hip_circumference') required int hipCircumference,
});
}

View File

@@ -87,6 +87,56 @@ class _ProfileService implements ProfileService {
return _value;
}
@override
Future<Map<String, Circumference>> addCircumference({
required int chestCircumference,
required int waistCircumference,
required int hipCircumference,
}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = FormData();
_data.fields.add(MapEntry(
'chest_circumference',
chestCircumference.toString(),
));
_data.fields.add(MapEntry(
'waist_circumference',
waistCircumference.toString(),
));
_data.fields.add(MapEntry(
'hip_circumference',
hipCircumference.toString(),
));
final _options = _setStreamType<Map<String, Circumference>>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/profile/addCircumference',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late Map<String, Circumference> _value;
try {
_value = _result.data!.map((k, dynamic v) =>
MapEntry(k, Circumference.fromJson(v as Map<String, dynamic>)));
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
if (T != dynamic &&
!(requestOptions.responseType == ResponseType.bytes ||