refactor(iOS): Layout fixes to avoid crashes

This commit is contained in:
2024-05-02 16:10:29 +03:00
parent 2b5da83e38
commit e1932ff2ff

View File

@@ -800,7 +800,11 @@ class MyProfileScreen extends StatelessWidget {
//final digitsOnly = FilteringTextInputFormatter.digitsOnly;
return AlertDialog(
title: Center(child: Text("Добавить замер")),
content: ListView(
content: SizedBox(
width: 200, // Ширина диалогового окна
height: 300, // Высота диалогового окна
child: ListView(
children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 5.v),
@@ -845,7 +849,7 @@ class MyProfileScreen extends StatelessWidget {
],
),
],
),
)),
actions: [
TextButton(
onPressed: onTapOk(context),
@@ -862,7 +866,7 @@ class MyProfileScreen extends StatelessWidget {
backgroundColor: Colors.white,
titlePadding: EdgeInsets.all(
20.0), // Можете настроить отступы по вашему желанию
);
);
},
);
}
@@ -912,31 +916,36 @@ class MyProfileScreen extends StatelessWidget {
context: context,
builder: (context) {
return AlertDialog(
title: Center(child: Text("add_measure".tr)),
content: ListView(
children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 5.v),
child: Text("weight".tr, style: theme.textTheme.bodyLarge),
),
SizedBox(height: 5.v),
CustomTextFormField(
controller: state.weightController,
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter
.digitsOnly, // Ограничение ввода только цифрами
],
),
],
content: SizedBox(
width: 200, // Ширина диалогового окна
height: 100, // Высота диалогового окна
child: ListView(
children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 5),
child: Text("weight".tr, style: theme.textTheme.bodyLarge),
),
SizedBox(height: 5),
CustomTextFormField(
controller: state.weightController,
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.digitsOnly,
],
),
],
),
),
actions: [
TextButton(
onPressed: onTapOk(context),
onPressed: () => Navigator.of(context).pop(),
child: Text("Отмена", style: theme.textTheme.bodyLarge),
),
TextButton(
onPressed: addWeight(state, context),
onPressed: () {
addWeight(state, context);
Navigator.of(context).pop(); // Закрыть диалоговое окно после изменения веса
},
child: Text("Изменить",
style: CustomTextStyles.titleMediumBlack.copyWith(
color: Colors.blue,
@@ -944,8 +953,7 @@ class MyProfileScreen extends StatelessWidget {
),
],
backgroundColor: Colors.white,
titlePadding: EdgeInsets.all(
20.0), // Можете настроить отступы по вашему желанию
titlePadding: EdgeInsets.all(20.0),
);
},
);