forked from lxm_flutter/FlutterUnit
代码格式优化完毕
This commit is contained in:
@@ -12,41 +12,33 @@ import 'package:flutter/material.dart';
|
||||
// "【mainAxisAlignment】 : 主轴对齐 【MainAxisAlignment】",
|
||||
// }
|
||||
class MainAxisAlignmentFlex extends StatelessWidget {
|
||||
MainAxisAlignmentFlex({Key? key}) : super(key: key);
|
||||
|
||||
static TextStyle textStyle =
|
||||
TextStyle(color: Colors.white, fontWeight: FontWeight.bold);
|
||||
const TextStyle(color: Colors.white, fontWeight: FontWeight.bold);
|
||||
|
||||
final blueBox = Container(
|
||||
final Widget blueBox = Container(
|
||||
alignment: Alignment.center,
|
||||
color: Colors.blue,
|
||||
height: 20,
|
||||
width: 30,
|
||||
child: Text(
|
||||
'1',
|
||||
style: textStyle,
|
||||
),
|
||||
child: Text('1', style: textStyle),
|
||||
);
|
||||
|
||||
final redBox = Container(
|
||||
final Widget redBox = Container(
|
||||
alignment: Alignment.center,
|
||||
color: Colors.red,
|
||||
height: 30,
|
||||
width: 40,
|
||||
child: Text(
|
||||
'2',
|
||||
style: textStyle,
|
||||
),
|
||||
child: Text('2', style: textStyle),
|
||||
);
|
||||
|
||||
final greenBox = Container(
|
||||
final Widget greenBox = Container(
|
||||
alignment: Alignment.center,
|
||||
color: Colors.green,
|
||||
height: 20,
|
||||
width: 20,
|
||||
child: Text(
|
||||
'3',
|
||||
style: textStyle,
|
||||
),
|
||||
child: Text('3', style: textStyle),
|
||||
);
|
||||
|
||||
@override
|
||||
@@ -56,7 +48,7 @@ class MainAxisAlignmentFlex extends StatelessWidget {
|
||||
children: MainAxisAlignment.values
|
||||
.map((mode) => Column(children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.all(5),
|
||||
margin: const EdgeInsets.all(5),
|
||||
width: 160,
|
||||
height: 80,
|
||||
color: Colors.grey.withAlpha(33),
|
||||
@@ -66,7 +58,7 @@ class MainAxisAlignmentFlex extends StatelessWidget {
|
||||
.toList());
|
||||
}
|
||||
|
||||
_buildItem(mode) => Flex(
|
||||
Widget _buildItem(mode) => Flex(
|
||||
direction: Axis.horizontal,
|
||||
mainAxisAlignment: mode,
|
||||
children: <Widget>[
|
||||
|
||||
Reference in New Issue
Block a user