mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +00:00
Landing beta changes in master for the new stable release (#747)
This commit is contained in:
@@ -87,17 +87,15 @@ class DataTransferPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
class DataTransferIsolateController extends ChangeNotifier {
|
||||
Isolate _isolate;
|
||||
ReceivePort _incomingReceivePort;
|
||||
SendPort _outgoingSendPort;
|
||||
Isolate? _isolate;
|
||||
late ReceivePort _incomingReceivePort;
|
||||
late SendPort _outgoingSendPort;
|
||||
|
||||
final currentProgress = <String>[];
|
||||
int runningTest = 0;
|
||||
Stopwatch _timer = Stopwatch();
|
||||
double progressPercent = 0;
|
||||
|
||||
Isolate get newIsolate => _isolate;
|
||||
|
||||
bool get running => runningTest != 0;
|
||||
|
||||
DataTransferIsolateController() {
|
||||
@@ -262,7 +260,7 @@ Iterable<int> createNums() sync* {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> generateAndSum(
|
||||
Future<int> generateAndSum(
|
||||
SendPort callerSP,
|
||||
Iterable<int> iter,
|
||||
int length,
|
||||
|
||||
@@ -86,7 +86,7 @@ class InfiniteProcessPage extends StatelessWidget {
|
||||
Radio<int>(
|
||||
value: i,
|
||||
groupValue: controller.currentMultiplier,
|
||||
onChanged: (val) => controller.setMultiplier(val),
|
||||
onChanged: (val) => controller.setMultiplier(val!),
|
||||
),
|
||||
Text('${i}x')
|
||||
],
|
||||
@@ -101,10 +101,10 @@ class InfiniteProcessPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
class InfiniteProcessIsolateController extends ChangeNotifier {
|
||||
Isolate newIsolate;
|
||||
ReceivePort receivePort;
|
||||
SendPort newIceSP;
|
||||
Capability capability;
|
||||
Isolate? newIsolate;
|
||||
late ReceivePort receivePort;
|
||||
late SendPort newIceSP;
|
||||
Capability? capability;
|
||||
|
||||
int _currentMultiplier = 1;
|
||||
final List<int> _currentResults = [];
|
||||
@@ -146,17 +146,17 @@ class InfiniteProcessIsolateController extends ChangeNotifier {
|
||||
}
|
||||
|
||||
void terminate() {
|
||||
newIsolate.kill();
|
||||
newIsolate?.kill();
|
||||
_created = false;
|
||||
_currentResults.clear();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void pausedSwitch() {
|
||||
if (_paused) {
|
||||
newIsolate.resume(capability);
|
||||
if (_paused && capability != null) {
|
||||
newIsolate?.resume(capability!);
|
||||
} else {
|
||||
capability = newIsolate.pause();
|
||||
capability = newIsolate?.pause();
|
||||
}
|
||||
|
||||
_paused = !_paused;
|
||||
|
||||
@@ -88,7 +88,7 @@ class _PerformancePageState extends State<PerformancePage> {
|
||||
var snackBar = SnackBar(
|
||||
content: Text('Main Isolate Done!'),
|
||||
);
|
||||
Scaffold.of(context).showSnackBar(snackBar);
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
});
|
||||
|
||||
setState(() {
|
||||
@@ -102,7 +102,7 @@ class _PerformancePageState extends State<PerformancePage> {
|
||||
var snackBar = SnackBar(
|
||||
content: Text('Secondary Isolate Done!'),
|
||||
);
|
||||
Scaffold.of(context).showSnackBar(snackBar);
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
});
|
||||
|
||||
setState(() {
|
||||
@@ -131,8 +131,8 @@ class SmoothAnimationWidget extends StatefulWidget {
|
||||
|
||||
class SmoothAnimationWidgetState extends State<SmoothAnimationWidget>
|
||||
with TickerProviderStateMixin {
|
||||
AnimationController _animationController;
|
||||
Animation<BorderRadius> _borderAnimation;
|
||||
late final AnimationController _animationController;
|
||||
late final Animation<BorderRadius> _borderAnimation;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
Reference in New Issue
Block a user