title: how to extend BorderSide to make gradient border
body: <p>I'm trying to add gradient to border by extending &quot;Border Side&quot; class as so:</p>
  <pre><code>class GradientBorderSide extends BorderSide {
    const GradientBorderSide(
        {this.color = const Color(0x00000000),
        this.width = 1.0,
        this.style = BorderStyle.solid,
        this.gradient =
            const LinearGradient(colors: [Colors.black, Colors.white])})
        : super(color: color, width: width, style: style);
  
    final Gradient gradient;
    final Color color;
    final double width;
    final BorderStyle style;
  
    @override
    Paint toPaint() {
      switch (style) {
        case BorderStyle.solid:
          return Paint()
            ..strokeWidth = width
            ..style = PaintingStyle.stroke
            ..shader = gradient.createShader(Rect.fromCenter(
                center: Offset.zero, width: width, height: width));
        case BorderStyle.none:
          return Paint()
            ..color = const Color(0x00000000)
            ..strokeWidth = 0.0
            ..style = PaintingStyle.stroke;
      }
      return null;
    }
  }
  </code></pre>
  <p>then apply it to a button:</p>
  <pre><code>SizedBox(
                    width: 75,
                    height: 75,
                    child: RaisedButton(
                      onPressed: () {},
                      shape: CircleBorder(
                        //borderRadius: BorderRadius.circular(5),
                        side: GradientBorderSide(
                            width: 10,
                            gradient: LinearGradient(
                              begin: Alignment.topLeft,
                              end: Alignment(0.5, .05),
                              colors: [Colors.red, Colors.orange],
                              tileMode: TileMode.repeated,
                            )),
                      ),
                    ),
                  )
  </code></pre>
  <p>the gradient appears good But when the button is pressed gradient disappears and border color shows if it has a color then gradient reappears.</p>