forked from eatvio/eatvio_app
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:
@@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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 ||
|
||||
|
||||
Reference in New Issue
Block a user