diff --git a/examples/texture/lib/main.dart b/examples/texture/lib/main.dart index 2f0cc7eed3..78e5fda6a6 100644 --- a/examples/texture/lib/main.dart +++ b/examples/texture/lib/main.dart @@ -35,53 +35,54 @@ class _TexturePageState extends State { body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, + spacing: 10, children: [ FutureBuilder( future: textureId, builder: (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.hasData) { - if (snapshot.data != null) { - return SizedBox( - width: textureWidth.toDouble(), - height: textureHeight.toDouble(), - child: Texture(textureId: snapshot.data!), - ); - } else { - return const Text('Error creating texture'); - } - } else { + if (!snapshot.hasData) { return const Text('Creating texture...'); } + + if (snapshot.data == null) { + return const Text('Error creating texture'); + } + + return SizedBox( + width: textureWidth.toDouble(), + height: textureHeight.toDouble(), + child: Texture(textureId: snapshot.data!), + ); }, ), - const SizedBox(height: 10), OutlinedButton( - child: const Text('Flutter Navy'), - onPressed: () => setColor(0x04, 0x2b, 0x59)), - const SizedBox(height: 10), + child: const Text('Flutter Navy'), + onPressed: () => setColor(0x04, 0x2b, 0x59), + ), OutlinedButton( - child: const Text('Flutter Blue'), - onPressed: () => setColor(0x05, 0x53, 0xb1)), - const SizedBox(height: 10), + child: const Text('Flutter Blue'), + onPressed: () => setColor(0x05, 0x53, 0xb1), + ), OutlinedButton( - child: const Text('Flutter Sky'), - onPressed: () => setColor(0x02, 0x7d, 0xfd)), - const SizedBox(height: 10), + child: const Text('Flutter Sky'), + onPressed: () => setColor(0x02, 0x7d, 0xfd), + ), OutlinedButton( - child: const Text('Red'), - onPressed: () => setColor(0xf2, 0x5d, 0x50)), - const SizedBox(height: 10), + child: const Text('Red'), + onPressed: () => setColor(0xf2, 0x5d, 0x50), + ), OutlinedButton( - child: const Text('Yellow'), - onPressed: () => setColor(0xff, 0xf2, 0x75)), - const SizedBox(height: 10), + child: const Text('Yellow'), + onPressed: () => setColor(0xff, 0xf2, 0x75), + ), OutlinedButton( - child: const Text('Purple'), - onPressed: () => setColor(0x62, 0x00, 0xee)), - const SizedBox(height: 10), + child: const Text('Purple'), + onPressed: () => setColor(0x62, 0x00, 0xee), + ), OutlinedButton( - child: const Text('Green'), - onPressed: () => setColor(0x1c, 0xda, 0xc5)), + child: const Text('Green'), + onPressed: () => setColor(0x1c, 0xda, 0xc5), + ), ], ), ),