Repository: flutter
Issue: Shader applies with opacity when the color is set with opacity for the Paint class fields.
Labels: framework,d: api docs,P2,team-framework,triaged-framework

When applying the Shader for the custom shape along with color value set with opacity using the [Paint](https://api.flutter.dev/flutter/dart-ui/Paint-class.html) class fields in the CustomPainter, the shader gets applied with the opacity set for color value field of the Paint class instance.

## Steps to Reproduce

<!-- Please include full steps to reproduce so that we can reproduce the problem. -->

1. Run the below sample code.
```
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
Widget build(BuildContext context) {
  return Scaffold(
    body: Center(
     child: Container(
      child: CustomPaint(
        painter: CustomShape(MediaQuery.of(context).size),
      )),
     )
  );
}
}

class CustomShape extends CustomPainter {
  final Size size;

  CustomShape(this.size);
  @override
  void paint(Canvas canvas, Size size) {
    const SweepGradient gradient = SweepGradient(
                    colors: <Color>[Colors.red, Colors.green],
                    stops: <double>[0.25, 0.75]);
    final Paint paint = Paint()
    // Set some color with opacity for the paint value.
    ..color = Colors.red.withOpacity(0.5)
    // Set the gradient shader too.
    ..shader = gradient.createShader(Rect.fromCircle(center: Offset(size.width/2, size.height/2), radius: 100));
    // Drawn a circle.
    canvas.drawCircle(Offset(size.width/2, size.height/2), 100, paint);
  }

  @override
  bool shouldRepaint(covariant CustomPainter oldDelegate) => true;

}
```
2. The circle will get rendered with gradient shader with the opacity set for the color value.

**Expected results:** 
![image](https://user-images.githubusercontent.com/63577117/202117646-81bde055-df09-4da2-9373-a37125360446.png)

**Actual results:** <!-- what did you see? -->
![image](https://user-images.githubusercontent.com/63577117/202117154-8a2caa86-b833-4278-b178-748f6c8f1f87.png)

<details>
  <summary>Logs</summary>

```
[√] Flutter (Channel stable, 3.3.7, on Microsoft Windows [Version 10.0.19043.2130], locale en-US)
    • Flutter version 3.3.7 on channel stable at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e99c9c7cd9 (2 weeks ago), 2022-11-01 16:59:00 -0700
    • Engine revision 857bd6b74c
    • Dart version 2.18.4
    • DevTools version 2.15.0

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) 
    • Platform android-33, build-tools 33.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java       
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2022 17.3.6)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
    • Visual Studio Build Tools 2022 version 17.3.32929.385
    • Windows 10 SDK version 10.0.20348.0

[√] Android Studio (version 2021.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[√] VS Code, 64-bit edition (version 1.73.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.50.0

[√] Connected device (4 available)
    • ASUS Z017DB (mobile)  • android-arm64  • Android 8.0.0 (API 26)
    • Windows (desktop)    • windows         • windows-x64    • Microsoft Windows [Version 10.0.19043.2130]
    • Chrome (web)         • chrome          • web-javascript • Google Chrome 107.0.5304.107
    • Edge (web)           • edge            • web-javascript • Microsoft Edge 107.0.1418.42

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
```

</details>