Polish the texture example (#157176)
Replaces `SizedBox`es with the new `spacing` parameter in `Column` and fixes some minor formatting issues. This is a refactoring with no semantic changes. I will get a test exemption.
This commit is contained in:
parent
a4280f9396
commit
4ff8c9507b
@ -35,53 +35,54 @@ class _TexturePageState extends State<TexturePage> {
|
|||||||
body: Center(
|
body: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
spacing: 10,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
FutureBuilder<int?>(
|
FutureBuilder<int?>(
|
||||||
future: textureId,
|
future: textureId,
|
||||||
builder: (BuildContext context, AsyncSnapshot<int?> snapshot) {
|
builder: (BuildContext context, AsyncSnapshot<int?> snapshot) {
|
||||||
if (snapshot.hasData) {
|
if (!snapshot.hasData) {
|
||||||
if (snapshot.data != null) {
|
return const Text('Creating texture...');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (snapshot.data == null) {
|
||||||
|
return const Text('Error creating texture');
|
||||||
|
}
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: textureWidth.toDouble(),
|
width: textureWidth.toDouble(),
|
||||||
height: textureHeight.toDouble(),
|
height: textureHeight.toDouble(),
|
||||||
child: Texture(textureId: snapshot.data!),
|
child: Texture(textureId: snapshot.data!),
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
return const Text('Error creating texture');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return const Text('Creating texture...');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
child: const Text('Flutter Navy'),
|
child: const Text('Flutter Navy'),
|
||||||
onPressed: () => setColor(0x04, 0x2b, 0x59)),
|
onPressed: () => setColor(0x04, 0x2b, 0x59),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
child: const Text('Flutter Blue'),
|
child: const Text('Flutter Blue'),
|
||||||
onPressed: () => setColor(0x05, 0x53, 0xb1)),
|
onPressed: () => setColor(0x05, 0x53, 0xb1),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
child: const Text('Flutter Sky'),
|
child: const Text('Flutter Sky'),
|
||||||
onPressed: () => setColor(0x02, 0x7d, 0xfd)),
|
onPressed: () => setColor(0x02, 0x7d, 0xfd),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
child: const Text('Red'),
|
child: const Text('Red'),
|
||||||
onPressed: () => setColor(0xf2, 0x5d, 0x50)),
|
onPressed: () => setColor(0xf2, 0x5d, 0x50),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
child: const Text('Yellow'),
|
child: const Text('Yellow'),
|
||||||
onPressed: () => setColor(0xff, 0xf2, 0x75)),
|
onPressed: () => setColor(0xff, 0xf2, 0x75),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
child: const Text('Purple'),
|
child: const Text('Purple'),
|
||||||
onPressed: () => setColor(0x62, 0x00, 0xee)),
|
onPressed: () => setColor(0x62, 0x00, 0xee),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
child: const Text('Green'),
|
child: const Text('Green'),
|
||||||
onPressed: () => setColor(0x1c, 0xda, 0xc5)),
|
onPressed: () => setColor(0x1c, 0xda, 0xc5),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user