mirror of
https://github.com/flutter/flutter
synced 2024-10-13 11:42:54 +00:00
Add 'package' argument to IconData (#12560)
This commit is contained in:
parent
ce6f8d3a83
commit
e4f53c3abd
|
@ -27,35 +27,36 @@ import 'package:flutter/widgets.dart';
|
|||
class CupertinoIcons {
|
||||
CupertinoIcons._();
|
||||
|
||||
static const String iconFont = 'packages/cupertino_icons/CupertinoIcons';
|
||||
static const String iconFont = 'CupertinoIcons';
|
||||
static const String iconFontPackage = 'cupertino_icons';
|
||||
|
||||
// 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);
|
||||
}
|
|
@ -132,6 +132,7 @@ class Icon extends StatelessWidget {
|
|||
color: iconColor,
|
||||
fontSize: iconSize,
|
||||
fontFamily: icon.fontFamily,
|
||||
package: icon.fontPackage,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -14,9 +14,13 @@ class IconData {
|
|||
///
|
||||
/// Rarely used directly. Instead, consider using one of the predefined icons
|
||||
/// 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(
|
||||
this.codePoint, {
|
||||
this.fontFamily,
|
||||
this.fontPackage,
|
||||
});
|
||||
|
||||
/// The Unicode code point at which this icon is stored in the icon font.
|
||||
|
@ -25,6 +29,9 @@ class IconData {
|
|||
/// The font family from which the glyph for the [codePoint] will be selected.
|
||||
final String fontFamily;
|
||||
|
||||
// The name of the package from which the font family is included.
|
||||
final String fontPackage;
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
if (runtimeType != other.runtimeType)
|
||||
|
|
Loading…
Reference in a new issue