Commit 18141861 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Make intl dependencies clearer. (#12052)

parent 3be3a66b
...@@ -9,8 +9,8 @@ import 'package:flutter/foundation.dart'; ...@@ -9,8 +9,8 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:intl/date_symbols.dart'; import 'package:intl/date_symbols.dart' as intl show DateSymbols;
import 'package:intl/intl.dart' hide TextDirection; import 'package:intl/intl.dart' as intl show DateFormat;
import 'button.dart'; import 'button.dart';
import 'button_bar.dart'; import 'button_bar.dart';
...@@ -130,12 +130,12 @@ class _DatePickerHeader extends StatelessWidget { ...@@ -130,12 +130,12 @@ class _DatePickerHeader extends StatelessWidget {
Widget yearButton = new _DateHeaderButton( Widget yearButton = new _DateHeaderButton(
color: backgroundColor, color: backgroundColor,
onTap: Feedback.wrapForTap(() => _handleChangeMode(DatePickerMode.year), context), 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( Widget dayButton = new _DateHeaderButton(
color: backgroundColor, color: backgroundColor,
onTap: Feedback.wrapForTap(() => _handleChangeMode(DatePickerMode.day), context), 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. // Disable the button for the current mode.
...@@ -276,8 +276,8 @@ class DayPicker extends StatelessWidget { ...@@ -276,8 +276,8 @@ class DayPicker extends StatelessWidget {
final SelectableDayPredicate selectableDayPredicate; final SelectableDayPredicate selectableDayPredicate;
List<Widget> _getDayHeaders(TextStyle headerStyle) { List<Widget> _getDayHeaders(TextStyle headerStyle) {
final DateFormat dateFormat = new DateFormat(); final intl.DateFormat dateFormat = new intl.DateFormat();
final DateSymbols symbols = dateFormat.dateSymbols; final intl.DateSymbols symbols = dateFormat.dateSymbols;
return symbols.NARROWWEEKDAYS.map((String weekDay) { return symbols.NARROWWEEKDAYS.map((String weekDay) {
return new Center(child: new Text(weekDay, style: headerStyle)); return new Center(child: new Text(weekDay, style: headerStyle));
}).toList(growable: false); }).toList(growable: false);
...@@ -370,7 +370,7 @@ class DayPicker extends StatelessWidget { ...@@ -370,7 +370,7 @@ class DayPicker extends StatelessWidget {
child: new Center( child: new Center(
child: new GestureDetector( child: new GestureDetector(
onTap: onMonthHeaderTap != null ? Feedback.wrapForTap(onMonthHeaderTap, context) : null, 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, style: themeData.textTheme.subhead,
), ),
), ),
......
...@@ -6,7 +6,7 @@ import 'dart:async'; ...@@ -6,7 +6,7 @@ import 'dart:async';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart' as intl;
import 'i18n/localizations.dart'; import 'i18n/localizations.dart';
...@@ -120,7 +120,7 @@ class DefaultMaterialLocalizations implements MaterialLocalizations { ...@@ -120,7 +120,7 @@ class DefaultMaterialLocalizations implements MaterialLocalizations {
String get _localeName { String get _localeName {
final String localeName = locale.countryCode.isEmpty ? locale.languageCode : locale.toString(); 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 // TODO(hmuller): the rules for mapping from an integer value to
...@@ -143,9 +143,9 @@ class DefaultMaterialLocalizations implements MaterialLocalizations { ...@@ -143,9 +143,9 @@ class DefaultMaterialLocalizations implements MaterialLocalizations {
String _formatInteger(int n) { String _formatInteger(int n) {
final String localeName = _localeName; final String localeName = _localeName;
if (!NumberFormat.localeExists(localeName)) if (!intl.NumberFormat.localeExists(localeName))
return n.toString(); return n.toString();
return new NumberFormat.decimalPattern(localeName).format(n); return new intl.NumberFormat.decimalPattern(localeName).format(n);
} }
......
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