Clippath works for one Example

This commit is contained in:
Niklas 2024-11-29 21:31:23 +01:00
parent 731f786057
commit 3e92781bce
5 changed files with 63 additions and 2 deletions

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

View File

@ -1,3 +1,4 @@
import 'package:Emma_home/utils/clipper.dart';
import 'package:flutter/material.dart';
import 'package:Emma_home/utils/helper_functions.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
@ -231,7 +232,7 @@ class EventCard2Section extends StatelessWidget {
),
child: Stack(
children: [
Positioned(
/* Positioned(
right: 0,
top: 0,
child: Image.asset(
@ -239,7 +240,20 @@ class EventCard2Section extends StatelessWidget {
height: 110, // Höhe des Bildes
width: 130, // Breite des Bildes
),
),
), */
Positioned(
right: 0,
top: 0,
child: ClipPath(
clipper: MyClipper(),
child: Image.asset(
'assets/images/Event_Images/unsplash_MxfcoxycH_Y.png', // Pfad zum Bild
height: 110, // Höhe des Bildes
width: 130, // Breite des Bildes
fit: BoxFit.cover,
),
)),
//Bookmark Button
Positioned(
// Bookmark Button

37
lib/utils/clipper.dart Normal file
View File

@ -0,0 +1,37 @@
import 'package:flutter/material.dart';
class MyClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
Paint paint = Paint();
Path path = Path();
// Path number 1
path = Path();
path.lineTo(size.width * 0.05, size.height * 0.3);
path.cubicTo(-0.03, size.height * 0.18, size.width * 0.02,
size.height * 0.05, size.width * 0.05, 0);
path.cubicTo(
size.width * 0.05, 0, size.width * 0.92, 0, size.width * 0.92, 0);
path.cubicTo(size.width, 0, size.width, size.height * 0.05, size.width,
size.height * 0.07);
path.cubicTo(size.width, size.height * 0.07, size.width, size.height * 0.91,
size.width, size.height * 0.91);
path.cubicTo(size.width, size.height, size.width * 0.94, size.height,
size.width * 0.9, size.height);
path.cubicTo(size.width * 0.9, size.height, size.width * 0.05, size.height,
size.width * 0.05, size.height);
path.cubicTo(size.width * 0.1, size.height * 0.95, size.width * 0.07,
size.height * 0.87, size.width * 0.05, size.height * 0.84);
path.cubicTo(-0.02, size.height * 0.76, size.width * 0.02,
size.height * 0.63, size.width * 0.05, size.height * 0.58);
path.cubicTo(size.width * 0.13, size.height * 0.45, size.width * 0.09,
size.height * 0.34, size.width * 0.05, size.height * 0.3);
path.cubicTo(size.width * 0.05, size.height * 0.3, size.width * 0.05,
size.height * 0.3, size.width * 0.05, size.height * 0.3);
return path;
}
@override
bool shouldReclip(CustomClipper<Path> oldClipper) => false;
}

View File

@ -72,6 +72,7 @@ flutter:
assets:
- assets/images/
- assets/images/Icons/
- assets/images/Event_Images/
- .env.local
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware