Make intl dependencies clearer. (#12052)

This commit is contained in:
Ian Hickson 2017-09-14 11:14:02 -07:00 committed by GitHub
parent 3be3a66b4a
commit 1814186150
2 changed files with 11 additions and 11 deletions

View file

@ -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<Widget> _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,
),
),

View file

@ -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);
}