From 0668085fa8644e5d08adb6f12b81a8b24cbe6021 Mon Sep 17 00:00:00 2001 From: Angelo Silvestre Date: Mon, 16 Dec 2024 16:12:25 -0300 Subject: [PATCH] Replace Color.withOpacity with Color.withValues (Resolves #2437) --- .../quill/lib/deltas/deltas_display.dart | 6 ++--- .../clones/quill/lib/editor/toolbar.dart | 6 ++--- .../popovers/icon_selector.dart | 2 +- .../popovers/text_item_selector.dart | 4 ++-- .../lib/demos/demo_attributed_text.dart | 2 +- .../demo_mobile_editing_android.dart | 2 +- .../demo_mobile_editing_ios.dart | 2 +- .../demos/example_editor/example_editor.dart | 2 +- .../feature_ios_native_context_menu.dart | 2 +- .../demos/in_the_lab/in_the_lab_scaffold.dart | 8 +++---- .../lib/demos/in_the_lab/popover_list.dart | 6 ++--- .../in_the_lab/selected_text_colors_demo.dart | 4 ++-- .../super_editor_item_selector.dart | 4 ++-- .../spot_check_scaffold.dart | 4 ++-- .../toolbar_following_content_in_layer.dart | 4 ++-- .../demos/mobile_chat/demo_mobile_chat.dart | 4 ++-- ...o_task_and_chat_with_customscrollview.dart | 2 +- .../lib/demos/sliver_example_editor.dart | 2 +- .../supertextfield/_interactive_demo.dart | 2 +- .../android/demo_superandroidtextfield.dart | 2 +- .../ios/demo_superiostextfield.dart | 2 +- super_editor/example/lib/main.dart | 2 +- .../example/lib/main_super_editor.dart | 2 +- super_editor/example_docs/lib/app_menu.dart | 2 +- .../lib/infrastructure/icon_selector.dart | 2 +- .../infrastructure/text_item_selector.dart | 4 ++-- super_editor/example_docs/lib/toolbar.dart | 6 ++--- super_editor/example_perf/lib/main.dart | 2 +- .../lib/src/default_editor/box_component.dart | 2 +- .../document_caret_overlay.dart | 2 +- .../document_gestures_touch_ios.dart | 2 +- .../document_ime/mobile_toolbar.dart | 3 ++- .../src/infrastructure/blinking_caret.dart | 2 +- .../flutter/material_scrollbar.dart | 22 ++++++++++--------- .../src/infrastructure/flutter/scrollbar.dart | 6 ++--- .../android/android_document_controls.dart | 2 +- .../platforms/android/selection_handles.dart | 2 +- .../platforms/ios/ios_document_controls.dart | 2 +- .../platforms/ios/magnifier.dart | 2 +- ...nly_document_android_touch_interactor.dart | 2 +- .../src/super_textfield/android/_caret.dart | 2 +- .../android/_user_interaction.dart | 2 +- .../infrastructure/text_scrollview.dart | 8 +++---- .../lib/src/super_textfield/ios/caret.dart | 2 +- .../super_textfield/ios/floating_cursor.dart | 2 +- .../super_textfield/ios/user_interaction.dart | 4 ++-- .../spelling_error_suggestion_overlay.dart | 2 +- super_text_layout/example/lib/main.dart | 6 ++--- super_text_layout/lib/src/caret_layer.dart | 2 +- website/lib/homepage/header.dart | 2 +- website/lib/homepage/home_page.dart | 2 +- website/lib/homepage/inside_the_toolbox.dart | 2 +- .../super_editor_item_selector.dart | 4 ++-- 53 files changed, 92 insertions(+), 89 deletions(-) diff --git a/super_editor/clones/quill/lib/deltas/deltas_display.dart b/super_editor/clones/quill/lib/deltas/deltas_display.dart index 297b596a42..e96857be87 100644 --- a/super_editor/clones/quill/lib/deltas/deltas_display.dart +++ b/super_editor/clones/quill/lib/deltas/deltas_display.dart @@ -77,7 +77,7 @@ class _DeltasDisplayState extends State implements EditListener { child: Column( children: [ _buildToolbar(), - Divider(height: 1, color: Colors.white.withOpacity(0.1)), + Divider(height: 1, color: Colors.white.withValues(alpha: 0.1)), Expanded( child: _buildDeltaList(), ), @@ -133,7 +133,7 @@ class _DeltasDisplayState extends State implements EditListener { return Container( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), decoration: BoxDecoration( - border: Border(bottom: BorderSide(color: Colors.white.withOpacity(0.1))), + border: Border(bottom: BorderSide(color: Colors.white.withValues(alpha: 0.1))), ), child: Column( mainAxisSize: MainAxisSize.min, @@ -150,7 +150,7 @@ class _DeltasDisplayState extends State implements EditListener { Text( op.attributes?.entries.map((entry) => "${entry.key}: ${entry.value}").join(", ") ?? "", style: TextStyle( - color: Colors.white.withOpacity(0.5), + color: Colors.white.withValues(alpha: 0.5), fontFamily: "Monospace", fontSize: 10, fontWeight: FontWeight.bold, diff --git a/super_editor/clones/quill/lib/editor/toolbar.dart b/super_editor/clones/quill/lib/editor/toolbar.dart index 118484d921..0a187a9ebb 100644 --- a/super_editor/clones/quill/lib/editor/toolbar.dart +++ b/super_editor/clones/quill/lib/editor/toolbar.dart @@ -743,7 +743,7 @@ class _NamedTextSizeSelectorState extends State<_NamedTextSizeSelector> { itemBuilder: (context, item, isActive, onTap) { return DecoratedBox( decoration: BoxDecoration( - color: isActive ? Colors.grey.withOpacity(0.2) : Colors.transparent, + color: isActive ? Colors.grey.withValues(alpha: 0.2) : Colors.transparent, ), child: InkWell( onTap: onTap, @@ -873,7 +873,7 @@ class _HeaderSelectorState extends State<_HeaderSelector> { ), itemBuilder: (context, item, isActive, onTap) => DecoratedBox( decoration: BoxDecoration( - color: isActive ? Colors.grey.withOpacity(0.2) : Colors.transparent, + color: isActive ? Colors.grey.withValues(alpha: 0.2) : Colors.transparent, ), child: InkWell( onTap: onTap, @@ -1101,7 +1101,7 @@ class _FontFamilySelectorState extends State<_FontFamilySelector> { ), itemBuilder: (context, item, isActive, onTap) => DecoratedBox( decoration: BoxDecoration( - color: isActive ? Colors.grey.withOpacity(0.2) : Colors.transparent, + color: isActive ? Colors.grey.withValues(alpha: 0.2) : Colors.transparent, ), child: InkWell( onTap: onTap, diff --git a/super_editor/clones/quill/lib/infrastructure/popovers/icon_selector.dart b/super_editor/clones/quill/lib/infrastructure/popovers/icon_selector.dart index 224a47ed7b..45d5c6084d 100644 --- a/super_editor/clones/quill/lib/infrastructure/popovers/icon_selector.dart +++ b/super_editor/clones/quill/lib/infrastructure/popovers/icon_selector.dart @@ -108,7 +108,7 @@ class _IconSelectorState extends State { color: item == widget.selectedIcon ? toolbarButtonSelectedColor : isActive - ? Colors.grey.withOpacity(0.2) + ? Colors.grey.withValues(alpha: 0.2) : Colors.transparent, ), child: InkWell( diff --git a/super_editor/clones/quill/lib/infrastructure/popovers/text_item_selector.dart b/super_editor/clones/quill/lib/infrastructure/popovers/text_item_selector.dart index e9815eebeb..2ca884176c 100644 --- a/super_editor/clones/quill/lib/infrastructure/popovers/text_item_selector.dart +++ b/super_editor/clones/quill/lib/infrastructure/popovers/text_item_selector.dart @@ -147,7 +147,7 @@ class _TextItemSelectorState extends State { overflow: TextOverflow.ellipsis, textAlign: TextAlign.left, style: TextStyle( - color: Colors.black.withOpacity(0.7), + color: Colors.black.withValues(alpha: 0.7), fontSize: 14, fontWeight: FontWeight.bold, ), @@ -188,7 +188,7 @@ class _TextItemSelectorState extends State { Widget defaultPopoverListItemBuilder(BuildContext context, TextItem item, bool isActive, VoidCallback onTap) { return DecoratedBox( decoration: BoxDecoration( - color: isActive ? Colors.grey.withOpacity(0.2) : Colors.transparent, + color: isActive ? Colors.grey.withValues(alpha: 0.2) : Colors.transparent, ), child: InkWell( onTap: onTap, diff --git a/super_editor/example/lib/demos/demo_attributed_text.dart b/super_editor/example/lib/demos/demo_attributed_text.dart index 2ffb9c6971..34c732532f 100644 --- a/super_editor/example/lib/demos/demo_attributed_text.dart +++ b/super_editor/example/lib/demos/demo_attributed_text.dart @@ -265,7 +265,7 @@ class _TextRangeSelectorState extends State { height: widget.cellHeight, decoration: BoxDecoration( border: Border.all(width: 1, color: _isSelected(index) ? Colors.red : Colors.grey), - color: _isSelected(index) ? Colors.red.withOpacity(0.7) : Colors.grey.withOpacity(0.7), + color: _isSelected(index) ? Colors.red.withValues(alpha: 0.7) : Colors.grey.withValues(alpha: 0.7), ), ), ), diff --git a/super_editor/example/lib/demos/editor_configs/demo_mobile_editing_android.dart b/super_editor/example/lib/demos/editor_configs/demo_mobile_editing_android.dart index 9d605184c2..263ad87902 100644 --- a/super_editor/example/lib/demos/editor_configs/demo_mobile_editing_android.dart +++ b/super_editor/example/lib/demos/editor_configs/demo_mobile_editing_android.dart @@ -192,7 +192,7 @@ class _MobileEditingAndroidDemoState extends State { borderRadius: BorderRadius.circular(8), boxShadow: [ BoxShadow( - color: Colors.black.withOpacity(0.2), + color: Colors.black.withValues(alpha: 0.2), blurRadius: 5, offset: const Offset(0, 3), ), diff --git a/super_editor/example/lib/demos/editor_configs/demo_mobile_editing_ios.dart b/super_editor/example/lib/demos/editor_configs/demo_mobile_editing_ios.dart index bdfae2d982..fd6a1728f6 100644 --- a/super_editor/example/lib/demos/editor_configs/demo_mobile_editing_ios.dart +++ b/super_editor/example/lib/demos/editor_configs/demo_mobile_editing_ios.dart @@ -199,7 +199,7 @@ class _MobileEditingIOSDemoState extends State with Single borderRadius: BorderRadius.circular(8), boxShadow: [ BoxShadow( - color: Colors.black.withOpacity(0.2), + color: Colors.black.withValues(alpha: 0.2), blurRadius: 5, offset: const Offset(0, 3), ), diff --git a/super_editor/example/lib/demos/example_editor/example_editor.dart b/super_editor/example/lib/demos/example_editor/example_editor.dart index 32b7447a8b..b115497633 100644 --- a/super_editor/example/lib/demos/example_editor/example_editor.dart +++ b/super_editor/example/lib/demos/example_editor/example_editor.dart @@ -394,7 +394,7 @@ class _ExampleEditorState extends State { selectionStyle: isLight ? defaultSelectionStyle : SelectionStyles( - selectionColor: Colors.red.withOpacity(0.3), + selectionColor: Colors.red.withValues(alpha: 0.3), ), stylesheet: defaultStylesheet.copyWith( addRulesAfter: [ diff --git a/super_editor/example/lib/demos/in_the_lab/feature_ios_native_context_menu.dart b/super_editor/example/lib/demos/in_the_lab/feature_ios_native_context_menu.dart index d91b07a5b9..a6f8f96b7a 100644 --- a/super_editor/example/lib/demos/in_the_lab/feature_ios_native_context_menu.dart +++ b/super_editor/example/lib/demos/in_the_lab/feature_ios_native_context_menu.dart @@ -80,7 +80,7 @@ class _NativeIosContextMenuFeatureDemoState extends State { for (int i = 0; i < widget.listItems.length; i += 1) ...[ ColoredBox( color: i == _selectedValueIndex && _focusNode.hasPrimaryFocus - ? Colors.white.withOpacity(0.05) + ? Colors.white.withValues(alpha: 0.05) : Colors.transparent, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6), @@ -209,7 +209,7 @@ class _PopoverListState extends State { Padding( padding: const EdgeInsets.symmetric(horizontal: 8), child: Divider( - color: Colors.white.withOpacity(0.2), + color: Colors.white.withValues(alpha: 0.2), height: 1, ), ), @@ -229,7 +229,7 @@ class _PopoverListState extends State { "NO ACTIONS", textAlign: TextAlign.center, style: TextStyle( - color: Colors.black.withOpacity(0.5), + color: Colors.black.withValues(alpha: 0.5), fontSize: 12, fontWeight: FontWeight.bold, ), diff --git a/super_editor/example/lib/demos/in_the_lab/selected_text_colors_demo.dart b/super_editor/example/lib/demos/in_the_lab/selected_text_colors_demo.dart index 0643d5a18a..4a9bb5791f 100644 --- a/super_editor/example/lib/demos/in_the_lab/selected_text_colors_demo.dart +++ b/super_editor/example/lib/demos/in_the_lab/selected_text_colors_demo.dart @@ -180,7 +180,7 @@ class _SelectedTextColorsDemoState extends State { border: Border.all(color: Colors.white, width: 4), color: color, boxShadow: [ - BoxShadow(color: Colors.black.withOpacity(0.5), blurRadius: 5, offset: Offset(0, 5)), + BoxShadow(color: Colors.black.withValues(alpha: 0.5), blurRadius: 5, offset: Offset(0, 5)), ], ), ), @@ -299,7 +299,7 @@ class ColorPickerPopoverModal extends StatelessWidget { border: Border.all(color: Colors.white, width: 2), color: color, boxShadow: [ - BoxShadow(color: Colors.black.withOpacity(0.2), blurRadius: 3, offset: Offset(0, 3)), + BoxShadow(color: Colors.black.withValues(alpha: 0.2), blurRadius: 3, offset: Offset(0, 3)), ], ), ), diff --git a/super_editor/example/lib/demos/infrastructure/super_editor_item_selector.dart b/super_editor/example/lib/demos/infrastructure/super_editor_item_selector.dart index bb0371780c..01995c009a 100644 --- a/super_editor/example/lib/demos/infrastructure/super_editor_item_selector.dart +++ b/super_editor/example/lib/demos/infrastructure/super_editor_item_selector.dart @@ -142,7 +142,7 @@ class _SuperEditorDemoTextItemSelectorState extends State { border: Border.all(color: Colors.grey.shade200), boxShadow: [ BoxShadow( - color: Colors.black.withOpacity(0.2), + color: Colors.black.withValues(alpha: 0.2), blurRadius: 16, offset: Offset(0, 8), ), @@ -197,7 +197,7 @@ class _MobileChatDemoState extends State { ), boxShadow: [ BoxShadow( - color: Colors.black.withOpacity(0.075), + color: Colors.black.withValues(alpha: 0.075), blurRadius: 8, spreadRadius: 4, ), diff --git a/super_editor/example/lib/demos/scrolling/demo_task_and_chat_with_customscrollview.dart b/super_editor/example/lib/demos/scrolling/demo_task_and_chat_with_customscrollview.dart index 62491856fa..9714e22214 100644 --- a/super_editor/example/lib/demos/scrolling/demo_task_and_chat_with_customscrollview.dart +++ b/super_editor/example/lib/demos/scrolling/demo_task_and_chat_with_customscrollview.dart @@ -96,7 +96,7 @@ class _TaskAndChatWithCustomScrollViewDemoState extends State { right: 0, width: 200, child: ColoredBox( - color: Colors.black.withOpacity(0.2), + color: Colors.black.withValues(alpha: 0.2), child: Center( child: ScrollingMinimap.fromRepository( key: _minimapKey, diff --git a/super_editor/example/lib/demos/supertextfield/_interactive_demo.dart b/super_editor/example/lib/demos/supertextfield/_interactive_demo.dart index 4545c20eba..2f58007af1 100644 --- a/super_editor/example/lib/demos/supertextfield/_interactive_demo.dart +++ b/super_editor/example/lib/demos/supertextfield/_interactive_demo.dart @@ -139,7 +139,7 @@ class _InteractiveTextFieldDemoState extends State { borderRadius: BorderRadius.circular(4), boxShadow: [ BoxShadow( - color: Colors.black.withOpacity(0.3), + color: Colors.black.withValues(alpha: 0.3), blurRadius: 5, offset: const Offset(3, 3), ), diff --git a/super_editor/example/lib/demos/supertextfield/android/demo_superandroidtextfield.dart b/super_editor/example/lib/demos/supertextfield/android/demo_superandroidtextfield.dart index dab051b6f3..6bcea8fcc0 100644 --- a/super_editor/example/lib/demos/supertextfield/android/demo_superandroidtextfield.dart +++ b/super_editor/example/lib/demos/supertextfield/android/demo_superandroidtextfield.dart @@ -62,7 +62,7 @@ class _SuperAndroidTextFieldDemoState extends State { hintTextStyleBuilder: (attributions) { return config.styleBuilder(attributions).copyWith(color: Colors.grey); }).build, - selectionColor: Colors.blue.withOpacity(0.4), + selectionColor: Colors.blue.withValues(alpha: 0.4), caretStyle: const CaretStyle(color: Colors.green), blinkTimingMode: BlinkTimingMode.timer, handlesColor: Colors.lightGreen, diff --git a/super_editor/example/lib/demos/supertextfield/ios/demo_superiostextfield.dart b/super_editor/example/lib/demos/supertextfield/ios/demo_superiostextfield.dart index 0ca007697c..a0e814e959 100644 --- a/super_editor/example/lib/demos/supertextfield/ios/demo_superiostextfield.dart +++ b/super_editor/example/lib/demos/supertextfield/ios/demo_superiostextfield.dart @@ -68,7 +68,7 @@ class _SuperIOSTextFieldDemoState extends State { return config.styleBuilder(attributions).copyWith(color: Colors.grey); }, ).build, - selectionColor: Colors.blue.withOpacity(0.4), + selectionColor: Colors.blue.withValues(alpha: 0.4), caretStyle: const CaretStyle(color: Colors.blue), blinkTimingMode: BlinkTimingMode.timer, handlesColor: Colors.blue, diff --git a/super_editor/example/lib/main.dart b/super_editor/example/lib/main.dart index 0b1b12c3d8..7dab7a7e6e 100644 --- a/super_editor/example/lib/main.dart +++ b/super_editor/example/lib/main.dart @@ -596,7 +596,7 @@ class _DrawerButton extends StatelessWidget { } if (states.contains(WidgetState.hovered)) { - return Colors.grey.withOpacity(0.1); + return Colors.grey.withValues(alpha: 0.1); } return Colors.transparent; diff --git a/super_editor/example/lib/main_super_editor.dart b/super_editor/example/lib/main_super_editor.dart index e129856eb1..8faa64dd9b 100644 --- a/super_editor/example/lib/main_super_editor.dart +++ b/super_editor/example/lib/main_super_editor.dart @@ -183,7 +183,7 @@ class _EditorHistoryPanelState extends State<_EditorHistoryPanel> { "${history.commands.map((command) => command.describe()).join("\n\n")}\n-------------\n${history.changes.map((event) => event.describe()).join("\n\n")}", ), subtitleTextStyle: TextStyle( - color: Colors.white.withOpacity(0.5), + color: Colors.white.withValues(alpha: 0.5), fontSize: 10, height: 1.4, ), diff --git a/super_editor/example_docs/lib/app_menu.dart b/super_editor/example_docs/lib/app_menu.dart index 71a6e74d5c..8429c819c5 100644 --- a/super_editor/example_docs/lib/app_menu.dart +++ b/super_editor/example_docs/lib/app_menu.dart @@ -127,7 +127,7 @@ class _DocsAppMenuState extends State { Widget _buildPopoverListItem(BuildContext context, DocsAppMenuItem item, bool isActive, VoidCallback onTap) { return DecoratedBox( decoration: BoxDecoration( - color: isActive ? Colors.grey.withOpacity(0.2) : Colors.transparent, + color: isActive ? Colors.grey.withValues(alpha: 0.2) : Colors.transparent, ), child: InkWell( onTap: onTap, diff --git a/super_editor/example_docs/lib/infrastructure/icon_selector.dart b/super_editor/example_docs/lib/infrastructure/icon_selector.dart index 0281b597ca..62baa438f1 100644 --- a/super_editor/example_docs/lib/infrastructure/icon_selector.dart +++ b/super_editor/example_docs/lib/infrastructure/icon_selector.dart @@ -108,7 +108,7 @@ class _IconSelectorState extends State { color: item == widget.selectedIcon ? toolbarButtonSelectedColor : isActive - ? Colors.grey.withOpacity(0.2) + ? Colors.grey.withValues(alpha: 0.2) : Colors.transparent, ), child: InkWell( diff --git a/super_editor/example_docs/lib/infrastructure/text_item_selector.dart b/super_editor/example_docs/lib/infrastructure/text_item_selector.dart index 457bb05ac4..3228581a8c 100644 --- a/super_editor/example_docs/lib/infrastructure/text_item_selector.dart +++ b/super_editor/example_docs/lib/infrastructure/text_item_selector.dart @@ -145,7 +145,7 @@ class _TextItemSelectorState extends State { overflow: TextOverflow.ellipsis, textAlign: TextAlign.left, style: TextStyle( - color: Colors.black.withOpacity(0.7), + color: Colors.black.withValues(alpha: 0.7), fontSize: 14, fontWeight: FontWeight.w500, ), @@ -185,7 +185,7 @@ class _TextItemSelectorState extends State { Widget defaultPopoverListItemBuilder(BuildContext context, TextItem item, bool isActive, VoidCallback onTap) { return DecoratedBox( decoration: BoxDecoration( - color: isActive ? Colors.grey.withOpacity(0.2) : Colors.transparent, + color: isActive ? Colors.grey.withValues(alpha: 0.2) : Colors.transparent, ), child: InkWell( onTap: onTap, diff --git a/super_editor/example_docs/lib/toolbar.dart b/super_editor/example_docs/lib/toolbar.dart index d7faed25f1..fdb4e315d5 100644 --- a/super_editor/example_docs/lib/toolbar.dart +++ b/super_editor/example_docs/lib/toolbar.dart @@ -865,7 +865,7 @@ class _DocsEditorToolbarState extends State { itemBuilder: (context, item, isActive, onTap) => SizedBox( height: 40, child: ColoredBox( - color: isActive ? Colors.grey.withOpacity(0.2) : Colors.transparent, + color: isActive ? Colors.grey.withValues(alpha: 0.2) : Colors.transparent, child: Padding( padding: const EdgeInsets.all(8.0), child: Row( @@ -936,7 +936,7 @@ class _DocsEditorToolbarState extends State { onSelected: _onChangeBlockTypeRequested, itemBuilder: (context, item, isActive, onTap) => DecoratedBox( decoration: BoxDecoration( - color: isActive ? Colors.grey.withOpacity(0.2) : Colors.transparent, + color: isActive ? Colors.grey.withValues(alpha: 0.2) : Colors.transparent, ), child: InkWell( onTap: onTap, @@ -995,7 +995,7 @@ class _DocsEditorToolbarState extends State { ), itemBuilder: (context, item, isActive, onTap) => DecoratedBox( decoration: BoxDecoration( - color: isActive ? Colors.grey.withOpacity(0.2) : Colors.transparent, + color: isActive ? Colors.grey.withValues(alpha: 0.2) : Colors.transparent, ), child: InkWell( onTap: onTap, diff --git a/super_editor/example_perf/lib/main.dart b/super_editor/example_perf/lib/main.dart index aa328a9b7c..af4adfec54 100644 --- a/super_editor/example_perf/lib/main.dart +++ b/super_editor/example_perf/lib/main.dart @@ -247,7 +247,7 @@ class _DrawerButton extends StatelessWidget { } if (states.contains(WidgetState.hovered)) { - return Colors.grey.withOpacity(0.1); + return Colors.grey.withValues(alpha: 0.1); } return Colors.transparent; diff --git a/super_editor/lib/src/default_editor/box_component.dart b/super_editor/lib/src/default_editor/box_component.dart index d6e1cde4ad..836e14412f 100644 --- a/super_editor/lib/src/default_editor/box_component.dart +++ b/super_editor/lib/src/default_editor/box_component.dart @@ -307,7 +307,7 @@ class SelectableBox extends StatelessWidget { child: IgnorePointer( child: DecoratedBox( decoration: BoxDecoration( - color: isSelected ? selectionColor.withOpacity(0.5) : Colors.transparent, + color: isSelected ? selectionColor.withValues(alpha: 0.5) : Colors.transparent, ), position: DecorationPosition.foreground, child: child, diff --git a/super_editor/lib/src/default_editor/document_caret_overlay.dart b/super_editor/lib/src/default_editor/document_caret_overlay.dart index fce689c776..c937537446 100644 --- a/super_editor/lib/src/default_editor/document_caret_overlay.dart +++ b/super_editor/lib/src/default_editor/document_caret_overlay.dart @@ -217,7 +217,7 @@ class CaretDocumentOverlayState extends DocumentLayoutLayerState { rect: floatingCursorRect, child: IgnorePointer( child: ColoredBox( - color: Colors.red.withOpacity(0.75), + color: Colors.red.withValues(alpha: 0.75), ), ), ); diff --git a/super_editor/lib/src/default_editor/document_ime/mobile_toolbar.dart b/super_editor/lib/src/default_editor/document_ime/mobile_toolbar.dart index 8a2465ec5f..81df42129d 100644 --- a/super_editor/lib/src/default_editor/document_ime/mobile_toolbar.dart +++ b/super_editor/lib/src/default_editor/document_ime/mobile_toolbar.dart @@ -159,7 +159,8 @@ class _KeyboardEditingToolbarState extends State with Wi return Theme( data: Theme.of(context).copyWith( brightness: brightness, - disabledColor: brightness == Brightness.light ? Colors.black.withOpacity(0.5) : Colors.white.withOpacity(0.5), + disabledColor: + brightness == Brightness.light ? Colors.black.withValues(alpha: 0.5) : Colors.white.withValues(alpha: 0.5), ), child: IconTheme( data: IconThemeData( diff --git a/super_editor/lib/src/infrastructure/blinking_caret.dart b/super_editor/lib/src/infrastructure/blinking_caret.dart index a91e332a89..806a103088 100644 --- a/super_editor/lib/src/infrastructure/blinking_caret.dart +++ b/super_editor/lib/src/infrastructure/blinking_caret.dart @@ -128,7 +128,7 @@ class _CaretPainter extends CustomPainter { return; } - caretPaint.color = caretColor.withOpacity(blinkController.opacity); + caretPaint.color = caretColor.withValues(alpha: blinkController.opacity); final height = caretHeight?.roundToDouble() ?? size.height; diff --git a/super_editor/lib/src/infrastructure/flutter/material_scrollbar.dart b/super_editor/lib/src/infrastructure/flutter/material_scrollbar.dart index aa06b6cea0..1029a03e9b 100644 --- a/super_editor/lib/src/infrastructure/flutter/material_scrollbar.dart +++ b/super_editor/lib/src/infrastructure/flutter/material_scrollbar.dart @@ -189,15 +189,17 @@ class _MaterialScrollbarState extends RawScrollbarWithCustomPhysicsState<_Materi late Color idleColor; switch (brightness) { case Brightness.light: - dragColor = onSurface.withOpacity(0.6); - hoverColor = onSurface.withOpacity(0.5); - idleColor = - _useAndroidScrollbar ? Theme.of(context).highlightColor.withOpacity(1.0) : onSurface.withOpacity(0.1); + dragColor = onSurface.withValues(alpha: 0.6); + hoverColor = onSurface.withValues(alpha: 0.5); + idleColor = _useAndroidScrollbar + ? Theme.of(context).highlightColor.withValues(alpha: 1.0) + : onSurface.withValues(alpha: 0.1); case Brightness.dark: - dragColor = onSurface.withOpacity(0.75); - hoverColor = onSurface.withOpacity(0.65); - idleColor = - _useAndroidScrollbar ? Theme.of(context).highlightColor.withOpacity(1.0) : onSurface.withOpacity(0.3); + dragColor = onSurface.withValues(alpha: 0.75); + hoverColor = onSurface.withValues(alpha: 0.65); + idleColor = _useAndroidScrollbar + ? Theme.of(context).highlightColor.withValues(alpha: 1.0) + : onSurface.withValues(alpha: 0.3); } return WidgetStateProperty.resolveWith((Set states) { @@ -225,7 +227,7 @@ class _MaterialScrollbarState extends RawScrollbarWithCustomPhysicsState<_Materi return WidgetStateProperty.resolveWith((Set states) { if (showScrollbar && _trackVisibility.resolve(states)) { return _scrollbarTheme.trackColor?.resolve(states) ?? - (brightness == Brightness.light ? onSurface.withOpacity(0.03) : onSurface.withOpacity(0.05)); + (brightness == Brightness.light ? onSurface.withValues(alpha: 0.03) : onSurface.withValues(alpha: 0.05)); } return const Color(0x00000000); }); @@ -237,7 +239,7 @@ class _MaterialScrollbarState extends RawScrollbarWithCustomPhysicsState<_Materi return WidgetStateProperty.resolveWith((Set states) { if (showScrollbar && _trackVisibility.resolve(states)) { return _scrollbarTheme.trackBorderColor?.resolve(states) ?? - (brightness == Brightness.light ? onSurface.withOpacity(0.1) : onSurface.withOpacity(0.25)); + (brightness == Brightness.light ? onSurface.withValues(alpha: 0.1) : onSurface.withValues(alpha: 0.25)); } return const Color(0x00000000); }); diff --git a/super_editor/lib/src/infrastructure/flutter/scrollbar.dart b/super_editor/lib/src/infrastructure/flutter/scrollbar.dart index 9c873004b1..e902190711 100644 --- a/super_editor/lib/src/infrastructure/flutter/scrollbar.dart +++ b/super_editor/lib/src/infrastructure/flutter/scrollbar.dart @@ -1615,17 +1615,17 @@ class ScrollbarPainter extends ChangeNotifier implements CustomPainter { // - Painting Paint get _paintThumb { - return Paint()..color = color.withOpacity(color.opacity * fadeoutOpacityAnimation.value); + return Paint()..color = color.withValues(alpha: color.a * fadeoutOpacityAnimation.value); } Paint _paintTrack({bool isBorder = false}) { if (isBorder) { return Paint() - ..color = trackBorderColor.withOpacity(trackBorderColor.opacity * fadeoutOpacityAnimation.value) + ..color = trackBorderColor.withValues(alpha: trackBorderColor.a * fadeoutOpacityAnimation.value) ..style = PaintingStyle.stroke ..strokeWidth = 1.0; } - return Paint()..color = trackColor.withOpacity(trackColor.opacity * fadeoutOpacityAnimation.value); + return Paint()..color = trackColor.withValues(alpha: trackColor.a * fadeoutOpacityAnimation.value); } void _paintScrollbar(Canvas canvas, Size size) { diff --git a/super_editor/lib/src/infrastructure/platforms/android/android_document_controls.dart b/super_editor/lib/src/infrastructure/platforms/android/android_document_controls.dart index bca988851a..3e8d011dda 100644 --- a/super_editor/lib/src/infrastructure/platforms/android/android_document_controls.dart +++ b/super_editor/lib/src/infrastructure/platforms/android/android_document_controls.dart @@ -414,7 +414,7 @@ class AndroidControlsDocumentLayerState builder: (context, child) { return ColoredBox( key: DocumentKeys.caret, - color: caretColor.withOpacity(_caretBlinkController.opacity), + color: caretColor.withValues(alpha: _caretBlinkController.opacity), ); }, ), diff --git a/super_editor/lib/src/infrastructure/platforms/android/selection_handles.dart b/super_editor/lib/src/infrastructure/platforms/android/selection_handles.dart index 5fd2fffca3..571b0ba9b0 100644 --- a/super_editor/lib/src/infrastructure/platforms/android/selection_handles.dart +++ b/super_editor/lib/src/infrastructure/platforms/android/selection_handles.dart @@ -64,7 +64,7 @@ class AndroidSelectionHandle extends StatelessWidget { padding: touchRegionExpansion, decoration: BoxDecoration( shape: BoxShape.circle, - color: showDebugTouchRegion ? Colors.red.withOpacity(0.5) : Colors.transparent, + color: showDebugTouchRegion ? Colors.red.withValues(alpha: 0.5) : Colors.transparent, ), child: handle, ); diff --git a/super_editor/lib/src/infrastructure/platforms/ios/ios_document_controls.dart b/super_editor/lib/src/infrastructure/platforms/ios/ios_document_controls.dart index 7ef8d66838..75938c3085 100644 --- a/super_editor/lib/src/infrastructure/platforms/ios/ios_document_controls.dart +++ b/super_editor/lib/src/infrastructure/platforms/ios/ios_document_controls.dart @@ -123,7 +123,7 @@ class _IosFloatingToolbarOverlayState extends State w child: Container( width: double.infinity, height: double.infinity, - color: Colors.yellow.withOpacity(0.2), + color: Colors.yellow.withValues(alpha: 0.2), ), ); } diff --git a/super_editor/lib/src/infrastructure/platforms/ios/magnifier.dart b/super_editor/lib/src/infrastructure/platforms/ios/magnifier.dart index 70ae8943d9..ae69ccb398 100644 --- a/super_editor/lib/src/infrastructure/platforms/ios/magnifier.dart +++ b/super_editor/lib/src/infrastructure/platforms/ios/magnifier.dart @@ -218,7 +218,7 @@ class IOSRoundedRectangleMagnifyingGlass extends StatelessWidget { width: borderWidth, ), ), - color: borderColor.withOpacity(tintOpacity), + color: borderColor.withValues(alpha: tintOpacity), shadows: const [ OuterBoxShadow( color: Color(0x33000000), diff --git a/super_editor/lib/src/super_reader/read_only_document_android_touch_interactor.dart b/super_editor/lib/src/super_reader/read_only_document_android_touch_interactor.dart index 5b7c532248..1c0438ec13 100644 --- a/super_editor/lib/src/super_reader/read_only_document_android_touch_interactor.dart +++ b/super_editor/lib/src/super_reader/read_only_document_android_touch_interactor.dart @@ -1314,7 +1314,7 @@ class _AndroidDocumentTouchEditingControlsState extends State child: IgnorePointer( child: Container( height: _mulitlineFieldAutoScrollGap, - color: Colors.purpleAccent.withOpacity(0.5), + color: Colors.purpleAccent.withValues(alpha: 0.5), ), ), ), @@ -459,7 +459,7 @@ class _TextScrollViewState extends State child: IgnorePointer( child: Container( height: _mulitlineFieldAutoScrollGap, - color: Colors.purpleAccent.withOpacity(0.5), + color: Colors.purpleAccent.withValues(alpha: 0.5), ), ), ), @@ -472,7 +472,7 @@ class _TextScrollViewState extends State bottom: 0, child: Container( width: _singleLineFieldAutoScrollGap, - color: Colors.purpleAccent.withOpacity(0.5), + color: Colors.purpleAccent.withValues(alpha: 0.5), ), ), Positioned( @@ -481,7 +481,7 @@ class _TextScrollViewState extends State bottom: 0, child: Container( width: _singleLineFieldAutoScrollGap, - color: Colors.purpleAccent.withOpacity(0.5), + color: Colors.purpleAccent.withValues(alpha: 0.5), ), ), ]; diff --git a/super_editor/lib/src/super_textfield/ios/caret.dart b/super_editor/lib/src/super_textfield/ios/caret.dart index b57c6b6387..975b649eb0 100644 --- a/super_editor/lib/src/super_textfield/ios/caret.dart +++ b/super_editor/lib/src/super_textfield/ios/caret.dart @@ -119,7 +119,7 @@ class _IOSCursorPainter extends CustomPainter { } void _drawCaret(Canvas canvas) { - caretPaint.color = caretColor.withOpacity(blinkController.opacity); + caretPaint.color = caretColor.withValues(alpha: blinkController.opacity); final textPosition = selection.extent; double caretHeight = textLayout.getCharacterBox(textPosition)?.toRect().height ?? 0.0; diff --git a/super_editor/lib/src/super_textfield/ios/floating_cursor.dart b/super_editor/lib/src/super_textfield/ios/floating_cursor.dart index 56f91fbf09..2417f87e2c 100644 --- a/super_editor/lib/src/super_textfield/ios/floating_cursor.dart +++ b/super_editor/lib/src/super_textfield/ios/floating_cursor.dart @@ -34,7 +34,7 @@ class IOSFloatingCursor extends StatelessWidget { child: Container( width: 2, height: controller.floatingCursorHeight, - color: Colors.red.withOpacity(0.75), + color: Colors.red.withValues(alpha: 0.75), ), ), ], diff --git a/super_editor/lib/src/super_textfield/ios/user_interaction.dart b/super_editor/lib/src/super_textfield/ios/user_interaction.dart index e5963bed46..24edd2630f 100644 --- a/super_editor/lib/src/super_textfield/ios/user_interaction.dart +++ b/super_editor/lib/src/super_textfield/ios/user_interaction.dart @@ -536,7 +536,7 @@ class IOSTextFieldTouchInteractorState extends State with Ti RainbowBuilder(builder: (context, color) { return TextLayoutSelectionHighlight( textLayout: textLayout, - style: _primaryHighlightStyle.copyWith(color: color.withOpacity(0.2)), + style: _primaryHighlightStyle.copyWith(color: color.withValues(alpha: 0.2)), selection: const TextSelection(baseOffset: 11, extentOffset: 21), ); }), @@ -481,7 +481,7 @@ const _johnCaretStyle = CaretStyle( color: Colors.red, ); final _johnHighlightStyle = SelectionHighlightStyle( - color: Colors.red.withOpacity(0.5), + color: Colors.red.withValues(alpha: 0.5), ); const _johnUserLabelStyle = UserLabelStyle( color: Colors.red, @@ -499,7 +499,7 @@ const _sallyCaretStyle = CaretStyle( color: Colors.purpleAccent, ); final _sallyHighlightStyle = SelectionHighlightStyle( - color: Colors.purpleAccent.withOpacity(0.5), + color: Colors.purpleAccent.withValues(alpha: 0.5), ); const _sallyUserLabelStyle = UserLabelStyle( color: Colors.purpleAccent, diff --git a/super_text_layout/lib/src/caret_layer.dart b/super_text_layout/lib/src/caret_layer.dart index 10d532e20e..f9c3659d51 100644 --- a/super_text_layout/lib/src/caret_layer.dart +++ b/super_text_layout/lib/src/caret_layer.dart @@ -179,7 +179,7 @@ class CaretPainter extends CustomPainter { // update painter to support generic geometry _caretStyle.borderRadius.resolve(TextDirection.ltr).topLeft, ), - Paint()..color = _caretStyle.color.withOpacity(blinkController?.opacity ?? 1.0), + Paint()..color = _caretStyle.color.withValues(alpha: blinkController?.opacity ?? 1.0), ); } diff --git a/website/lib/homepage/header.dart b/website/lib/homepage/header.dart index 4bb68a3fb6..cee0be9ec3 100644 --- a/website/lib/homepage/header.dart +++ b/website/lib/homepage/header.dart @@ -88,7 +88,7 @@ class _DrawerLayoutState extends State { child: AnimatedContainer( duration: const Duration(milliseconds: 250), curve: Curves.ease, - color: Colors.black.withOpacity(_open ? 0.64 : 0), + color: Colors.black.withValues(alpha: _open ? 0.64 : 0), ), ), ), diff --git a/website/lib/homepage/home_page.dart b/website/lib/homepage/home_page.dart index 934bb6c1e6..de708ed504 100644 --- a/website/lib/homepage/home_page.dart +++ b/website/lib/homepage/home_page.dart @@ -99,7 +99,7 @@ class HomePage extends StatelessWidget { boxShadow: [ BoxShadow( offset: const Offset(0, 10), - color: Colors.black.withOpacity(0.79), + color: Colors.black.withValues(alpha: 0.79), blurRadius: 75, ), ], diff --git a/website/lib/homepage/inside_the_toolbox.dart b/website/lib/homepage/inside_the_toolbox.dart index 3687e6111c..4b3ede428e 100644 --- a/website/lib/homepage/inside_the_toolbox.dart +++ b/website/lib/homepage/inside_the_toolbox.dart @@ -387,7 +387,7 @@ class _TextRangeSelectorState extends State { height: widget.cellHeight, decoration: BoxDecoration( border: Border.all(color: _isSelected(index) ? Colors.tealAccent : Colors.grey), - color: _isSelected(index) ? Colors.tealAccent.withOpacity(0.7) : Colors.grey.withOpacity(0.7), + color: _isSelected(index) ? Colors.tealAccent.withValues(alpha: 0.7) : Colors.grey.withValues(alpha: 0.7), ), ), ), diff --git a/website/lib/infrastructure/super_editor_item_selector.dart b/website/lib/infrastructure/super_editor_item_selector.dart index bb0371780c..01995c009a 100644 --- a/website/lib/infrastructure/super_editor_item_selector.dart +++ b/website/lib/infrastructure/super_editor_item_selector.dart @@ -142,7 +142,7 @@ class _SuperEditorDemoTextItemSelectorState extends State