Created
June 24, 2025 16:04
-
-
Save loic-sharma/2934cb37072875c8cb7d9d5b365274b5 to your computer and use it in GitHub Desktop.
Primary constructor experiments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Current | |
class Opacity extends SingleChildRenderObjectWidget { | |
/// Creates a widget that makes its child partially transparent. | |
/// | |
/// The [opacity] argument must be between zero and one, inclusive. | |
const Opacity({ | |
super.key, | |
required this.opacity, | |
this.alwaysIncludeSemantics = false, | |
super.child, | |
}) : assert(opacity >= 0.0 && opacity <= 1.0); | |
/// Lots of comments. | |
/// | |
/// Lots of comments. | |
final double opacity; | |
/// Lots of comments | |
/// | |
/// Lots of comments. | |
final bool alwaysIncludeSemantics; | |
... | |
} | |
// Using a primary header constructor | |
class const Opacity({ | |
super.key, | |
/// Lots of comments. | |
/// | |
/// Lots of comments. | |
required double opacity, | |
/// Lots of comments. | |
/// | |
/// Lots of comments. | |
bool alwaysIncludeSemantics = false, | |
super.child, | |
}) : assert(opacity >= 0.0 && opacity <= 1.0) | |
extends SingleChildRenderObjectWidget { | |
} | |
// Using a primary body constructor | |
class Opacity extends SingleChildRenderObjectWidget { | |
/// Creates a widget that makes its child partially transparent. | |
/// | |
/// The [opacity] argument must be between zero and one, inclusive. | |
const this({ | |
super.key, | |
/// Lots of comments. | |
/// | |
/// Lots of comments. | |
required double opacity, | |
/// Lots of comments. | |
/// | |
/// Lots of comments. | |
bool alwaysIncludeSemantics = false, | |
super.child, | |
}) : assert(opacity >= 0.0 && opacity <= 1.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment