Skip to content

Minor Issue: Incorrect usage of Color.fromRGBO in qr_code_scanner #762

@thdwjdrl401

Description

@thdwjdrl401

First of all, thank you for maintaining the qr_code_scanner package.
While reviewing the code, I noticed that in lib/src/qr_scanner_overlay_shape.dart, the default value for Color.fromRGBO is written as:

Color.fromRGBO(0, 0, 0, 80)

The fourth parameter (opacity) of Color.fromRGBO expects a double value between 0.0 and 1.0, not an int.
Because of this incorrect value, the overlay becomes completely opaque, which is likely not the intended behavior.
Although the application does not immediately crash, the overlay appears fully black instead of being semi-transparent as intended.

This issue seems to have been introduced by an external contributor (Luis Thein), not by the original maintainer.
I fully understand that the project is currently in maintenance mode and that no immediate changes might be made.
However, correcting the value from 80 to 0.8 would better match the intended transparent overlay effect and improve the user experience.

Suggested Fix:

Change:

Color.fromRGBO(0, 0, 0, 80)

to:

Color.fromRGBO(0, 0, 0, 0.8)

(This code is located in lib/src/qr_scanner_overlay_shape.dart.)

Thank you again for your contributions to the Flutter community!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions