Commit e4f53c3a authored by Sarah Zakarias's avatar Sarah Zakarias Committed by GitHub

Add 'package' argument to IconData (#12560)

parent ce6f8d3a
...@@ -27,35 +27,36 @@ import 'package:flutter/widgets.dart'; ...@@ -27,35 +27,36 @@ import 'package:flutter/widgets.dart';
class CupertinoIcons { class CupertinoIcons {
CupertinoIcons._(); CupertinoIcons._();
static const String iconFont = 'packages/cupertino_icons/CupertinoIcons'; static const String iconFont = 'CupertinoIcons';
static const String iconFontPackage = 'cupertino_icons';
// Manually maintained list // Manually maintained list
static const IconData left_chevron = const IconData(0xf3f0, fontFamily: iconFont); static const IconData left_chevron = const IconData(0xf3f0, fontFamily: iconFont, fontPackage: iconFontPackage);
static const IconData right_chevron = const IconData(0xf3f2, fontFamily: iconFont); static const IconData right_chevron = const IconData(0xf3f2, fontFamily: iconFont, fontPackage: iconFontPackage);
static const IconData share = const IconData(0xf4ca, fontFamily: iconFont); static const IconData share = const IconData(0xf4ca, fontFamily: iconFont, fontPackage: iconFontPackage);
static const IconData book = const IconData(0xf3e7, fontFamily: iconFont); static const IconData book = const IconData(0xf3e7, fontFamily: iconFont, fontPackage: iconFontPackage);
static const IconData info = const IconData(0xf44c, fontFamily: iconFont); static const IconData info = const IconData(0xf44c, fontFamily: iconFont, fontPackage: iconFontPackage);
static const IconData reply = const IconData(0xf4c6, fontFamily: iconFont); static const IconData reply = const IconData(0xf4c6, fontFamily: iconFont, fontPackage: iconFontPackage);
static const IconData conversation_bubble = const IconData(0xf3fb, fontFamily: iconFont); static const IconData conversation_bubble = const IconData(0xf3fb, fontFamily: iconFont, fontPackage: iconFontPackage);
static const IconData profile_circled = const IconData(0xf419, fontFamily: iconFont); static const IconData profile_circled = const IconData(0xf419, fontFamily: iconFont, fontPackage: iconFontPackage);
static const IconData plus_circled = const IconData(0xf48a, fontFamily: iconFont); static const IconData plus_circled = const IconData(0xf48a, fontFamily: iconFont, fontPackage: iconFontPackage);
static const IconData minus_circled = const IconData(0xf463, fontFamily: iconFont); static const IconData minus_circled = const IconData(0xf463, fontFamily: iconFont, fontPackage: iconFontPackage);
static const IconData flag = const IconData(0xf42c, fontFamily: iconFont); static const IconData flag = const IconData(0xf42c, fontFamily: iconFont, fontPackage: iconFontPackage);
static const IconData search = const IconData(0xf4c6, fontFamily: iconFont); static const IconData search = const IconData(0xf4c6, fontFamily: iconFont, fontPackage: iconFontPackage);
static const IconData check_mark = const IconData(0xf41e, fontFamily: iconFont); static const IconData check_mark = const IconData(0xf41e, fontFamily: iconFont, fontPackage: iconFontPackage);
static const IconData check_mark_circled = const IconData(0xf41f, fontFamily: iconFont); static const IconData check_mark_circled = const IconData(0xf41f, fontFamily: iconFont, fontPackage: iconFontPackage);
} }
\ No newline at end of file
...@@ -132,6 +132,7 @@ class Icon extends StatelessWidget { ...@@ -132,6 +132,7 @@ class Icon extends StatelessWidget {
color: iconColor, color: iconColor,
fontSize: iconSize, fontSize: iconSize,
fontFamily: icon.fontFamily, fontFamily: icon.fontFamily,
package: icon.fontPackage,
), ),
), ),
), ),
......
...@@ -14,9 +14,13 @@ class IconData { ...@@ -14,9 +14,13 @@ class IconData {
/// ///
/// Rarely used directly. Instead, consider using one of the predefined icons /// Rarely used directly. Instead, consider using one of the predefined icons
/// like the [Icons] collection. /// like the [Icons] collection.
///
/// The [fontPackage] argument must be non-null when using a font family that
/// is included in a package. This is used when selecting the font.
const IconData( const IconData(
this.codePoint, { this.codePoint, {
this.fontFamily, this.fontFamily,
this.fontPackage,
}); });
/// The Unicode code point at which this icon is stored in the icon font. /// The Unicode code point at which this icon is stored in the icon font.
...@@ -25,6 +29,9 @@ class IconData { ...@@ -25,6 +29,9 @@ class IconData {
/// The font family from which the glyph for the [codePoint] will be selected. /// The font family from which the glyph for the [codePoint] will be selected.
final String fontFamily; final String fontFamily;
// The name of the package from which the font family is included.
final String fontPackage;
@override @override
bool operator ==(dynamic other) { bool operator ==(dynamic other) {
if (runtimeType != other.runtimeType) if (runtimeType != other.runtimeType)
......
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