File tree Expand file tree Collapse file tree 4 files changed +15
-10
lines changed
features/trainee_measurements/presentation Expand file tree Collapse file tree 4 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -74,4 +74,7 @@ abstract class AppStrings {
74
74
static const String gallery = 'Gallery' ;
75
75
static const String camera = 'Camera' ;
76
76
static const String cancel = 'Cancel' ;
77
+ static const String yourBmi = 'Your BMI' ;
78
+ static const String yourTargetWeight = "What's your target weight?" ;
79
+
77
80
}
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
6
6
final String ? title;
7
7
final VoidCallback ? onBack;
8
8
final List <Widget >? actions;
9
- final TextStyle ? titleStyle;
9
+ final TextStyle ? titleStyle;
10
10
11
11
const CustomAppBar ({
12
12
super .key,
@@ -21,10 +21,13 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
21
21
return AppBar (
22
22
title: Text (title ?? '' , style: titleStyle ?? StylesManager .regular18),
23
23
centerTitle: true ,
24
- leading: IconButton (
25
- icon: const Icon (Icons .arrow_back_ios_new_rounded),
26
- onPressed: onBack ?? () => context.pop (),
27
- ),
24
+ leading:
25
+ context.canPop ()
26
+ ? IconButton (
27
+ icon: const Icon (Icons .arrow_back_ios_new_rounded),
28
+ onPressed: onBack ?? () => context.pop (),
29
+ )
30
+ : null ,
28
31
elevation: 0 ,
29
32
actions: actions,
30
33
backgroundColor: Colors .transparent,
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import 'package:graduation_project/features/trainee_measurements/domain/entities
4
4
import 'package:graduation_project/features/trainee_measurements/presentation/cubits/weight/weight_state.dart' ;
5
5
import 'package:injectable/injectable.dart' ;
6
6
7
- @injectable
7
+ @lazySingleton
8
8
class WeightCubit extends Cubit <WeightState > {
9
9
final double _heightInCm;
10
10
final Gender _gender;
@@ -13,9 +13,8 @@ class WeightCubit extends Cubit<WeightState> {
13
13
: super (const WeightState ());
14
14
15
15
void updateWeight (int value) {
16
- final weightInKg = state.isKg ? value.toDouble () : value / 2.20462 ;
17
- final bmi = _calculateBmi (weightInKg, _heightInCm);
18
- emit (state.copyWith (weight: weightInKg, bmi: bmi));
16
+ final bmi = _calculateBmi (value.toDouble (), _heightInCm);
17
+ emit (state.copyWith (weight: value.toDouble (), bmi: bmi));
19
18
}
20
19
21
20
void toggleUnit (bool isKg) {
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ class WeightRulerSection extends StatelessWidget {
38
38
const SizedBox (height: AppSize .s40),
39
39
MeasurementFeedbackWidget (
40
40
value: state.bmi.value.toStringAsFixed (1 ),
41
- label: 'Your BMI' ,
41
+ label: AppStrings .yourBmi ,
42
42
status: state.bmi.category.displayName,
43
43
message: cubit.bmiMessage,
44
44
statusColor: state.bmi.category.color,
You can’t perform that action at this time.
0 commit comments