forked from eatvio/eatvio_app
refactor: add intl localization
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:carousel_slider_plus/carousel_slider_plus.dart';
|
||||
import 'package:eatvio_app/core/const.dart';
|
||||
import 'package:eatvio_app/localization/app_localization.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:eatvio_app/theme/app_decoration.dart';
|
||||
import 'package:eatvio_app/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
@@ -194,7 +193,8 @@ class MyProfileScreen extends StatelessWidget {
|
||||
};
|
||||
}
|
||||
|
||||
_buildCarousel(BuildContext contex, MyProfileLoadedState state) {
|
||||
_buildCarousel(BuildContext context, MyProfileLoadedState state) {
|
||||
final s = S.of(context);
|
||||
return CarouselSlider(
|
||||
options: CarouselOptions(height: 340),
|
||||
items: [1, 2, 3].map((chartType) {
|
||||
@@ -207,7 +207,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
"weight_chart".tr,
|
||||
s.weight_chart,
|
||||
style: CustomTextStyles.titleMediumBlack.copyWith(
|
||||
color: appTheme.black900,
|
||||
),
|
||||
@@ -225,7 +225,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
return Column(
|
||||
children: [
|
||||
Text(
|
||||
"bodymass_chart".tr,
|
||||
s.bodymass_chart,
|
||||
style: CustomTextStyles.titleMediumBlack.copyWith(
|
||||
color: appTheme.black900,
|
||||
),
|
||||
@@ -247,14 +247,14 @@ class MyProfileScreen extends StatelessWidget {
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
"circumferences_chart".tr,
|
||||
s.circumferences_chart,
|
||||
style: CustomTextStyles.titleMediumBlack.copyWith(
|
||||
color: appTheme.black900,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 30),
|
||||
_buildCircumferenceChart(context, state.circumferences, state.chartDates),
|
||||
_buildChartLegend(),
|
||||
_buildChartLegend(context),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -267,9 +267,10 @@ class MyProfileScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
_buildChartLegend() {
|
||||
_buildChartLegend(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
final colors = [Colors.pink, Colors.green, Colors.purple];
|
||||
final titles = ["chest".tr, "waist".tr, "hips".tr];
|
||||
final titles = [s.chest, s.waist, s.hips];
|
||||
final style = TextStyle(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -650,13 +651,14 @@ class MyProfileScreen extends StatelessWidget {
|
||||
|
||||
/// Section Widget
|
||||
_buildPlans(BuildContext context, List<dynamic>? plans, List<dynamic>? imagePaths, List<dynamic>? states) {
|
||||
final s = S.of(context);
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: 7),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 15),
|
||||
child: Text("plans_complete".tr, style: CustomTextStyles.titleMediumBlack.copyWith(color: appTheme.black900)),
|
||||
child: Text(s.plans_complete, style: CustomTextStyles.titleMediumBlack.copyWith(color: appTheme.black900)),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Container(
|
||||
@@ -735,7 +737,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
child: Container(
|
||||
width: 70,
|
||||
margin: EdgeInsets.only(bottom: 14, right: 22),
|
||||
child: Text("$state".tr, maxLines: 3, overflow: TextOverflow.ellipsis, style: theme.textTheme.titleSmall),
|
||||
child: Text("$state", maxLines: 3, overflow: TextOverflow.ellipsis, style: theme.textTheme.titleSmall),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -765,6 +767,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
}
|
||||
|
||||
_editCircumference(BuildContext context, MyProfileLoadedState state) {
|
||||
final s = S.of(context);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
@@ -779,7 +782,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
child: Text("chest_circumference".tr, style: theme.textTheme.bodyLarge),
|
||||
child: Text(s.chest_circumference, style: theme.textTheme.bodyLarge),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFormField(
|
||||
@@ -791,7 +794,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 15),
|
||||
child: Text("waist_circumference".tr, style: theme.textTheme.bodyLarge),
|
||||
child: Text(s.waist_circumference, style: theme.textTheme.bodyLarge),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFormField(
|
||||
@@ -803,7 +806,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 15),
|
||||
child: Text("hip_circumference".tr, style: theme.textTheme.bodyLarge),
|
||||
child: Text(s.hip_circumference, style: theme.textTheme.bodyLarge),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFormField(
|
||||
@@ -876,6 +879,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
}
|
||||
|
||||
_editWeight(BuildContext context, MyProfileLoadedState state) {
|
||||
final s = S.of(context);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
@@ -887,7 +891,7 @@ class MyProfileScreen extends StatelessWidget {
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
child: Text("weight".tr, style: theme.textTheme.bodyLarge),
|
||||
child: Text(s.weight, style: theme.textTheme.bodyLarge),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFormField(
|
||||
|
||||
Reference in New Issue
Block a user