Merge branch 'master' of https://git.mokkon.com/sainw/fcs
This commit is contained in:
@@ -1,37 +1,33 @@
|
||||
import 'dart:math';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DimensionBox extends StatelessWidget {
|
||||
class Dimension {
|
||||
final double length;
|
||||
final double width;
|
||||
final double height;
|
||||
|
||||
DimensionBox({
|
||||
Key key,
|
||||
this.length,
|
||||
this.width,
|
||||
this.height,
|
||||
}) : super(key: key);
|
||||
Dimension(this.length, this.width, this.height);
|
||||
}
|
||||
|
||||
class DimensionBox extends StatelessWidget {
|
||||
final Dimension dimension;
|
||||
final Color color;
|
||||
DimensionBox({Key key, this.dimension, this.color}) : super(key: key);
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return CustomPaint(
|
||||
size: Size.infinite,
|
||||
painter:
|
||||
DimensionBoxPainter(length: length, width: width, height: height),
|
||||
painter: DimensionBoxPainter(dimension: dimension, color: color),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class DimensionBoxPainter extends CustomPainter {
|
||||
final double avatarRadius = 10;
|
||||
final double length;
|
||||
final double width;
|
||||
final double height;
|
||||
final Dimension dimension;
|
||||
final Color color;
|
||||
|
||||
DimensionBoxPainter({this.length, this.width, this.height});
|
||||
|
||||
//3
|
||||
final Color color = Colors.blueAccent;
|
||||
DimensionBoxPainter({this.color, this.dimension});
|
||||
|
||||
//4
|
||||
@override
|
||||
@@ -52,13 +48,13 @@ class DimensionBoxPainter extends CustomPainter {
|
||||
);
|
||||
// _drawCurvedShape(canvas, curvedShapeBounds, avatarBounds);
|
||||
|
||||
_drawCube(
|
||||
canvas, shapeBounds, length * 10, width * 10, height * 10, Colors.teal);
|
||||
_drawCube(canvas, shapeBounds, dimension.length * 10, dimension.width * 10,
|
||||
dimension.height * 10, color);
|
||||
}
|
||||
|
||||
void _drawBackground(Canvas canvas, Rect shapeBounds, Rect avatarBounds) {
|
||||
//1
|
||||
final paint = Paint()..color = Colors.amberAccent;
|
||||
final paint = Paint()..color = color;
|
||||
|
||||
//2
|
||||
final backgroundPath = Path()
|
||||
@@ -125,12 +121,12 @@ class DimensionBoxPainter extends CustomPainter {
|
||||
..close();
|
||||
canvas.drawPath(topFacePath, paintTop);
|
||||
|
||||
_drawText("length\n${length.toInt()}\"", canvas,
|
||||
_drawText("length\n${dimension.length.toInt()}\"", canvas,
|
||||
shapeBounds.bottomCenter.dx - 100, shapeBounds.bottomCenter.dy - 40);
|
||||
_drawText("width\n${width.toInt()}\"", canvas,
|
||||
_drawText("width\n${dimension.width.toInt()}\"", canvas,
|
||||
shapeBounds.bottomCenter.dx + 100, shapeBounds.bottomCenter.dy - 40);
|
||||
_drawText(
|
||||
"height\n${height.toInt()}\"",
|
||||
"height\n${dimension.height.toInt()}\"",
|
||||
canvas,
|
||||
shapeBounds.bottomCenter.dx,
|
||||
shapeBounds.bottomCenter.dy - (h > 30 ? h / 2 : h) * 1.2);
|
||||
|
||||
Reference in New Issue
Block a user