From 1814186150c915044d76e5e53eaa71382bdd9588 Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Thu, 14 Sep 2017 11:14:02 -0700 Subject: [PATCH] Make intl dependencies clearer. (#12052) --- packages/flutter/lib/src/material/date_picker.dart | 14 +++++++------- .../lib/src/material/material_localizations.dart | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/flutter/lib/src/material/date_picker.dart b/packages/flutter/lib/src/material/date_picker.dart index dc8610b236..b4a24564b5 100644 --- a/packages/flutter/lib/src/material/date_picker.dart +++ b/packages/flutter/lib/src/material/date_picker.dart @@ -9,8 +9,8 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; -import 'package:intl/date_symbols.dart'; -import 'package:intl/intl.dart' hide TextDirection; +import 'package:intl/date_symbols.dart' as intl show DateSymbols; +import 'package:intl/intl.dart' as intl show DateFormat; import 'button.dart'; import 'button_bar.dart'; @@ -130,12 +130,12 @@ class _DatePickerHeader extends StatelessWidget { Widget yearButton = new _DateHeaderButton( color: backgroundColor, onTap: Feedback.wrapForTap(() => _handleChangeMode(DatePickerMode.year), context), - child: new Text(new DateFormat('yyyy').format(selectedDate), style: yearStyle), + child: new Text(new intl.DateFormat('yyyy').format(selectedDate), style: yearStyle), ); Widget dayButton = new _DateHeaderButton( color: backgroundColor, onTap: Feedback.wrapForTap(() => _handleChangeMode(DatePickerMode.day), context), - child: new Text(new DateFormat('E, MMM\u00a0d').format(selectedDate), style: dayStyle), + child: new Text(new intl.DateFormat('E, MMM\u00a0d').format(selectedDate), style: dayStyle), ); // Disable the button for the current mode. @@ -276,8 +276,8 @@ class DayPicker extends StatelessWidget { final SelectableDayPredicate selectableDayPredicate; List _getDayHeaders(TextStyle headerStyle) { - final DateFormat dateFormat = new DateFormat(); - final DateSymbols symbols = dateFormat.dateSymbols; + final intl.DateFormat dateFormat = new intl.DateFormat(); + final intl.DateSymbols symbols = dateFormat.dateSymbols; return symbols.NARROWWEEKDAYS.map((String weekDay) { return new Center(child: new Text(weekDay, style: headerStyle)); }).toList(growable: false); @@ -370,7 +370,7 @@ class DayPicker extends StatelessWidget { child: new Center( child: new GestureDetector( onTap: onMonthHeaderTap != null ? Feedback.wrapForTap(onMonthHeaderTap, context) : null, - child: new Text(new DateFormat('yMMMM').format(displayedMonth), + child: new Text(new intl.DateFormat('yMMMM').format(displayedMonth), style: themeData.textTheme.subhead, ), ), diff --git a/packages/flutter/lib/src/material/material_localizations.dart b/packages/flutter/lib/src/material/material_localizations.dart index 73273f869c..a9020bf677 100644 --- a/packages/flutter/lib/src/material/material_localizations.dart +++ b/packages/flutter/lib/src/material/material_localizations.dart @@ -6,7 +6,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; -import 'package:intl/intl.dart'; +import 'package:intl/intl.dart' as intl; import 'i18n/localizations.dart'; @@ -120,7 +120,7 @@ class DefaultMaterialLocalizations implements MaterialLocalizations { String get _localeName { final String localeName = locale.countryCode.isEmpty ? locale.languageCode : locale.toString(); - return Intl.canonicalizedLocale(localeName); + return intl.Intl.canonicalizedLocale(localeName); } // TODO(hmuller): the rules for mapping from an integer value to @@ -143,9 +143,9 @@ class DefaultMaterialLocalizations implements MaterialLocalizations { String _formatInteger(int n) { final String localeName = _localeName; - if (!NumberFormat.localeExists(localeName)) + if (!intl.NumberFormat.localeExists(localeName)) return n.toString(); - return new NumberFormat.decimalPattern(localeName).format(n); + return new intl.NumberFormat.decimalPattern(localeName).format(n); }