diff --git a/packages/dynamic_color/example/lib/core_palette_visualization.dart b/packages/dynamic_color/example/lib/core_palette_visualization.dart index f1b74009..59b0e9d9 100644 --- a/packages/dynamic_color/example/lib/core_palette_visualization.dart +++ b/packages/dynamic_color/example/lib/core_palette_visualization.dart @@ -158,9 +158,9 @@ class _RenderCorePalette extends StatelessWidget { corePalette.neutralVariant.asList, ]; return Column( - children: colors.mapIndexed( - (List tones, int i) { - return Row( + children: [ + for (final (int i, List tones) in colors.indexed) + Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( @@ -172,9 +172,8 @@ class _RenderCorePalette extends StatelessWidget { ), ), const SizedBox(width: 16), - ...tones.mapIndexed((int color, int i) { - final toneValue = TonalPalette.commonTones[i]; - return Container( + for (final (int i, int color) in tones.indexed) + Container( constraints: const BoxConstraints.tightFor( height: 80, width: 60, @@ -182,32 +181,19 @@ class _RenderCorePalette extends StatelessWidget { color: Color(color), child: Center( child: Text( - toneValue.toString(), + TonalPalette.commonTones[i].toString(), style: captionStyle!.copyWith( // For contrast - color: toneValue > 50 ? Colors.black : Colors.white, + color: TonalPalette.commonTones[i] > 50 + ? Colors.black + : Colors.white, ), ), ), - ); - }), + ), ], - ); - }, - ).toList(), + ), + ], ); } } - -extension ExtendedIterable on Iterable { - /// Like Iterable.map but the callback has index as second argument. - Iterable mapIndexed(T Function(E e, int i) f) { - var i = 0; - return map((e) => f(e, i++)); - } - - void forEachIndexed(void Function(E e, int i) f) { - var i = 0; - forEach((e) => f(e, i++)); - } -} diff --git a/packages/dynamic_color/example/pubspec.lock b/packages/dynamic_color/example/pubspec.lock index eea4cad4..57cae8c7 100644 --- a/packages/dynamic_color/example/pubspec.lock +++ b/packages/dynamic_color/example/pubspec.lock @@ -55,7 +55,7 @@ packages: path: ".." relative: true source: path - version: "1.6.5" + version: "1.6.6" fake_async: dependency: transitive description: @@ -82,14 +82,6 @@ packages: description: flutter source: sdk version: "0.0.0" - js: - dependency: transitive - description: - name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 - url: "https://pub.dev" - source: hosted - version: "0.6.7" lints: dependency: transitive description: @@ -191,6 +183,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + web: + dependency: transitive + description: + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + url: "https://pub.dev" + source: hosted + version: "0.1.4-beta" sdks: - dart: ">=3.0.0-0 <4.0.0" + dart: ">=3.1.0-185.0.dev <4.0.0" flutter: ">=3.4.0-17.0.pre" diff --git a/packages/dynamic_color/example/pubspec.yaml b/packages/dynamic_color/example/pubspec.yaml index b77c131c..bca8d6fa 100644 --- a/packages/dynamic_color/example/pubspec.yaml +++ b/packages/dynamic_color/example/pubspec.yaml @@ -6,7 +6,7 @@ description: Demonstrates how to use the dynamic_color package. publish_to: "none" # Remove this line if you wish to publish to pub.dev environment: - sdk: ">=2.17.0-0 <4.0.0" + sdk: ">=3.0.0 <4.0.0" # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions diff --git a/packages/dynamic_color/pubspec.lock b/packages/dynamic_color/pubspec.lock index e5004620..0c438960 100644 --- a/packages/dynamic_color/pubspec.lock +++ b/packages/dynamic_color/pubspec.lock @@ -107,14 +107,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.18.1" - js: - dependency: transitive - description: - name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 - url: "https://pub.dev" - source: hosted - version: "0.6.7" json_annotation: dependency: transitive description: @@ -272,6 +264,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.1.1" + web: + dependency: transitive + description: + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + url: "https://pub.dev" + source: hosted + version: "0.1.4-beta" yaml: dependency: transitive description: @@ -281,5 +281,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.0.0 <4.0.0" + dart: ">=3.1.0-185.0.dev <4.0.0" flutter: ">=3.4.0-17.0.pre"