Skip to content

Instantly share code, notes, and snippets.

@ilopX
Last active September 6, 2022 20:22
Show Gist options
  • Select an option

  • Save ilopX/87ea46a56f846163e49eeca3c5215a66 to your computer and use it in GitHub Desktop.

Select an option

Save ilopX/87ea46a56f846163e49eeca3c5215a66 to your computer and use it in GitHub Desktop.
final column = OutVar<Column>();
init(
Center(
child: Column(
outVar: column,
space: 20,
align: Align.start,
children: [
Box(
width: 100,
height: 100,
color: 'LightSalmon',
onClick: (self) {
(self as Box);
self.width += 40;
if (self.width > 800) {
self.width = 100;
}
},
),
Box(
width: 200,
height: 100,
color: 'LightSkyBlue',
onClick: (_) {
column.space += 5;
if (column.space > 100) {
column.space = 1;
}
},
),
Box(
width: 80,
height: 100,
color: 'SlateGrey',
onClick: (_) {
column.add(
Box(
width: 200,
height: 10,
color: 'SlateGrey'
),
);
},
),
Box(
width: 400,
height: 50,
color: 'MediumAquaMarine',
onClick: (_) {
if (column.align == Align.start) {
column.align = Align.center;
} else {
column.align = Align.start;
}
}
),
],
),
),
);
chrome_YQia1XWxml.mp4

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment