Created
January 14, 2020 01:57
-
-
Save diegoveloper/bcedfd5ef2c4e531ad3f061e016bc5da to your computer and use it in GitHub Desktop.
Painting over image
This file contains hidden or 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
import 'package:flutter/material.dart'; | |
final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue), | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
body: Center( | |
child: MyWidget(), | |
), | |
), | |
); | |
} | |
} | |
class MyWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Center( | |
child: CustomPaint( | |
foregroundPainter: MyPainter(), | |
child: Image.network("https://www.alfabetajuega.com/wp-content/uploads/2019/11/dragon-ball-goku-aura-770x436.jpg", fit: BoxFit.cover), | |
),); | |
} | |
} | |
class MyPainter extends CustomPainter { | |
void paint(Canvas canvas, Size size){ | |
canvas.drawCircle(Offset(size.width/2, size.height/2), size.width/4, Paint()); | |
} | |
bool shouldRepaint (MyPainter old) => true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment