Created
May 17, 2022 08:19
-
-
Save mono0926/663a6542e6ec341f15e6362c8ec7d70f to your computer and use it in GitHub Desktop.
ThemeExtensionのUser Snippet
This file contains 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
"Theme Extension": { | |
"prefix": "thmex", | |
"description": "Insert a Theme Extension class", | |
"body": [ | |
"@immutable", | |
"class $1 extends ThemeExtension<$1> {", | |
" const $1({", | |
" required this.$3,", | |
" });", | |
"", | |
" final $2 $3;", | |
"", | |
" @override", | |
" $1 copyWith({$2? $3,}) {", | |
" return $1(", | |
" $3: $3 ?? this.$3,", | |
" );", | |
" }", | |
"", | |
" @override", | |
" $1 lerp(ThemeExtension<$1>? other, double t) {", | |
" if (other is! $1) {", | |
" return this;", | |
" }", | |
" return $1(", | |
" $3: $2.lerp($3, other.$3, t)!,", | |
" );", | |
" }", | |
"", | |
" @override", | |
" String toString() => '$1($3: $$3)';", | |
"}", | |
] | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment