This repository has been archived on 2025-06-12. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Temperaturdecke/lib/widgets/daily_blob.dart
2024-05-17 23:46:30 +02:00

140 lines
4.4 KiB
Dart

import 'package:blobs/blobs.dart';
import 'package:dynamic_color/dynamic_color.dart';
import 'package:flutter/material.dart';
class Dailyblob extends StatelessWidget {
Dailyblob(this.temperatur, {super.key});
int temperatur;
Color mainColor = Color.fromARGB(255, 233, 125, 224);
@override
Widget build(BuildContext context) {
Color blobColor = mainColor.harmonizeWith(Theme.of(context).canvasColor);
Color grad1 = Color.fromARGB(
blobColor.alpha,
(blobColor.red * 0.85).round(),
(blobColor.green * 0.85).round(),
(blobColor.blue * 0.85).round(),
);
return Stack(
alignment: AlignmentDirectional.center,
children: [
Blob.animatedFromID(
loop: true,
duration: Duration(milliseconds: 1300),
size: 365,
styles: BlobStyles(
color: Color.fromARGB(
blobColor.alpha,
(blobColor.red * 0.8).round(),
(blobColor.green * 0.8).round(),
(blobColor.blue * 0.8).round(),
).harmonizeWith(blobColor)),
id: [
'6-9-12903',
'6-9-438',
'6-9-9807',
'6-9-18',
'6-9-9260',
'6-9-12903',
'6-9-17311',
],
),
Blob.animatedFromID(
loop: true,
duration: Duration(milliseconds: 1000),
size: 355,
styles: BlobStyles(
color: Color.fromARGB(
blobColor.alpha,
(blobColor.red * 0.9).round(),
(blobColor.green * 0.9).round(),
(blobColor.blue * 0.9).round(),
).harmonizeWith(blobColor)),
id: const [
'6-9-438',
'6-9-9807',
'6-9-18',
'6-9-9260',
'6-9-12903',
'6-9-17311'
],
),
Blob.animatedFromID(
loop: true,
duration: Duration(milliseconds: 1500),
size: 340,
styles: BlobStyles(color: blobColor),
id: const [
'6-9-17311',
'6-9-438',
'6-9-9807',
'6-9-18',
'6-9-9260',
'6-9-12903',
],
),
Column(
children: [
ShaderMask(
blendMode: BlendMode.srcIn,
shaderCallback: (Rect bounds) {
return LinearGradient(
colors: blobColor.computeLuminance() > 0.1
? [
Color.fromARGB(
blobColor.alpha,
(blobColor.red * 0.35).round(),
(blobColor.green * 0.35).round(),
(blobColor.blue * 0.35).round(),
),
Color.fromARGB(
blobColor.alpha,
(blobColor.red * 0.5).round(),
(blobColor.green * 0.5).round(),
(blobColor.blue * 0.5).round(),
)
]
: [
Color.fromARGB(
blobColor.alpha,
(blobColor.red * 2.2).round(),
(blobColor.green * 2.2).round(),
(blobColor.blue * 2.2).round(),
),
Color.fromARGB(
blobColor.alpha,
(blobColor.red * 1.8).round(),
(blobColor.green * 1.8).round(),
(blobColor.blue * 1.8).round(),
),
],
).createShader(bounds);
},
child: Column(
children: [
Text(
"$temperatur °C",
style: TextStyle(
height: 1,
fontSize: 25,
fontWeight: FontWeight.w600,
),
),
Text(
"Farbe",
style: TextStyle(
fontSize: 45,
fontWeight: FontWeight.w800,
),
)
],
)),
],
),
],
);
}
}