migrate semantics to nullsafety (#64055)
This commit is contained in:
committed by
GitHub
parent
6ca9cd7b8f
commit
734a90eb3a
@@ -7,5 +7,6 @@ analyzer:
|
||||
- non-nullable
|
||||
errors:
|
||||
always_require_non_null_named_parameters: false # not needed with nnbd
|
||||
type_init_formals: false # https://github.com/dart-lang/linter/issues/2192
|
||||
void_checks: false # https://github.com/dart-lang/linter/issues/2185
|
||||
unnecessary_null_comparison: false # https://github.com/dart-lang/language/issues/1018 , turned off until https://github.com/flutter/flutter/issues/61042
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
/// The Flutter semantics package.
|
||||
///
|
||||
/// To use, import `package:flutter/semantics.dart`.
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'dart:ui' as ui show AccessibilityFeatures, SemanticsUpdateBuilder;
|
||||
|
||||
@@ -16,8 +15,8 @@ export 'dart:ui' show AccessibilityFeatures;
|
||||
// TODO(jonahwilliams): move the remaining semantic related bindings here.
|
||||
mixin SemanticsBinding on BindingBase {
|
||||
/// The current [SemanticsBinding], if one has been created.
|
||||
static SemanticsBinding get instance => _instance;
|
||||
static SemanticsBinding _instance;
|
||||
static SemanticsBinding? get instance => _instance;
|
||||
static SemanticsBinding? _instance;
|
||||
|
||||
@override
|
||||
void initInstances() {
|
||||
@@ -53,7 +52,7 @@ mixin SemanticsBinding on BindingBase {
|
||||
/// [WidgetsBindingObserver] and listen to
|
||||
/// [WidgetsBindingObserver.didChangeAccessibilityFeatures].
|
||||
ui.AccessibilityFeatures get accessibilityFeatures => _accessibilityFeatures;
|
||||
ui.AccessibilityFeatures _accessibilityFeatures;
|
||||
late ui.AccessibilityFeatures _accessibilityFeatures;
|
||||
|
||||
/// The platform is requesting that animations be disabled or simplified.
|
||||
///
|
||||
@@ -63,7 +62,7 @@ mixin SemanticsBinding on BindingBase {
|
||||
bool value = _accessibilityFeatures.disableAnimations;
|
||||
assert(() {
|
||||
if (debugSemanticsDisableAnimations != null)
|
||||
value = debugSemanticsDisableAnimations;
|
||||
value = debugSemanticsDisableAnimations!;
|
||||
return true;
|
||||
}());
|
||||
return value;
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
/// Overrides the setting of [SemanticsBinding.disableAnimations] for debugging
|
||||
/// and testing.
|
||||
///
|
||||
/// This value is ignored in non-debug builds.
|
||||
bool debugSemanticsDisableAnimations;
|
||||
bool? debugSemanticsDisableAnimations;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/painting.dart';
|
||||
@@ -30,7 +29,7 @@ abstract class SemanticsEvent {
|
||||
///
|
||||
/// [nodeId] is the unique identifier of the semantics node associated with
|
||||
/// the event, or null if the event is not associated with a semantics node.
|
||||
Map<String, dynamic> toMap({ int nodeId }) {
|
||||
Map<String, dynamic> toMap({ int? nodeId }) {
|
||||
final Map<String, dynamic> event = <String, dynamic>{
|
||||
'type': type,
|
||||
'data': getDataMap(),
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:ui' show TextDirection;
|
||||
|
||||
Reference in New Issue
Block a user