Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remover null operator e substituir botões depreciados new_guardian_page #283

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RoxyRoses
Copy link
Contributor

Pull Request: Atualização da Página de Novo Guardião para Consistência com o Design System

Resumo

Este pull request atualiza a NewGuardianPage para usar os componentes de botão do Design System, garantindo consistência visual e alinhamento com práticas modernas do Flutter.


Alterações Realizadas

  1. Substituição de Widgets Depreciados:

    • Substituído o RaisedButton pelo PenhasButton.roundedFilled para o botão de ação "Adicionar guardião".
    • Substituído o FlatButton pelo PenhasButton.text para os botões de ação em diálogos.
  2. Compatibilidade com Null Safety:

    • Removido o operador de acesso condicional (?.) desnecessário em chamadas do WidgetsBinding.
  3. Simplificação de Código:

    • Removidas propriedades redundantes (elevation, color, shape) no antigo botão, agora gerenciadas pelo Design System.

Diferenças no Código

diff --git a/lib/app/features/help_center/presentation/new_guardian/new_guardian_page.dart b/lib/app/features/help_center/presentation/new_guardian/new_guardian_page.dart
index 6b215d76..e94bd5af 100644
--- a/lib/app/features/help_center/presentation/new_guardian/new_guardian_page.dart
+++ b/lib/app/features/help_center/presentation/new_guardian/new_guardian_page.dart
@@ -8,6 +8,7 @@ import 'package:mobx/mobx.dart';
 import '../../../../core/extension/asuka.dart';
 import '../../../../shared/design_system/colors.dart';
 import '../../../../shared/design_system/text_styles.dart';
+import '../../../../shared/design_system/widgets/buttons/penhas_button.dart';
 import '../../../authentication/presentation/shared/input_box_style.dart';
 import '../../../authentication/presentation/shared/page_progress_indicator.dart';
 import '../../../authentication/presentation/shared/single_text_input.dart';
@@ -39,7 +40,7 @@ class _NewGuardianPageState
   @override
   void initState() {
     super.initState();
-    WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
+    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
       controller.loadPage();
     });
   }
@@ -230,13 +231,9 @@ class _NewGuardianPageState
       child: SizedBox(
         height: 40,
         width: 215,
-        child: RaisedButton(
+        child: PenhasButton.roundedFilled(
           onPressed: () => controller.addGuardian(),
-          elevation: 0,
-          color: DesignSystemColors.easterPurple,
-          shape: RoundedRectangleBorder(
-            borderRadius: BorderRadius.circular(20),
-          ),
+          
           child: const Text(
             'Adicionar guardião',
             style: TextStyle(
@@ -286,7 +283,7 @@ class _NewGuardianPageState
     if (MediaQuery.of(context).viewInsets.bottom > 0) {
       SystemChannels.textInput.invokeMethod('TextInput.hide');
     }
-    WidgetsBinding.instance?.focusManager.primaryFocus?.unfocus();
+    WidgetsBinding.instance.focusManager.primaryFocus?.unfocus();
   }
 
   void _showSentInvite(GuardianAlertMessageAction action) {
@@ -313,7 +310,7 @@ class _NewGuardianPageState
             borderRadius: BorderRadius.circular(10.0),
           ),
           actions: <Widget>[
-            FlatButton(
+            PenhasButton.text(
               child: const Text('Fechar'),
               onPressed: () async {
                 Navigator.of(context).pop();

Copy link

sonarcloud bot commented Dec 13, 2024

Copy link

codeclimate bot commented Dec 13, 2024

Code Climate has analyzed commit f0feefe and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

View more on Code Climate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[fix] Corrigir uso de operador Null-Aware e widgets descontinuados no arquivo new_guardian_page.dart
1 participant