isDisabled: ((() {
                  
                  
                                      switch (index) {
                  
                  
                                        case 0:
                  
                  
                                          return (nameController.text != '') ? false : true;
                  
                  
                                        case 3:
                  
                  
                                          return (ageController.text != '') ? false : true;
                  
                  
                                        case 4:
                  
                  
                                          return (heightController.text != '') ? false : true;
                  
                  
                                        case 5:
                  
                  
                                          return (weightController.text != '') ? false : true;
                  
                  
                                        case 6:
                  
                  
                                          return (newWeightController.text != '') ? false : true;
                  
                  
                                      }
                  
                  
                                    }()))!,
                  
                  
                                    text: context.localization.nextTitle,
                  
                  
                                    disabledColor: AppColors.lightGreen.withOpacity(0.5),
                  
                  
                                    onTap: () {
                  
                  
                                      goToNextPage();
                  
                  
                                    },
                  
                  
                                    trailingIconPath: Assets.chevronRightIcon,
                  
                  
                                  ),
                  
                  
                  Как мне избавиться от такого костыля?
                  
                  
                
С телефона непонятно Но в голос с !='' :true:false
AppButton( isDisabled: ((() { switch (index) { case 0: return nameController.text.isEmpty; case 3: return ageController.text.isEmpty; case 4: return heightController.text.isEmpty; case 5: return weightController.text.isEmpty; case 6: return newWeightController.text.isEmpty; } }()))!, text: context.localization.nextTitle, disabledColor: AppColors.lightGreen.withOpacity(0.5), onTap: () { goToNextPage(); }, trailingIconPath: Assets.chevronRightIcon, ), От этого надо избавиться
Можешь скрин отправить?
Так и что тебе нужно?
Обсуждают сегодня