📝 替换项目中的所有var

This commit is contained in:
toly
2020-10-21 16:06:38 +08:00
parent b837084305
commit 07a97df5b2
159 changed files with 405 additions and 417 deletions

View File

@@ -74,15 +74,15 @@ class CornerCustomMultiChildLayout extends MultiChildLayoutDelegate{
positionChild(CornerType.topLeft, Offset.zero.translate(padding.left, padding.top));
}
if (hasChild(CornerType.topRight)) {
var childSize = layoutChild(CornerType.topRight, BoxConstraints.loose(size));
Size childSize = layoutChild(CornerType.topRight, BoxConstraints.loose(size));
positionChild(CornerType.topRight, Offset(size.width-childSize.width,0).translate(-padding.right, padding.top));
}
if (hasChild(CornerType.bottomLeft)) {
var childSize = layoutChild(CornerType.bottomLeft, BoxConstraints.loose(size));
Size childSize = layoutChild(CornerType.bottomLeft, BoxConstraints.loose(size));
positionChild(CornerType.bottomLeft, Offset(0,size.height-childSize.height).translate(padding.left, -padding.bottom));
}
if (hasChild(CornerType.bottomRight)) {
var childSize = layoutChild(CornerType.bottomRight, BoxConstraints.loose(size));
Size childSize = layoutChild(CornerType.bottomRight, BoxConstraints.loose(size));
positionChild(CornerType.bottomRight, Offset(size.width-childSize.width,size.height-childSize.height).translate(-padding.right, -padding.bottom));
}
}

View File

@@ -10,30 +10,30 @@ class PlayFlex extends StatefulWidget {
}
class _PlayFlexState extends State<PlayFlex> {
final redBox = Container(
final Widget redBox = Container(
color: Colors.red,
height: 50,
width: 50,
);
final blueBox = Container(
final Widget blueBox = Container(
color: Colors.blue,
width: 60,
height: 60,
);
final yellowBox = Container(
final Widget yellowBox = Container(
color: Colors.yellow,
height: 10,
width: 10,
);
final greenBox = Container(
final Widget greenBox = Container(
color: Colors.green,
height: 30,
width: 20,
);
var _direction = Axis.horizontal;
var _mainAxisAlignment = MainAxisAlignment.start;
var _crossAxisAlignment = CrossAxisAlignment.center;
var _verticalDirection = VerticalDirection.up;
Axis _direction = Axis.horizontal;
MainAxisAlignment _mainAxisAlignment = MainAxisAlignment.start;
CrossAxisAlignment _crossAxisAlignment = CrossAxisAlignment.center;
VerticalDirection _verticalDirection = VerticalDirection.up;
@override
Widget build(BuildContext context) {

View File

@@ -40,14 +40,14 @@ class _CircleFlowDelegate extends FlowDelegate {
void paintChildren(FlowPaintingContext context) {
double radius = context.size.shortestSide / 2;
print(context.getChildSize(0));
var count = context.childCount;
var perRad = 2 * pi / count;
int count = context.childCount;
double perRad = 2 * pi / count;
for (int i = 0; i < count; i++) {
var cSizeX = context.getChildSize(i).width / 2;
var cSizeY = context.getChildSize(i).height / 2;
double cSizeX = context.getChildSize(i).width / 2;
double cSizeY = context.getChildSize(i).height / 2;
var offsetX = (radius - cSizeX) * cos(i * perRad) + radius;
var offsetY = (radius - cSizeY) * sin(i * perRad) + radius;
double offsetX = (radius - cSizeX) * cos(i * perRad) + radius;
double offsetY = (radius - cSizeY) * sin(i * perRad) + radius;
context.paintChild(i,
transform: Matrix4.translationValues(
offsetX - cSizeX, offsetY - cSizeY, 0.0));

View File

@@ -90,14 +90,14 @@ class _BurstFlowDelegate extends FlowDelegate {
@override //绘制孩子的方法
void paintChildren(FlowPaintingContext context) {
double radius = context.size.shortestSide / 2;
var count = context.childCount - 1;
var perRad = 2 * pi / count;
int count = context.childCount - 1;
double perRad = 2 * pi / count;
for (int i = 0; i < count; i++) {
print(i);
var cSizeX = context.getChildSize(i).width / 2;
var cSizeY = context.getChildSize(i).height / 2;
var offsetX = rad * (radius - cSizeX) * cos(i * perRad) + radius;
var offsetY = rad * (radius - cSizeY) * sin(i * perRad) + radius;
double cSizeX = context.getChildSize(i).width / 2;
double cSizeY = context.getChildSize(i).height / 2;
double offsetX = rad * (radius - cSizeX) * cos(i * perRad) + radius;
double offsetY = rad * (radius - cSizeY) * sin(i * perRad) + radius;
context.paintChild(i,
transform: Matrix4.translationValues(
offsetX - cSizeX, offsetY - cSizeY, 0.0));

View File

@@ -19,7 +19,7 @@ class CustomIndexedStack extends StatefulWidget {
}
class _CustomIndexedStackState extends State<CustomIndexedStack> {
var _index = 1;
int _index = 1;
@override
Widget build(BuildContext context) {

View File

@@ -16,25 +16,25 @@ import 'package:flutter/material.dart';
class CustomStack extends StatelessWidget {
@override
Widget build(BuildContext context) {
var yellowBox = Container(
Widget yellowBox = Container(
color: Colors.yellow,
height: 100,
width: 100,
);
var redBox = Container(
Widget redBox = Container(
color: Colors.red,
height: 90,
width: 90,
);
var greenBox = Container(
Widget greenBox = Container(
color: Colors.green,
height: 80,
width: 80,
);
var cyanBox = Container(
Widget cyanBox = Container(
color: Colors.cyanAccent,
height: 70,
width: 70,

View File

@@ -12,25 +12,25 @@ import 'package:flutter/material.dart';
class PositionedStack extends StatelessWidget {
@override
Widget build(BuildContext context) {
var yellowBox = Container(
Widget yellowBox = Container(
color: Colors.yellow,
height: 100,
width: 100,
);
var redBox = Container(
Widget redBox = Container(
color: Colors.red,
height: 90,
width: 90,
);
var greenBox = Container(
Widget greenBox = Container(
color: Colors.green,
height: 80,
width: 80,
);
var cyanBox = Container(
Widget cyanBox = Container(
color: Colors.cyanAccent,
height: 70,
width: 70,