Unverified Commit 419be223 authored by Hans Muller's avatar Hans Muller Committed by GitHub

More debugCheckHasMaterialLocalizations() asserts (#23740)

parent a2c9dd81
......@@ -116,6 +116,7 @@ class CloseButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
assert(debugCheckHasMaterialLocalizations(context));
return IconButton(
icon: const Icon(Icons.close),
tooltip: MaterialLocalizations.of(context).closeButtonTooltip,
......
......@@ -943,7 +943,6 @@ class _DatePickerDialogState extends State<_DatePickerDialog> {
@override
Widget build(BuildContext context) {
assert(debugCheckHasMaterialLocalizations(context));
final ThemeData theme = Theme.of(context);
final Widget picker = Flexible(
child: SizedBox(
......@@ -1086,6 +1085,8 @@ Future<DateTime> showDatePicker({
'Provided initialDate must satisfy provided selectableDayPredicate'
);
assert(initialDatePickerMode != null, 'initialDatePickerMode must not be null');
assert(context != null);
assert(debugCheckHasMaterialLocalizations(context));
Widget child = _DatePickerDialog(
initialDate: initialDate,
......
......@@ -670,6 +670,7 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
@override
Widget build(BuildContext context) {
assert(debugCheckHasMaterial(context));
assert(debugCheckHasMaterialLocalizations(context));
assert(() {
if (context.ancestorWidgetOfExactType(Stepper) != null)
throw FlutterError(
......
......@@ -899,6 +899,7 @@ class _TabBarState extends State<TabBar> {
@override
Widget build(BuildContext context) {
assert(debugCheckHasMaterialLocalizations(context));
final MaterialLocalizations localizations = MaterialLocalizations.of(context);
if (_controller.length == 0) {
return Container(
......
......@@ -7,6 +7,7 @@ import 'dart:math' as math;
import 'package:flutter/widgets.dart';
import 'package:flutter/rendering.dart';
import 'debug.dart';
import 'flat_button.dart';
import 'material.dart';
import 'material_localizations.dart';
......@@ -132,6 +133,7 @@ class _MaterialTextSelectionControls extends TextSelectionControls {
@override
Widget buildToolbar(BuildContext context, Rect globalEditableRegion, Offset position, TextSelectionDelegate delegate) {
assert(debugCheckHasMediaQuery(context));
assert(debugCheckHasMaterialLocalizations(context));
return ConstrainedBox(
constraints: BoxConstraints.tight(globalEditableRegion.size),
child: CustomSingleChildLayout(
......
......@@ -3,10 +3,13 @@
// found in the LICENSE file.
import 'dart:ui' show hashValues;
import 'package:flutter/widgets.dart';
import 'debug.dart';
import 'material_localizations.dart';
/// Whether the [TimeOfDay] is before or after noon.
enum DayPeriod {
/// Ante meridiem (before noon).
......@@ -96,7 +99,8 @@ class TimeOfDay {
///
/// This is a shortcut for [MaterialLocalizations.formatTimeOfDay].
String format(BuildContext context) {
debugCheckHasMediaQuery(context);
assert(debugCheckHasMediaQuery(context));
assert(debugCheckHasMaterialLocalizations(context));
final MaterialLocalizations localizations = MaterialLocalizations.of(context);
return localizations.formatTimeOfDay(
this,
......
......@@ -12,6 +12,7 @@ import 'package:flutter/widgets.dart';
import 'button_bar.dart';
import 'button_theme.dart';
import 'colors.dart';
import 'debug.dart';
import 'dialog.dart';
import 'feedback.dart';
import 'flat_button.dart';
......@@ -1672,6 +1673,7 @@ Future<TimeOfDay> showTimePicker({
}) async {
assert(context != null);
assert(initialTime != null);
assert(debugCheckHasMaterialLocalizations(context));
return await showDialog<TimeOfDay>(
context: context,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment