Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Deprecated RaisedButton causing error in new Flutter 3.xx #22

Open
kang49 opened this issue May 18, 2023 · 0 comments
Open

Deprecated RaisedButton causing error in new Flutter 3.xx #22

kang49 opened this issue May 18, 2023 · 0 comments

Comments

@kang49
Copy link

kang49 commented May 18, 2023

Description:

The RaisedButton widget used in the codebase is causing an error in Flutter version 3.7.12. This is because the RaisedButton widget has been deprecated and replaced by the ElevatedButton widget in Flutter 2.0.

Steps to Reproduce:

To reproduce the issue:

  1. Use Flutter version 3.7.12.
  2. Run the code that contains the RaisedButton widget.

Expected Behavior:

The code should compile and run without any errors, using the RaisedButton widget.

Actual Behavior:

The code throws an error indicating that the RaisedButton widget is not defined for the type _LoginState.

Suggested Solution:

To fix the issue, update the code to use the ElevatedButton widget instead of RaisedButton. The ElevatedButton widget is the recommended replacement for RaisedButton in Flutter 2.0 and later versions.

Here's an example of how to update the code:

Expanded(
  child: ElevatedButton(
    style: ElevatedButton.styleFrom(
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(30.0),
      ),
      // Add other desired properties and styles here
    ),
    onPressed: () {
      // Add the button's onPressed event handler here
    },
    child: Text('Button Text'),
  ),
),

Please update the codebase accordingly and retest to ensure that the issue is resolved.

Example error code

image


image

Additional Information:

  • Flutter version: 3.7.12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant