Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bin/generate_package_icons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ case PhosphorIconsStyle.${style.styleName}:
..defaultTo = Code('PhosphorIconsStyle.regular')
..type = Reference('PhosphorIconsStyle')))
..body = Code(code)
..returns = Reference('PhosphorIconData'));
..returns = Reference('IconData'));
}

/// reads the phosphor json of one style and generates a dart class
Expand Down Expand Up @@ -172,16 +172,16 @@ Field buildFieldIconByStyle(dynamic icon, {required StyleFileData style}) {

if (style == StyleFileData.duotone && properties['codes'] != null) {
final graphCodes = (properties['codes'] as List).cast<int>();
final backgroundHexCode = '0x' + graphCodes.first.toRadixString(16);
final foregroundHexCode = '0x' + graphCodes.last.toRadixString(16);
codeStatement = Code(
"PhosphorDuotoneIconData($foregroundHexCode, PhosphorIconData($backgroundHexCode, 'Duotone'),)",
"IconData($foregroundHexCode, fontFamily: 'PhosphorDuotone', fontPackage: 'phosphor_flutter', matchTextDirection: true)",
);
} else {
final graphCode = properties['code'] as int;
final hexCode = '0x' + graphCode.toRadixString(16);
final fontFamily = 'Phosphor${style.styleName.capitalize()}';
codeStatement = Code(
"PhosphorFlatIconData($hexCode, '${style.styleName.capitalize()}')",
"IconData($hexCode, fontFamily: '$fontFamily', fontPackage: 'phosphor_flutter', matchTextDirection: true)",
);
}

Expand Down
32 changes: 32 additions & 0 deletions example/ios/Flutter/ephemeral/flutter_lldb_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# Generated file, do not edit.
#

import lldb

def handle_new_rx_page(frame: lldb.SBFrame, bp_loc, extra_args, intern_dict):
"""Intercept NOTIFY_DEBUGGER_ABOUT_RX_PAGES and touch the pages."""
base = frame.register["x0"].GetValueAsAddress()
page_len = frame.register["x1"].GetValueAsUnsigned()

# Note: NOTIFY_DEBUGGER_ABOUT_RX_PAGES will check contents of the
# first page to see if handled it correctly. This makes diagnosing
# misconfiguration (e.g. missing breakpoint) easier.
data = bytearray(page_len)
data[0:8] = b'IHELPED!'

error = lldb.SBError()
frame.GetThread().GetProcess().WriteMemory(base, data, error)
if not error.Success():
print(f'Failed to write into {base}[+{page_len}]', error)
return

def __lldb_init_module(debugger: lldb.SBDebugger, _):
target = debugger.GetDummyTarget()
# Caveat: must use BreakpointCreateByRegEx here and not
# BreakpointCreateByName. For some reasons callback function does not
# get carried over from dummy target for the later.
bp = target.BreakpointCreateByRegex("^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$")
bp.SetScriptCallbackFunction('{}.handle_new_rx_page'.format(__name__))
bp.SetAutoContinue(True)
print("-- LLDB integration loaded --")
5 changes: 5 additions & 0 deletions example/ios/Flutter/ephemeral/flutter_lldbinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#
# Generated file, do not edit.
#

command script import --relative-to-command-file flutter_lldb_helper.py
12 changes: 12 additions & 0 deletions example/ios/Flutter/ephemeral/flutter_native_integration.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FLUTTER_ROOT=/Users/ducnv/fvm/versions/3.44.0
FLUTTER_APPLICATION_PATH=/Users/ducnv/Documents/Projects/Persional/Flutter/modipix/local_packages/phosphor_flutter/example
FLUTTER_FRAMEWORK_SWIFT_PACKAGE_PATH=/Users/ducnv/Documents/Projects/Persional/Flutter/modipix/local_packages/phosphor_flutter/example/ios/Flutter/ephemeral/Packages/.packages/FlutterFramework
COCOAPODS_PARALLEL_CODE_SIGN=true
FLUTTER_TARGET=lib/main.dart
FLUTTER_BUILD_DIR=build
FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1
DART_OBFUSCATION=false
TRACK_WIDGET_CREATION=true
TREE_SHAKE_ICONS=false
PACKAGE_CONFIG=.dart_tool/package_config.json
23,574 changes: 12,091 additions & 11,483 deletions example/lib/constants/all_icons.dart

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ packages:
dependency: transitive
description:
name: characters
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
url: "https://pub.dev"
source: hosted
version: "1.3.0"
version: "1.4.1"
collection:
dependency: transitive
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
url: "https://pub.dev"
source: hosted
version: "1.18.0"
version: "1.19.1"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -42,18 +42,18 @@ packages:
dependency: transitive
description:
name: material_color_utilities
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
url: "https://pub.dev"
source: hosted
version: "0.8.0"
version: "0.13.0"
meta:
dependency: transitive
description:
name: meta
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.18.0"
phosphor_flutter:
dependency: "direct main"
description:
Expand All @@ -65,15 +65,15 @@ packages:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
version: "0.0.0"
vector_math:
dependency: transitive
description:
name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
url: "https://pub.dev"
source: hosted
version: "2.1.4"
version: "2.2.0"
sdks:
dart: ">=3.2.0-0 <4.0.0"
dart: ">=3.10.0-0 <4.0.0"
flutter: ">=1.17.0"
12 changes: 9 additions & 3 deletions lib/src/phosphor_icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,21 @@ class PhosphorIcon extends Icon {

@override
Widget build(BuildContext context) {
if (icon is PhosphorDuotoneIconData) {
final duotoneIcon = icon as PhosphorDuotoneIconData;
final iconData = icon;
if (iconData != null && iconData.fontFamily == 'PhosphorDuotone' && iconData.codePoint % 2 != 0) {
final secondaryIcon = IconData(
iconData.codePoint - 1,
fontFamily: 'PhosphorDuotone',
fontPackage: 'phosphor_flutter',
matchTextDirection: true,
);
return Stack(
alignment: Alignment.center,
children: [
Opacity(
opacity: duotoneSecondaryOpacity,
child: Icon(
duotoneIcon.secondary,
secondaryIcon,
key: key,
size: size,
fill: fill,
Expand Down
25 changes: 4 additions & 21 deletions lib/src/phosphor_icon_data.dart
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
library phosphor_flutter;

export 'package:flutter/widgets.dart' show IconData;
import 'package:flutter/widgets.dart';

class PhosphorIconData extends IconData {
const PhosphorIconData(int codePoint, String style)
: super(
codePoint,
fontFamily: 'Phosphor$style',
fontPackage: 'phosphor_flutter',
matchTextDirection: true,
);
}

class PhosphorFlatIconData extends PhosphorIconData {
const PhosphorFlatIconData(int codePoint, String style)
: super(codePoint, style);
}

class PhosphorDuotoneIconData extends PhosphorIconData {
const PhosphorDuotoneIconData(int codePoint, this.secondary)
: super(codePoint, 'Duotone');

final PhosphorIconData secondary;
}
typedef PhosphorIconData = IconData;
typedef PhosphorFlatIconData = IconData;
typedef PhosphorDuotoneIconData = IconData;
Loading