progress in new goal planner

This commit is contained in:
Kima 2024-05-22 22:25:40 +02:00
parent 855e48aea8
commit c016258fb9
2 changed files with 43 additions and 15 deletions

View File

@ -1,13 +1,22 @@
import 'package:dotted_border/dotted_border.dart';
import 'package:refilc/theme/colors/colors.dart';
import 'package:refilc/ui/widgets/grade/grade_tile.dart';
import 'package:flutter/material.dart';
import 'package:i18n_extension/i18n_extension.dart';
class AverageDisplay extends StatelessWidget {
const AverageDisplay({super.key, this.average = 0.0, this.border = false});
const AverageDisplay({
super.key,
this.average = 0.0,
this.border = false,
this.dashed = false,
this.scale = 1.0,
});
final double average;
final bool border;
final bool dashed;
final double scale;
@override
Widget build(BuildContext context) {
@ -20,25 +29,44 @@ class AverageDisplay extends StatelessWidget {
averageText = averageText.replaceAll(".", ",");
}
Widget txtWidget = Text(
average == 0.0 ? "-" : averageText,
textAlign: TextAlign.center,
style: TextStyle(
color: color, fontWeight: FontWeight.w600, fontSize: scale * 15.0),
maxLines: 1,
);
return Container(
width: border ? 57.0 : 54.0,
padding: EdgeInsets.symmetric(
horizontal: 6.0 - (border ? 2 : 0), vertical: 5.0 - (border ? 2 : 0)),
width: (border ? 57.0 : 54.0) * scale,
padding: (border && dashed)
? null
: EdgeInsets.symmetric(
horizontal: (6.0 - (border ? 2 : 0)) * scale,
vertical: (5.0 - (border ? 2 : 0))) *
scale,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(45.0),
border: border
borderRadius:
(border && dashed) ? null : BorderRadius.circular(45.0 * scale),
border: border && !dashed
? Border.fromBorderSide(
BorderSide(color: color.withOpacity(.5), width: 1.0))
BorderSide(color: color.withOpacity(.5), width: 1.0 * scale))
: null,
color: !border ? color.withOpacity(average == 0.0 ? .15 : .25) : null,
),
child: Text(
average == 0.0 ? "-" : averageText,
textAlign: TextAlign.center,
style: TextStyle(
color: color, fontWeight: FontWeight.w600, fontSize: 15.0),
maxLines: 1,
),
child: (border && dashed)
? DottedBorder(
strokeWidth: 1.0 * scale,
padding: EdgeInsets.all(4.0 * scale),
color: color.withOpacity(.5),
dashPattern: const [6, 6],
radius: Radius.circular(45.0 * scale),
borderType: BorderType.RRect,
child: Center(
child: txtWidget,
),
)
: txtWidget,
);
}
}

@ -1 +1 @@
Subproject commit b470466b79ef1ed7b18701c157a8bd37488c947d
Subproject commit 3df07a00c2e7fa4039e036c061c91fac0baa9ad8