Hourglass improved + projects delete

This commit is contained in:
Sewmina
2022-03-23 19:30:32 +05:30
parent aa72b5dc92
commit 9f976b1e33
7 changed files with 145 additions and 44 deletions

View File

@@ -2,6 +2,7 @@
import 'dart:math';
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
class HourglassPainter extends CustomPainter{
double fillAmount =0;
@@ -29,6 +30,12 @@ class HourglassPainter extends CustomPainter{
..strokeWidth=5
// ..shader=ui.Gradient.linear(Offset(0,0), Offset(100,100), [Colors.green, Colors.amber, Colors.blue])
..style=PaintingStyle.stroke;
final outlinePainter2 = Paint()
..color=Colors.amber
..strokeCap=StrokeCap.round
..strokeWidth=8
// ..shader=ui.Gradient.linear(Offset(0,0), Offset(100,100), [Colors.green, Colors.amber, Colors.blue])
..style=PaintingStyle.stroke;
final contentPainter = Paint()
..color=Colors.brown
..strokeCap=StrokeCap.round
@@ -85,11 +92,10 @@ class HourglassPainter extends CustomPainter{
fallingSand.close();
final gradient = ui.Gradient.linear(
Offset(size.width/2, bottomStartHeight),
Offset(size.width/2, bottomEndHeight),
Offset(size.width/2, size.height * 0.9),
Offset(size.width/2, bottomEndHeight + size.height *0.07),
colors,
colorStops);
final bottomContentPainter = Paint()
..shader=gradient
..style=PaintingStyle.fill
@@ -101,8 +107,8 @@ class HourglassPainter extends CustomPainter{
canvas.drawPath(topContent, contentPainter);
canvas.drawPath(bottomContent, bottomContentPainter);
canvas.drawPath(outline, outlinePainter);
canvas.drawLine(Offset(0,0),Offset(size.width,0),outlinePainter);
canvas.drawLine(Offset(0,size.height),Offset(size.width,size.height),outlinePainter);
canvas.drawLine(Offset(0,0),Offset(size.width,0),outlinePainter2);
canvas.drawLine(Offset(0,size.height),Offset(size.width,size.height),outlinePainter2);
}
double getTopContentWidthOffset(double width,double height,double fullHeight, double inset){