From e1932ff2ff50187e02776822cea2d3d8edb923a1 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Thu, 2 May 2024 16:10:29 +0300 Subject: [PATCH] refactor(iOS): Layout fixes to avoid crashes --- .../my_profile_screen/my_profile_screen.dart | 56 +++++++++++-------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/lib/presentation/profile/my_profile_screen/my_profile_screen.dart b/lib/presentation/profile/my_profile_screen/my_profile_screen.dart index 0249c425..70506ca5 100644 --- a/lib/presentation/profile/my_profile_screen/my_profile_screen.dart +++ b/lib/presentation/profile/my_profile_screen/my_profile_screen.dart @@ -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: [ - 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: [ + 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), ); }, );