Skip to content

Commit

Permalink
Replace Color.withOpacity with Color.withValues (Resolves #2437) (#2458)
Browse files Browse the repository at this point in the history
  • Loading branch information
angelosilvestre authored Dec 20, 2024
1 parent e98f6b2 commit 16b4b21
Show file tree
Hide file tree
Showing 53 changed files with 92 additions and 89 deletions.
6 changes: 3 additions & 3 deletions super_editor/clones/quill/lib/deltas/deltas_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class _DeltasDisplayState extends State<DeltasDisplay> 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(),
),
Expand Down Expand Up @@ -133,7 +133,7 @@ class _DeltasDisplayState extends State<DeltasDisplay> 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,
Expand All @@ -150,7 +150,7 @@ class _DeltasDisplayState extends State<DeltasDisplay> 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,
Expand Down
6 changes: 3 additions & 3 deletions super_editor/clones/quill/lib/editor/toolbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class _IconSelectorState extends State<IconSelector> {
color: item == widget.selectedIcon
? toolbarButtonSelectedColor
: isActive
? Colors.grey.withOpacity(0.2)
? Colors.grey.withValues(alpha: 0.2)
: Colors.transparent,
),
child: InkWell(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class _TextItemSelectorState extends State<TextItemSelector> {
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,
),
Expand Down Expand Up @@ -188,7 +188,7 @@ class _TextItemSelectorState extends State<TextItemSelector> {
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,
Expand Down
2 changes: 1 addition & 1 deletion super_editor/example/lib/demos/demo_attributed_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ class _TextRangeSelectorState extends State<TextRangeSelector> {
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),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class _MobileEditingAndroidDemoState extends State<MobileEditingAndroidDemo> {
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),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class _MobileEditingIOSDemoState extends State<MobileEditingIOSDemo> 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),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ class _ExampleEditorState extends State<ExampleEditor> {
selectionStyle: isLight
? defaultSelectionStyle
: SelectionStyles(
selectionColor: Colors.red.withOpacity(0.3),
selectionColor: Colors.red.withValues(alpha: 0.3),
),
stylesheet: defaultStylesheet.copyWith(
addRulesAfter: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class _NativeIosContextMenuFeatureDemoState extends State<NativeIosContextMenuFe
editor: _editor,
documentLayoutKey: _documentLayoutKey,
selectionStyle: SelectionStyles(
selectionColor: Colors.red.withOpacity(0.3),
selectionColor: Colors.red.withValues(alpha: 0.3),
),
stylesheet: defaultStylesheet.copyWith(
addRulesAfter: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ class InTheLabScaffold extends StatelessWidget {
width: 250,
height: double.infinity,
decoration: BoxDecoration(
border: Border(left: BorderSide(color: Colors.white.withOpacity(0.1))),
border: Border(left: BorderSide(color: Colors.white.withValues(alpha: 0.1))),
),
child: Stack(
children: [
Center(
child: Icon(
Icons.biotech,
color: Colors.white.withOpacity(0.05),
color: Colors.white.withValues(alpha: 0.05),
size: 84,
),
),
Expand Down Expand Up @@ -125,14 +125,14 @@ class InTheLabScaffold extends StatelessWidget {
width: double.infinity,
height: 200,
decoration: BoxDecoration(
border: Border(top: BorderSide(color: Colors.white.withOpacity(0.1))),
border: Border(top: BorderSide(color: Colors.white.withValues(alpha: 0.1))),
),
child: Stack(
children: [
Center(
child: Icon(
Icons.biotech,
color: Colors.white.withOpacity(0.05),
color: Colors.white.withValues(alpha: 0.05),
size: 84,
),
),
Expand Down
6 changes: 3 additions & 3 deletions super_editor/example/lib/demos/in_the_lab/popover_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class _PopoverListState extends State<PopoverList> {
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),
Expand All @@ -209,7 +209,7 @@ class _PopoverListState extends State<PopoverList> {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Divider(
color: Colors.white.withOpacity(0.2),
color: Colors.white.withValues(alpha: 0.2),
height: 1,
),
),
Expand All @@ -229,7 +229,7 @@ class _PopoverListState extends State<PopoverList> {
"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,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class _SelectedTextColorsDemoState extends State<SelectedTextColorsDemo> {
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)),
],
),
),
Expand Down Expand Up @@ -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)),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class _SuperEditorDemoTextItemSelectorState extends State<SuperEditorDemoTextIte
Widget _buildPopoverListItem(BuildContext context, SuperEditorDemoTextItem 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,
Expand Down Expand Up @@ -303,7 +303,7 @@ class _SuperEditorDemoIconItemSelectorState extends State<SuperEditorDemoIconIte
Widget _buildItem(BuildContext context, SuperEditorDemoIconItem 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ class SpotCheckScaffold extends StatelessWidget {
width: 250,
height: double.infinity,
decoration: BoxDecoration(
border: Border(left: BorderSide(color: Colors.white.withOpacity(0.1))),
border: Border(left: BorderSide(color: Colors.white.withValues(alpha: 0.1))),
),
child: Stack(
children: [
Center(
child: Icon(
Icons.biotech,
color: Colors.white.withOpacity(0.05),
color: Colors.white.withValues(alpha: 0.05),
size: 84,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ class _ToolbarFollowingContentInLayerState extends State<ToolbarFollowingContent
height: 12,
width: _baseContentWidth + (2 * expansionExtent) + 2, // +2 for border
decoration: BoxDecoration(
border: Border.all(color: Colors.white.withOpacity(0.1)),
border: Border.all(color: Colors.white.withValues(alpha: 0.1)),
),
child: Align(
alignment: Alignment.centerLeft,
child: Container(
key: _leaderBoundsKey,
width: _baseContentWidth + expansionExtent,
height: 10,
color: Colors.white.withOpacity(0.2),
color: Colors.white.withValues(alpha: 0.2),
),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class _MobileChatDemoState extends State<MobileChatDemo> {
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),
),
Expand Down Expand Up @@ -197,7 +197,7 @@ class _MobileChatDemoState extends State<MobileChatDemo> {
),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.075),
color: Colors.black.withValues(alpha: 0.075),
blurRadius: 8,
spreadRadius: 4,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class _TaskAndChatWithCustomScrollViewDemoState extends State<TaskAndChatWithCus
BoxShadow(
offset: const Offset(0, 5),
blurRadius: 5,
color: Colors.black.withOpacity(0.4),
color: Colors.black.withValues(alpha: 0.4),
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion super_editor/example/lib/demos/sliver_example_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class _SliverExampleEditorState extends State<SliverExampleEditor> {
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class _InteractiveTextFieldDemoState extends State<InteractiveTextFieldDemo> {
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),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class _SuperAndroidTextFieldDemoState extends State<SuperAndroidTextFieldDemo> {
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class _SuperIOSTextFieldDemoState extends State<SuperIOSTextFieldDemo> {
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,
Expand Down
2 changes: 1 addition & 1 deletion super_editor/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion super_editor/example/lib/main_super_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
Expand Down
2 changes: 1 addition & 1 deletion super_editor/example_docs/lib/app_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class _DocsAppMenuState extends State<DocsAppMenu> {
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class _IconSelectorState extends State<IconSelector> {
color: item == widget.selectedIcon
? toolbarButtonSelectedColor
: isActive
? Colors.grey.withOpacity(0.2)
? Colors.grey.withValues(alpha: 0.2)
: Colors.transparent,
),
child: InkWell(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class _TextItemSelectorState extends State<TextItemSelector> {
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,
),
Expand Down Expand Up @@ -185,7 +185,7 @@ class _TextItemSelectorState extends State<TextItemSelector> {
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,
Expand Down
Loading

0 comments on commit 16b4b21

Please sign in to comment.