Created
August 2, 2022 09:19
-
-
Save AristideVB/3601aabd6dc77eb4b98792009edcea19 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | |
// for details. All rights reserved. Use of this source code is governed by a | |
// BSD-style license that can be found in the LICENSE file. | |
import 'package:flutter/material.dart'; | |
import 'dart:ui' as ui; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
debugShowCheckedModeBanner: false, | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
home: Scaffold(appBar: AppBar(), | |
body: Center(child: CustomPaint( | |
size: Size(500, (500*1).toDouble()), //You can Replace [WIDTH] with your desired width for Custom Paint and height will be calculated automatically | |
painter: RPSCustomPainter(), | |
),)), | |
); | |
} | |
} | |
//Add this CustomPaint widget to the Widget Tree | |
//Copy this CustomPainter code to the Bottom of the File | |
class RPSCustomPainter extends CustomPainter { | |
@override | |
void paint(Canvas canvas, Size size) { | |
Path path_0 = Path(); | |
path_0.moveTo(size.width*0.7794118,size.height*0.3823529); | |
path_0.cubicTo(size.width*0.7794118,size.height*0.5366676,size.width*0.6543147,size.height*0.6617647,size.width*0.5000000,size.height*0.6617647); | |
path_0.cubicTo(size.width*0.3456853,size.height*0.6617647,size.width*0.2205882,size.height*0.5366676,size.width*0.2205882,size.height*0.3823529); | |
path_0.cubicTo(size.width*0.2205882,size.height*0.2280382,size.width*0.3456853,size.height*0.1029412,size.width*0.5000000,size.height*0.1029412); | |
path_0.cubicTo(size.width*0.6543147,size.height*0.1029412,size.width*0.7794118,size.height*0.2280382,size.width*0.7794118,size.height*0.3823529); | |
path_0.close(); | |
Paint paint_0_fill = Paint()..style=PaintingStyle.fill; | |
paint_0_fill.color = Color(0xffFE343B).withOpacity(1.0); | |
canvas.drawPath(path_0,paint_0_fill); | |
Path path_1 = Path(); | |
path_1.moveTo(size.width*0.8235294,size.height*0.3823529); | |
path_1.cubicTo(size.width*0.8235294,size.height*0.5610338,size.width*0.6786809,size.height*0.7058824,size.width*0.5000000,size.height*0.7058824); | |
path_1.cubicTo(size.width*0.3213191,size.height*0.7058824,size.width*0.1764706,size.height*0.5610338,size.width*0.1764706,size.height*0.3823529); | |
path_1.cubicTo(size.width*0.1764706,size.height*0.2036721,size.width*0.3213191,size.height*0.05882353,size.width*0.5000000,size.height*0.05882353); | |
path_1.cubicTo(size.width*0.6786809,size.height*0.05882353,size.width*0.8235294,size.height*0.2036721,size.width*0.8235294,size.height*0.3823529); | |
path_1.close(); | |
path_1.moveTo(size.width*0.5000000,size.height*0.6617647); | |
path_1.cubicTo(size.width*0.6543147,size.height*0.6617647,size.width*0.7794118,size.height*0.5366676,size.width*0.7794118,size.height*0.3823529); | |
path_1.cubicTo(size.width*0.7794118,size.height*0.2280382,size.width*0.6543147,size.height*0.1029412,size.width*0.5000000,size.height*0.1029412); | |
path_1.cubicTo(size.width*0.3456853,size.height*0.1029412,size.width*0.2205882,size.height*0.2280382,size.width*0.2205882,size.height*0.3823529); | |
path_1.cubicTo(size.width*0.2205882,size.height*0.5366676,size.width*0.3456853,size.height*0.6617647,size.width*0.5000000,size.height*0.6617647); | |
path_1.close(); | |
Paint paint_1_fill = Paint()..style=PaintingStyle.fill; | |
paint_1_fill.color = Colors.white.withOpacity(1.0); | |
canvas.drawPath(path_1,paint_1_fill); | |
Path path_2 = Path(); | |
path_2.moveTo(size.width*0.4744868,size.height*0.2748265); | |
path_2.cubicTo(size.width*0.4744868,size.height*0.2616235,size.width*0.4639206,size.height*0.2509191,size.width*0.4508882,size.height*0.2509191); | |
path_2.cubicTo(size.width*0.4378544,size.height*0.2509191,size.width*0.4272882,size.height*0.2616235,size.width*0.4272882,size.height*0.2748265); | |
path_2.lineTo(size.width*0.4272882,size.height*0.3094662); | |
path_2.lineTo(size.width*0.4216324,size.height*0.3094662); | |
path_2.cubicTo(size.width*0.3979088,size.height*0.3094662,size.width*0.3786765,size.height*0.3289250,size.width*0.3786765,size.height*0.3529294); | |
path_2.cubicTo(size.width*0.3786765,size.height*0.3536912,size.width*0.3786956,size.height*0.3544471,size.width*0.3787338,size.height*0.3551985); | |
path_2.lineTo(size.width*0.3787338,size.height*0.3910868); | |
path_2.cubicTo(size.width*0.3787338,size.height*0.4236279,size.width*0.3915074,size.height*0.4548382,size.width*0.4142500,size.height*0.4778485); | |
path_2.cubicTo(size.width*0.4369912,size.height*0.5008588,size.width*0.4678353,size.height*0.5137868,size.width*0.4999971,size.height*0.5137868); | |
path_2.cubicTo(size.width*0.5321647,size.height*0.5137868,size.width*0.5630162,size.height*0.5008603,size.width*0.5857676,size.height*0.4778515); | |
path_2.cubicTo(size.width*0.6085191,size.height*0.4548426,size.width*0.6213074,size.height*0.4236338,size.width*0.6213235,size.height*0.3910868); | |
path_2.lineTo(size.width*0.6213235,size.height*0.3545971); | |
path_2.lineTo(size.width*0.6212353,size.height*0.3545971); | |
path_2.cubicTo(size.width*0.6212559,size.height*0.3540441,size.width*0.6212662,size.height*0.3534882,size.width*0.6212662,size.height*0.3529294); | |
path_2.cubicTo(size.width*0.6212662,size.height*0.3289250,size.width*0.6020353,size.height*0.3094662,size.width*0.5783103,size.height*0.3094662); | |
path_2.lineTo(size.width*0.5726529,size.height*0.3094662); | |
path_2.lineTo(size.width*0.5726529,size.height*0.2748265); | |
path_2.cubicTo(size.width*0.5726529,size.height*0.2616235,size.width*0.5620868,size.height*0.2509191,size.width*0.5490529,size.height*0.2509191); | |
path_2.cubicTo(size.width*0.5360191,size.height*0.2509191,size.width*0.5254544,size.height*0.2616235,size.width*0.5254544,size.height*0.2748265); | |
path_2.lineTo(size.width*0.5254544,size.height*0.3094662); | |
path_2.lineTo(size.width*0.4744868,size.height*0.3094662); | |
path_2.lineTo(size.width*0.4744868,size.height*0.2748265); | |
path_2.close(); | |
Paint paint_2_fill = Paint()..style=PaintingStyle.fill; | |
paint_2_fill.color = Colors.white.withOpacity(1.0); | |
canvas.drawPath(path_2,paint_2_fill); | |
} | |
@override | |
bool shouldRepaint(covariant CustomPainter oldDelegate) { | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment