1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00
This commit is contained in:
Brett Morgan
2022-05-11 12:48:11 -07:00
committed by GitHub
parent fb00d0a102
commit ccd68f34e2
242 changed files with 1719 additions and 1430 deletions

View File

@@ -43,11 +43,11 @@ class DataTransferPage extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: const EdgeInsets.all(8),
child: Text(
'Number Generator Progress',
style: Theme.of(context).textTheme.headline6,
),
padding: const EdgeInsets.all(8),
),
LinearProgressIndicator(
value: controller.progressPercent,
@@ -59,28 +59,28 @@ class DataTransferPage extends StatelessWidget {
Column(
children: [
ElevatedButton(
child: const Text('Transfer Data to 2nd Isolate'),
style: ElevatedButton.styleFrom(
primary: (controller.runningTest == 1)
? Colors.blueAccent
: Colors.grey[300]),
onPressed: () => controller.generateRandomNumbers(false),
child: const Text('Transfer Data to 2nd Isolate'),
),
ElevatedButton(
child: const Text('Transfer Data with TransferableTypedData'),
style: ElevatedButton.styleFrom(
primary: (controller.runningTest == 2)
? Colors.blueAccent
: Colors.grey[300]),
onPressed: () => controller.generateRandomNumbers(true),
child: const Text('Transfer Data with TransferableTypedData'),
),
ElevatedButton(
child: const Text('Generate on 2nd Isolate'),
style: ElevatedButton.styleFrom(
primary: (controller.runningTest == 3)
? Colors.blueAccent
: Colors.grey[300]),
onPressed: controller.generateOnSecondaryIsolate,
child: const Text('Generate on 2nd Isolate'),
),
],
),
@@ -214,10 +214,10 @@ class RunningList extends StatelessWidget {
return Column(
children: [
Card(
color: Colors.lightGreenAccent,
child: ListTile(
title: Text(progress[index]),
),
color: Colors.lightGreenAccent,
),
const Divider(
color: Colors.blue,

View File

@@ -58,14 +58,14 @@ class InfiniteProcessPage extends StatelessWidget {
alignment: MainAxisAlignment.center,
children: [
ElevatedButton(
child: const Text('Start'),
style: ElevatedButton.styleFrom(elevation: 8.0),
onPressed: () => controller.start(),
child: const Text('Start'),
),
ElevatedButton(
child: const Text('Terminate'),
style: ElevatedButton.styleFrom(elevation: 8.0),
onPressed: () => controller.terminate(),
child: const Text('Terminate'),
),
],
),
@@ -205,13 +205,13 @@ class RunningList extends StatelessWidget {
return Column(
children: [
Card(
color: (controller.created && !controller.paused)
? Colors.lightGreenAccent
: Colors.deepOrangeAccent,
child: ListTile(
leading: Text('${sums.length - index}.'),
title: Text('${sums[index]}.'),
),
color: (controller.created && !controller.paused)
? Colors.lightGreenAccent
: Colors.deepOrangeAccent,
),
const Divider(
color: Colors.blue,

View File

@@ -33,7 +33,7 @@ class PerformancePage extends StatefulWidget {
const PerformancePage({Key? key}) : super(key: key);
@override
_PerformancePageState createState() => _PerformancePageState();
State<PerformancePage> createState() => _PerformancePageState();
}
class _PerformancePageState extends State<PerformancePage> {
@@ -55,12 +55,12 @@ class _PerformancePageState extends State<PerformancePage> {
future: computeFuture,
builder: (context, snapshot) {
return ElevatedButton(
child: const Text('Compute on Main'),
style: ElevatedButton.styleFrom(elevation: 8.0),
onPressed:
snapshot.connectionState == ConnectionState.done
? () => handleComputeOnMain(context)
: null,
child: const Text('Compute on Main'),
);
},
),
@@ -68,12 +68,12 @@ class _PerformancePageState extends State<PerformancePage> {
future: computeFuture,
builder: (context, snapshot) {
return ElevatedButton(
child: const Text('Compute on Secondary'),
style: ElevatedButton.styleFrom(elevation: 8.0),
onPressed:
snapshot.connectionState == ConnectionState.done
? () => handleComputeOnSecondary(context)
: null);
: null,
child: const Text('Compute on Secondary'));
},
),
],
@@ -130,10 +130,10 @@ class SmoothAnimationWidget extends StatefulWidget {
const SmoothAnimationWidget({Key? key}) : super(key: key);
@override
SmoothAnimationWidgetState createState() => SmoothAnimationWidgetState();
State<SmoothAnimationWidget> createState() => _SmoothAnimationWidgetState();
}
class SmoothAnimationWidgetState extends State<SmoothAnimationWidget>
class _SmoothAnimationWidgetState extends State<SmoothAnimationWidget>
with TickerProviderStateMixin {
late final AnimationController _animationController;
late final Animation<BorderRadius?> _borderAnimation;
@@ -160,9 +160,6 @@ class SmoothAnimationWidgetState extends State<SmoothAnimationWidget>
animation: _borderAnimation,
builder: (context, child) {
return Container(
child: const FlutterLogo(
size: 200,
),
alignment: Alignment.bottomCenter,
width: 350,
height: 200,
@@ -176,6 +173,9 @@ class SmoothAnimationWidgetState extends State<SmoothAnimationWidget>
),
borderRadius: _borderAnimation.value,
),
child: const FlutterLogo(
size: 200,
),
);
},
),