Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 52 additions & 32 deletions lib/widgets/buttons/neopop_button/neopop_button_clippers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ class RBottomCenterClipper extends CustomClipper<Path> {
final double depth;
@override
Path getClip(Size size) => Path()
..moveTo(0, 0)
..lineTo(0, size.height + depth)
..lineTo(size.width + depth, size.height + depth)
..lineTo(size.width, size.height)
..lineTo(size.width, 0)
..close();
..addPolygon(
[
Offset.zero,
Offset(0, size.height + depth),
Offset(size.width + depth, size.height + depth),
Offset(size.width, size.height),
Offset(size.width, 0),
],
true,
);

@override
bool shouldReclip(covariant CustomClipper oldClipper) => false;
Expand All @@ -31,13 +35,17 @@ class RBottomRightClipper extends CustomClipper<Path> {
final double depth;
@override
Path getClip(Size size) => Path()
..moveTo(0, 0)
..lineTo(0, size.height)
..lineTo(0 + depth, size.height + depth)
..lineTo(size.width + depth, size.height + depth)
..lineTo(size.width + depth, depth)
..lineTo(size.width, 0)
..close();
..addPolygon(
[
Offset.zero,
Offset(0, size.height),
Offset(0 + depth, size.height + depth),
Offset(size.width + depth, size.height + depth),
Offset(size.width + depth, depth),
Offset(size.width, 0),
],
true,
);

@override
bool shouldReclip(covariant CustomClipper oldClipper) => false;
Expand All @@ -49,13 +57,17 @@ class RBottomLeftClipper extends CustomClipper<Path> {
final double depth;
@override
Path getClip(Size size) => Path()
..moveTo(0, 0)
..lineTo(0, size.height)
..lineTo(0 + depth, size.height + depth)
..lineTo(size.width + depth, size.height + depth)
..lineTo(size.width, size.height)
..lineTo(size.width, 0)
..close();
..addPolygon(
[
Offset.zero,
Offset(0, size.height),
Offset(0 + depth, size.height + depth),
Offset(size.width + depth, size.height + depth),
Offset(size.width, size.height),
Offset(size.width, 0),
],
true,
);

@override
bool shouldReclip(covariant CustomClipper oldClipper) => false;
Expand All @@ -69,13 +81,17 @@ class RTopRightClipper extends CustomClipper<Path> {

@override
Path getClip(Size size) => Path()
..moveTo(0, 0)
..lineTo(0, size.height)
..lineTo(size.width, size.height)
..lineTo(size.width + depth, size.height + depth)
..lineTo(size.width + depth, depth)
..lineTo(size.width, 0)
..close();
..addPolygon(
[
Offset.zero,
Offset(0, size.height),
Offset(size.width, size.height),
Offset(size.width + depth, size.height + depth),
Offset(size.width + depth, depth),
Offset(size.width, 0),
],
true,
);

@override
bool shouldReclip(covariant CustomClipper oldClipper) => false;
Expand All @@ -89,11 +105,15 @@ class CenterClipper extends CustomClipper<Path> {

@override
Path getClip(Size size) => Path()
..moveTo(0, 0)
..lineTo(0, size.height)
..lineTo(size.width, size.height)
..lineTo(size.width, 0)
..close();
..addPolygon(
[
Offset.zero,
Offset(0, size.height),
Offset(size.width, size.height),
Offset(size.width, 0),
],
true,
);

@override
bool shouldReclip(covariant CustomClipper oldClipper) => false;
Expand Down
49 changes: 33 additions & 16 deletions lib/widgets/buttons/neopop_button/neopop_button_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@ class NeoPopButtonPainter extends CustomPainter {
if (right != Colors.transparent) {
canvas.drawPath(
Path()
..moveTo(size.width, 0)
..lineTo(size.width + depth, depth)
..lineTo(size.width + depth, size.height + depth)
..lineTo(size.width, size.height),
..addPolygon(
[
Offset(size.width, 0),
Offset(size.width + depth, depth),
Offset(size.width + depth, size.height + depth),
Offset(size.width, size.height),
],
true,
),
Paint()
..style = PaintingStyle.fill
..color = right
Expand All @@ -54,10 +59,15 @@ class NeoPopButtonPainter extends CustomPainter {
if (left != Colors.transparent) {
canvas.drawPath(
Path()
..moveTo(0, 0)
..lineTo(-depth, -depth)
..lineTo(-depth, size.height - depth)
..lineTo(0, size.height),
..addPolygon(
[
Offset.zero,
Offset(-depth, -depth),
Offset(-depth, size.height - depth),
Offset(0, size.height),
],
true,
),
Paint()
..style = PaintingStyle.fill
..color = left
Expand All @@ -69,10 +79,15 @@ class NeoPopButtonPainter extends CustomPainter {
if (bottom != Colors.transparent) {
canvas.drawPath(
Path()
..moveTo(size.width, size.height)
..lineTo(size.width + depth, size.height + depth)
..lineTo(0 + depth, size.height + depth)
..lineTo(0, size.height),
..addPolygon(
[
Offset(size.width, size.height),
Offset(size.width + depth, size.height + depth),
Offset(depth, size.height + depth),
Offset(0, size.height),
],
true,
),
Paint()
..style = PaintingStyle.fill
..color = bottom
Expand All @@ -84,10 +99,12 @@ class NeoPopButtonPainter extends CustomPainter {
if (top != Colors.transparent) {
canvas.drawPath(
Path()
..moveTo(0, 0)
..lineTo(-depth, -depth)
..lineTo(size.width - depth, -depth)
..lineTo(size.width, 0),
..addPolygon([
Offset.zero,
Offset(-depth, -depth),
Offset(size.width - depth, -depth),
Offset(size.width, 0),
], true),
Paint()
..style = PaintingStyle.fill
..color = top
Expand Down
2 changes: 2 additions & 0 deletions lib/widgets/cards/neopop_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// You may obtain a copy of the License in the LICENSE file or at
// http://www.apache.org/licenses/LICENSE-2.0

import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:neopop/utils/color_utils.dart';
import 'package:neopop/utils/constants.dart';
Expand Down
26 changes: 18 additions & 8 deletions lib/widgets/cards/neopop_card_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ class NeoPopCardPainter extends CustomPainter {
canvas
..drawPath(
Path()
..moveTo(size.width, 0)
..lineTo(size.width + depth, depth)
..lineTo(size.width + depth, size.height + depth)
..lineTo(size.width, size.height),
..addPolygon(
[
Offset(size.width, 0),
Offset(size.width + depth, depth),
Offset(size.width + depth, size.height + depth),
Offset(size.width, size.height),
],
true,
),
Paint()
..style = PaintingStyle.fill
..color = hShadowColor ?? Colors.transparent
Expand All @@ -40,10 +45,15 @@ class NeoPopCardPainter extends CustomPainter {
// bottom shadow
..drawPath(
Path()
..moveTo(size.width, size.height)
..lineTo(size.width + depth, size.height + depth)
..lineTo(0 + depth, size.height + depth)
..lineTo(0, size.height),
..addPolygon(
[
Offset(size.width, size.height),
Offset(size.width + depth, size.height + depth),
Offset(0 + depth, size.height + depth),
Offset(0, size.height),
],
true,
),
Paint()
..style = PaintingStyle.fill
..color = vShadowColor ?? Colors.transparent
Expand Down
62 changes: 37 additions & 25 deletions lib/widgets/shimmer/shimmer_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ class ShimmerPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
final smallShimmerWidth = shimmerWidth / 2;
final double x = (size.width +
(2 * shimmerWidth) +
shimmerGapWidth +
smallShimmerWidth) *
offset;
final double x = (size.width + (2 * shimmerWidth) + shimmerGapWidth + smallShimmerWidth) * offset;
final double y = size.height;

if (!isTiltedLeft) {
Expand All @@ -55,21 +51,29 @@ class ShimmerPainter extends CustomPainter {

canvas.drawPath(
Path()
..moveTo(x1, y)
..lineTo(x2, 0)
..lineTo(x3, 0)
..lineTo(x4, y)
..close(),
..addPolygon(
[
Offset(x1, y),
Offset(x2, 0),
Offset(x3, 0),
Offset(x4, y),
],
true,
),
Paint()..color = shimmerColor,
);

canvas.drawPath(
Path()
..moveTo(x5, y)
..lineTo(x6, 0)
..lineTo(x7, 0)
..lineTo(x8, y)
..close(),
..addPolygon(
[
Offset(x5, y),
Offset(x6, 0),
Offset(x7, 0),
Offset(x8, y),
],
true,
),
Paint()..color = shimmerColor,
);
} else {
Expand All @@ -85,21 +89,29 @@ class ShimmerPainter extends CustomPainter {

canvas.drawPath(
Path()
..moveTo(x1, y)
..lineTo(x2, 0)
..lineTo(x3, 0)
..lineTo(x4, y)
..close(),
..addPolygon(
[
Offset(x1, y),
Offset(x2, 0),
Offset(x3, 0),
Offset(x4, y),
],
true,
),
Paint()..color = shimmerColor,
);

canvas.drawPath(
Path()
..moveTo(x5, y)
..lineTo(x6, 0)
..lineTo(x7, 0)
..lineTo(x8, y)
..close(),
..addPolygon(
[
Offset(x5, y),
Offset(x6, 0),
Offset(x7, 0),
Offset(x8, y),
],
true,
),
Paint()..color = shimmerColor,
);
}
Expand Down