feat(chat): add trailing comma rules

This commit is contained in:
mso7nueh
2024-06-25 16:05:55 +03:00
parent 6ea4a23ad6
commit b1b6ffe0f3
120 changed files with 549 additions and 546 deletions

View File

@@ -100,7 +100,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
selectedCountry: currentState.selectedCountry,
selectedActivity: currentState.selectedActivity,
myProfileModelObj: currentState.myProfileModelObj,
));
),);
} else {
var plans = []
..addAll(data["finishedPlans"])
@@ -135,7 +135,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
"0000-00-00 00:00:00",
"0000-00-00 00:00:00",
"0000-00-00 00:00:00",
"0000-00-00 00:00:00"
"0000-00-00 00:00:00",
];
for (int i = 0; i < data["circumferences"].length; i++) {
dates[i] = data["circumferences"]['$i']["created_at"];
@@ -147,7 +147,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
"user_id": 0,
"weight": 0,
"created_at": "0000-00-00 00:00:00",
"updated_at": "0000-00-00 00:00:00"
"updated_at": "0000-00-00 00:00:00",
};
}
}
@@ -161,7 +161,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
"waist_circumference": 0,
"hip_circumference": 0,
"created_at": "0000-00-00 00:00:00",
"updated_at": "0000-00-00 00:00:00"
"updated_at": "0000-00-00 00:00:00",
};
}
}
@@ -180,17 +180,17 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
hypoFormController: data['userDetails']['has_hypo'].toString(),
hyperFormController: data['userDetails']['has_hyper'].toString(),
chestCircumferenceFormController: TextEditingController(
text: data['userDetails']['chest_circumference']?.toString()),
text: data['userDetails']['chest_circumference']?.toString(),),
waistCircumferenceFormController: TextEditingController(
text: data['userDetails']['waist_circumference']?.toString()),
text: data['userDetails']['waist_circumference']?.toString(),),
hipCircumferenceFormController: TextEditingController(
text: data['userDetails']['hip_circumference']?.toString()),
text: data['userDetails']['hip_circumference']?.toString(),),
weightController: TextEditingController(
text: data['userDetails']['weight']?.toString()),
text: data['userDetails']['weight']?.toString(),),
weightFormController: TextEditingController(
text: data['userDetails']['weight']?.toString()),
text: data['userDetails']['weight']?.toString(),),
firstNameFormController: TextEditingController(
text: data['userDetails']['first_name']),
text: data['userDetails']['first_name'],),
lastNameFormController:
TextEditingController(text: data['userDetails']['last_name']),
countryFormController:
@@ -198,35 +198,35 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
cityFormController:
TextEditingController(text: data['userDetails']['city']),
heightFormController: TextEditingController(
text: data['userDetails']['height']?.toString()),
text: data['userDetails']['height']?.toString(),),
upPressureFormController: TextEditingController(
text: data['userDetails']['blood_pressure_up']?.toString()),
text: data['userDetails']['blood_pressure_up']?.toString(),),
downPressureFormController: TextEditingController(
text: data['userDetails']['blood_pressure_down']?.toString()),
text: data['userDetails']['blood_pressure_down']?.toString(),),
allergiesFormController: TextEditingController(
text: data['userDetails']['about_alergy']),
text: data['userDetails']['about_alergy'],),
pillsFormController: TextEditingController(
text: data['userDetails']['about_taking_pils']),
text: data['userDetails']['about_taking_pils'],),
sportsFormController: TextEditingController(
text: data['userDetails']['about_sport_hobbies']),
text: data['userDetails']['about_sport_hobbies'],),
favoriteFormController: TextEditingController(
text: data['userDetails']['favorite_foods']),
text: data['userDetails']['favorite_foods'],),
unfavoriteFormController: TextEditingController(
text: data['userDetails']['unfavorite_foods']),
text: data['userDetails']['unfavorite_foods'],),
additionalFormController: TextEditingController(
text: data['userDetails']['additional_info']),
text: data['userDetails']['additional_info'],),
dateFormController:
TextEditingController(text: data['userDetails']['birthdate']),
selectedCity: data['userDetails']['city'],
selectedCountry: data['userDetails']['country'],
selectedActivity: determineActivityLevel(
data['userDetails']['activity_coefficient']),
));
data['userDetails']['activity_coefficient'],),
),);
}
} else {
// Один или несколько ключевых полей отсутствуют, обрабатываем ошибку
emit(
MyProfileErrorState('Некоторые необходимые данные отсутствуют.'));
MyProfileErrorState('Некоторые необходимые данные отсутствуют.'),);
}
} else {
// Статус ответа не равен 200, обрабатываем ошибку
@@ -253,7 +253,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
} // колхоз, но свитчкейсы в дарте странно ведут себя при сравнении double
Future<void> _uploadAvatar(
UploadAvatar event, Emitter<MyProfileState> emit) async {
UploadAvatar event, Emitter<MyProfileState> emit,) async {
if (state is MyProfileLoadedState) {
var currentState = state as MyProfileLoadedState;
@@ -279,7 +279,7 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
return imageUrl;
} else {
throw Exception(
'Failed to upload image. Status code: ${streamedResponse.statusCode} ${streamedResponse}}');
'Failed to upload image. Status code: ${streamedResponse.statusCode} ${streamedResponse}}',);
}
}
}

View File

@@ -53,7 +53,7 @@ class MyProfileLoadedState extends MyProfileState {
this.additionalFormController,
this.hypoFormController,
this.hyperFormController,
this.circumferences})
this.circumferences,})
: super(myProfileModelObj: null);
MyProfileModel? myProfileModelObj;

View File

@@ -112,7 +112,7 @@ class MyProfileScreen extends StatelessWidget {
),
],
),
child: _buildCarousel(context, state)),
child: _buildCarousel(context, state),),
SizedBox(height: 15.v),
if (!state.plans!.isEmpty)
Container(
@@ -137,7 +137,7 @@ class MyProfileScreen extends StatelessWidget {
state.plans?.map((plan) => plan['name']).toList(),
state.plans?.map((plan) => plan['image']).toList(),
state.plans?.map((plan) => plan['state']).toList(),
)),
),),
SizedBox(height: 5.v),
],
),
@@ -212,8 +212,8 @@ class MyProfileScreen extends StatelessWidget {
context,
state.chartPoints?.values.map<int>((e) => e['weight']).toList().map((i) => i.toDouble()).toList() ?? [0.0, 0.0, 0.0, 0.0],
state.chartDates,
)
]));
),
],),);
case 2: // График ИМТ
return Column(children: [
Text(
@@ -226,9 +226,9 @@ class MyProfileScreen extends StatelessWidget {
_buildChart(
context,
_bodyMassIndex(state.chartPoints?.values.map<int>((e) => e['weight']).toList().map((i) => i.toDouble()).toList() ?? [0.0, 0.0, 0.0, 0.0],
state.userDetails?['height'].toInt() ?? 160),
state.chartDates),
]);
state.userDetails?['height'].toInt() ?? 160,),
state.chartDates,),
],);
case 3: //График обхватов
return GestureDetector(
onTap: () => _editCircumference(context, state),
@@ -241,8 +241,8 @@ class MyProfileScreen extends StatelessWidget {
),
SizedBox(height: 30.v),
_buildCircumferenceChart(context, state.circumferences, state.chartDates),
_buildChartLegend()
]));
_buildChartLegend(),
],),);
default:
return Text('text', style: TextStyle(fontSize: 16.0));
}
@@ -640,7 +640,7 @@ class MyProfileScreen extends StatelessWidget {
child: Column(children: [
Padding(
padding: EdgeInsets.only(left: 15.h),
child: Text("plans_complete".tr, style: CustomTextStyles.titleMediumBlack.copyWith(color: appTheme.black900))),
child: Text("plans_complete".tr, style: CustomTextStyles.titleMediumBlack.copyWith(color: appTheme.black900)),),
SizedBox(height: 5.v),
Container(
decoration: AppDecoration.outlineBlueGray.copyWith(borderRadius: BorderRadiusStyle.roundedBorder5),
@@ -683,12 +683,12 @@ class MyProfileScreen extends StatelessWidget {
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Padding(
padding: EdgeInsets.only(bottom: 1.v),
child: Text(plans![i], style: CustomTextStyles.titleSmallBluegray800Bold)),
child: Text(plans![i], style: CustomTextStyles.titleSmallBluegray800Bold),),
Container(
height: 19.v,
width: 100.h,
decoration: BoxDecoration(color: boxColor, borderRadius: BorderRadius.circular(5.h)))
]))),
decoration: BoxDecoration(color: boxColor, borderRadius: BorderRadius.circular(5.h)),),
],),),),
Align(
alignment: Alignment.center,
child: Container(
@@ -697,18 +697,18 @@ class MyProfileScreen extends StatelessWidget {
dotenv.env['STORAGE_URL']! + imagePaths?[i],
height: 25.adaptSize,
width: 25.adaptSize,
))),
),),),
Align(
alignment: Alignment.bottomRight,
child: Container(
width: 70.h,
margin: EdgeInsets.only(bottom: 14.h, right: 22.h),
child: Text("$state".tr, maxLines: 3, overflow: TextOverflow.ellipsis, style: theme.textTheme.titleSmall)))
]));
})),
]))
]))
]));
child: Text("$state".tr, maxLines: 3, overflow: TextOverflow.ellipsis, style: theme.textTheme.titleSmall),),),
],),);
},),),
],),),
],),),
],),);
}
List<double> _bodyMassIndex(List<double> weightPoints, int height) {
@@ -770,7 +770,7 @@ class MyProfileScreen extends StatelessWidget {
],
),
],
)),
),),
actions: [
TextButton(
onPressed: onTapOk(context),
@@ -781,7 +781,7 @@ class MyProfileScreen extends StatelessWidget {
child: Text("Изменить",
style: CustomTextStyles.titleMediumBlack.copyWith(
color: Colors.blue,
)),
),),
),
],
backgroundColor: Colors.white,
@@ -862,7 +862,7 @@ class MyProfileScreen extends StatelessWidget {
child: Text("Изменить",
style: CustomTextStyles.titleMediumBlack.copyWith(
color: Colors.blue,
)),
),),
),
],
backgroundColor: Colors.white,

View File

@@ -16,7 +16,7 @@ import 'package:flutter/material.dart';
class MySettingsScreen extends StatelessWidget {
static Widget builder(BuildContext context) {
return BlocProvider<MyProfileBloc>(
create: (context) => MyProfileBloc(MyProfileState(myProfileModelObj: MyProfileModel()))..add(MyProfileInitialEvent()), child: MySettingsScreen());
create: (context) => MyProfileBloc(MyProfileState(myProfileModelObj: MyProfileModel()))..add(MyProfileInitialEvent()), child: MySettingsScreen(),);
}
Widget build(BuildContext context) {
@@ -86,8 +86,8 @@ class MySettingsScreen extends StatelessWidget {
),
title: Padding(
padding: EdgeInsets.only(left: 20.h),
child: Row(children: [AppbarSubtitle(text: state.user?['name'], margin: EdgeInsets.only(left: 80.h, top: 12.v, bottom: 9.v))])),
)),
child: Row(children: [AppbarSubtitle(text: state.user?['name'], margin: EdgeInsets.only(left: 80.h, top: 12.v, bottom: 9.v))]),),
),),
SizedBox(height: 20),
Container(
padding: EdgeInsets.symmetric(