Skip to content

Instantly share code, notes, and snippets.

@mono0926
Created May 17, 2022 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mono0926/663a6542e6ec341f15e6362c8ec7d70f to your computer and use it in GitHub Desktop.
Save mono0926/663a6542e6ec341f15e6362c8ec7d70f to your computer and use it in GitHub Desktop.
ThemeExtensionのUser Snippet
"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