Skip to content
Merged
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
180 changes: 49 additions & 131 deletions .github/workflows/build.yml

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion .github/workflows/dart.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Dart quality

on: [push, pull_request]
on:
push:
branches: [main, develop]
pull_request:

permissions:
contents: read
Expand Down
Binary file removed app/fonts/Comfortaa-Bold.ttf
Binary file not shown.
Binary file removed app/fonts/Comfortaa-Light.ttf
Binary file not shown.
Binary file removed app/fonts/Comfortaa-Medium.ttf
Binary file not shown.
Binary file removed app/fonts/Comfortaa-Regular.ttf
Binary file not shown.
Binary file removed app/fonts/Comfortaa-SemiBold.ttf
Binary file not shown.
Binary file added app/fonts/Comfortaa-Variable.ttf
Binary file not shown.
Binary file removed app/fonts/NotoSansArabic-Black.ttf
Binary file not shown.
Binary file removed app/fonts/NotoSansArabic-Bold.ttf
Binary file not shown.
Binary file removed app/fonts/NotoSansArabic-ExtraLight.ttf
Binary file not shown.
Binary file removed app/fonts/NotoSansArabic-Light.ttf
Binary file not shown.
Binary file removed app/fonts/NotoSansArabic-Medium.ttf
Binary file not shown.
Binary file removed app/fonts/NotoSansArabic-Regular.ttf
Binary file not shown.
Binary file removed app/fonts/NotoSansArabic-SemiBold.ttf
Binary file not shown.
Binary file removed app/fonts/NotoSansArabic-Thin.ttf
Binary file not shown.
Binary file added app/fonts/NotoSansArabic-Variable.ttf
Binary file not shown.
Binary file removed app/fonts/Roboto-Black.ttf
Binary file not shown.
Binary file removed app/fonts/Roboto-BlackItalic.ttf
Binary file not shown.
Binary file removed app/fonts/Roboto-Bold.ttf
Binary file not shown.
Binary file removed app/fonts/Roboto-BoldItalic.ttf
Binary file not shown.
Binary file added app/fonts/Roboto-Italic-Variable.ttf
Binary file not shown.
Binary file removed app/fonts/Roboto-Italic.ttf
Binary file not shown.
Binary file removed app/fonts/Roboto-Light.ttf
Binary file not shown.
Binary file removed app/fonts/Roboto-LightItalic.ttf
Binary file not shown.
Binary file removed app/fonts/Roboto-Medium.ttf
Binary file not shown.
Binary file removed app/fonts/Roboto-MediumItalic.ttf
Binary file not shown.
Binary file removed app/fonts/Roboto-Regular.ttf
Binary file not shown.
Binary file removed app/fonts/Roboto-Thin.ttf
Binary file not shown.
Binary file removed app/fonts/Roboto-ThinItalic.ttf
Binary file not shown.
Binary file added app/fonts/Roboto-Variable.ttf
Binary file not shown.
4 changes: 2 additions & 2 deletions app/lib/dialogs/elements.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ ContextMenuBuilder buildElementsContextMenu(
children: Arrangement.values
.map(
(e) => MenuItemButton(
leadingIcon: Icon(e.icon(PhosphorIconsStyle.light)),
leadingIcon: Icon(e.icon()),
child: Text(e.getLocalizedName(context)),
onPressed: () {
Navigator.of(context).pop(true);
Expand All @@ -150,7 +150,7 @@ ContextMenuBuilder buildElementsContextMenu(
children: operationKeys
.map(
(e) => MenuItemButton(
leadingIcon: PhosphorIcon(e.icon(PhosphorIconsStyle.light)),
leadingIcon: PhosphorIcon(e.icon()),
child: Text(e.getLocalizedName(context)),
onPressed: () {
final flipAxis = e.flipAxis;
Expand Down
9 changes: 3 additions & 6 deletions app/lib/dialogs/import/add.dart
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ class _AddDialogState extends State<AddDialog> {
icon: Padding(
padding: const EdgeInsets.all(4),
child: PhosphorIcon(
handler.getIcon(bloc) ?? tool.icon(PhosphorIconsStyle.light),
handler.getIcon(bloc) ?? tool.icon(),
color: status == ToolStatus.disabled
? Theme.of(context).disabledColor
: null,
Expand Down Expand Up @@ -371,10 +371,7 @@ class _AddDialogState extends State<AddDialog> {
textDirection: TextDirection.ltr,
),
),
icon: PhosphorIcon(
type.icon(PhosphorIconsStyle.light),
textDirection: TextDirection.ltr,
),
icon: PhosphorIcon(type.icon(), textDirection: TextDirection.ltr),
onTap: () async {
final bloc = context.read<DocumentBloc>();
final importService = context.read<ImportService>();
Expand Down Expand Up @@ -452,7 +449,7 @@ class _AddDialogState extends State<AddDialog> {
_buildSection(
context,
title: category.getLocalizedName(context),
icon: category.icon(PhosphorIconsStyle.light),
icon: category.icon(),
children: category == ToolCategory.import
? [
...importItems,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/dialogs/template.dart
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ class _TemplateDetailsViewState extends State<_TemplateDetailsView> {
SizedBox.square(
dimension: 64,
child: OptionButton(
icon: Icon(tool.icon(PhosphorIconsStyle.light)),
icon: Icon(tool.icon()),
tooltip: tool.name,
),
),
Expand Down
19 changes: 13 additions & 6 deletions app/lib/renderers/renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,19 @@ enum RendererOperation {
};
}

IconGetter get icon => switch (this) {
RendererOperation.invert => PhosphorIcons.circleHalf,
RendererOperation.background => PhosphorIcons.paintBucket,
RendererOperation.grayscale => PhosphorIcons.palette,
RendererOperation.flipHorizontal => PhosphorIcons.flipHorizontal,
RendererOperation.flipVertical => PhosphorIcons.flipVertical,
PhosphorIconData icon({bool filled = false}) => switch (this) {
RendererOperation.invert =>
filled ? PhosphorIconsFill.circleHalf : PhosphorIconsLight.circleHalf,
RendererOperation.background =>
filled ? PhosphorIconsFill.paintBucket : PhosphorIconsLight.paintBucket,
RendererOperation.grayscale =>
filled ? PhosphorIconsFill.palette : PhosphorIconsLight.palette,
RendererOperation.flipHorizontal =>
filled
? PhosphorIconsFill.flipHorizontal
: PhosphorIconsLight.flipHorizontal,
RendererOperation.flipVertical =>
filled ? PhosphorIconsFill.flipVertical : PhosphorIconsLight.flipVertical,
};

Axis? get flipAxis => switch (this) {
Expand Down
3 changes: 2 additions & 1 deletion app/lib/selections/area.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ class AreaSelection extends Selection<Area> {
AreaSelection(super.selected);

@override
IconGetter get icon => PhosphorIcons.monitor;
PhosphorIconData icon({bool filled = false}) =>
filled ? PhosphorIconsFill.monitor : PhosphorIconsLight.monitor;

@override
String getLocalizedName(BuildContext context) =>
Expand Down
3 changes: 2 additions & 1 deletion app/lib/selections/document.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ class DocumentSelection extends Selection<EditorController> {
DocumentSelection(EditorController cubit) : super([cubit]);

@override
IconGetter get icon => PhosphorIcons.wrench;
PhosphorIconData icon({bool filled = false}) =>
filled ? PhosphorIconsFill.wrench : PhosphorIconsLight.wrench;

@override
String getLocalizedName(BuildContext context) =>
Expand Down
3 changes: 2 additions & 1 deletion app/lib/selections/elements/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,6 @@ class ElementSelection<T extends PadElement> extends Selection<Renderer<T>> {
AppLocalizations.of(context).element;

@override
IconGetter get icon => PhosphorIcons.cube;
PhosphorIconData icon({bool filled = false}) =>
filled ? PhosphorIconsFill.cube : PhosphorIconsLight.cube;
}
3 changes: 2 additions & 1 deletion app/lib/selections/elements/image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class ImageElementSelection extends ElementSelection<ImageElement> {
}

@override
IconGetter get icon => PhosphorIcons.image;
PhosphorIconData icon({bool filled = false}) =>
filled ? PhosphorIconsFill.image : PhosphorIconsLight.image;

@override
String getLocalizedName(BuildContext context) =>
Expand Down
3 changes: 2 additions & 1 deletion app/lib/selections/elements/pdf.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class PdfElementSelection extends ElementSelection<PdfElement> {
}

@override
IconGetter get icon => PhosphorIcons.filePdf;
PhosphorIconData icon({bool filled = false}) =>
filled ? PhosphorIconsFill.filePdf : PhosphorIconsLight.filePdf;

@override
String getLocalizedName(BuildContext context) =>
Expand Down
3 changes: 2 additions & 1 deletion app/lib/selections/elements/pen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class PenElementSelection extends ElementSelection<PenElement> {
}

@override
IconGetter get icon => PhosphorIcons.pen;
PhosphorIconData icon({bool filled = false}) =>
filled ? PhosphorIconsFill.pen : PhosphorIconsLight.pen;

@override
String getLocalizedName(BuildContext context) =>
Expand Down
3 changes: 2 additions & 1 deletion app/lib/selections/elements/polygon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class PolygonElementSelection extends ElementSelection<PolygonElement> {
}

@override
IconGetter get icon => PhosphorIcons.polygon;
PhosphorIconData icon({bool filled = false}) =>
filled ? PhosphorIconsFill.polygon : PhosphorIconsLight.polygon;

@override
String getLocalizedName(BuildContext context) =>
Expand Down
5 changes: 3 additions & 2 deletions app/lib/selections/elements/shape.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ class ShapeElementSelection extends ElementSelection<ShapeElement> {
}

@override
IconGetter get icon => selected.first.element.property.shape.icon;
PhosphorIconData icon({bool filled = false}) =>
selected.first.element.property.shape.icon(filled: filled);

@override
String getLocalizedName(BuildContext context) =>
Expand Down Expand Up @@ -116,7 +117,7 @@ class _ShapeElementStrokeStyleSectionState
(e) => DropdownMenuEntry(
label: e.getLocalizedName(context),
value: e,
leadingIcon: Icon(e.icon(PhosphorIconsStyle.light)),
leadingIcon: Icon(e.icon()),
),
)
.toList(),
Expand Down
3 changes: 2 additions & 1 deletion app/lib/selections/elements/svg.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class SvgElementSelection extends ElementSelection<SvgElement> {
}

@override
IconGetter get icon => PhosphorIcons.fileSvg;
PhosphorIconData icon({bool filled = false}) =>
filled ? PhosphorIconsFill.fileSvg : PhosphorIconsLight.fileSvg;

@override
String getLocalizedName(BuildContext context) =>
Expand Down
3 changes: 2 additions & 1 deletion app/lib/selections/elements/table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ class TableElementSelection extends ElementSelection<TableElement> {
}

@override
IconGetter get icon => PhosphorIcons.table;
PhosphorIconData icon({bool filled = false}) =>
filled ? PhosphorIconsFill.table : PhosphorIconsLight.table;

@override
String getLocalizedName(BuildContext context) =>
Expand Down
3 changes: 2 additions & 1 deletion app/lib/selections/elements/text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class LabelElementSelection extends ElementSelection<PadElement> {
}

@override
IconGetter get icon => PhosphorIcons.textT;
PhosphorIconData icon({bool filled = false}) =>
filled ? PhosphorIconsFill.textT : PhosphorIconsLight.textT;

@override
String getLocalizedName(BuildContext context) =>
Expand Down
2 changes: 1 addition & 1 deletion app/lib/selections/selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ abstract class Selection<T> {

String getLocalizedCaption(BuildContext context) => '';

IconGetter get icon;
PhosphorIconData icon({bool filled = false});

List<Widget> buildProperties(BuildContext context) => [];

Expand Down
2 changes: 1 addition & 1 deletion app/lib/selections/tools/area.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class AreaToolSelection extends ToolSelection<AreaTool> {
.map(
(preset) => ButtonSegment<double>(
value: preset.ratio,
icon: PhosphorIcon(preset.icon(PhosphorIconsStyle.light)),
icon: PhosphorIcon(preset.icon()),
tooltip: preset.getLocalizedName(context),
),
)
Expand Down
4 changes: 1 addition & 3 deletions app/lib/selections/tools/asset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ class AssetToolSelection extends ToolSelection<AssetTool> {
(type) => DropdownMenuEntry(
value: type,
label: type.getLocalizedName(context),
leadingIcon: PhosphorIcon(
type.icon(PhosphorIconsStyle.light),
),
leadingIcon: PhosphorIcon(type.icon()),
),
)
.toList(),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/selections/tools/barcode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class BarcodeToolSelection extends ToolSelection<BarcodeTool> {
.map(
(e) => DropdownMenuEntry(
label: e.getLocalizedName(context),
leadingIcon: Icon(e.icon(PhosphorIconsStyle.light)),
leadingIcon: Icon(e.icon()),
value: e,
),
)
Expand Down
2 changes: 1 addition & 1 deletion app/lib/selections/tools/eraser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class EraserToolSelection extends ToolSelection<EraserTool> {
.map(
(e) => DropdownMenuEntry(
label: e.getLocalizedName(context),
leadingIcon: Icon(e.icon(PhosphorIconsStyle.light)),
leadingIcon: Icon(e.icon()),
value: e,
),
)
Expand Down
2 changes: 1 addition & 1 deletion app/lib/selections/tools/select.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class SelectToolSelection extends ToolSelection<SelectTool> {
.map(
(e) => DropdownMenuEntry(
label: e.getLocalizedName(context),
leadingIcon: Icon(e.icon(PhosphorIconsStyle.light)),
leadingIcon: Icon(e.icon()),
value: e,
),
)
Expand Down
7 changes: 4 additions & 3 deletions app/lib/selections/tools/shape.dart
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ class ShapeToolSelection extends ToolSelection<ShapeTool> {
}

@override
IconGetter get icon => selected.first.property.shape.icon;
PhosphorIconData icon({bool filled = false}) =>
selected.first.property.shape.icon(filled: filled);
}

class ShapeView extends StatefulWidget {
Expand Down Expand Up @@ -248,7 +249,7 @@ class _ShapeViewState extends State<ShapeView> {
(e) => DropdownMenuEntry(
label: e.key,
value: e.key,
leadingIcon: Icon(e.value.icon(PhosphorIconsStyle.light)),
leadingIcon: Icon(e.value.icon()),
),
)
.toList(),
Expand Down Expand Up @@ -432,7 +433,7 @@ class _StrokeStyleSectionState extends State<_StrokeStyleSection> {
(e) => DropdownMenuEntry(
label: e.getLocalizedName(context),
value: e,
leadingIcon: Icon(e.icon(PhosphorIconsStyle.light)),
leadingIcon: Icon(e.icon()),
),
)
.toList(),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/selections/tools/spacer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SpacerToolSelection extends ToolSelection<SpacerTool> {
.map(
(e) => DropdownMenuEntry(
label: e.getLocalizedName(context),
leadingIcon: Icon(e.icon(PhosphorIconsStyle.light)),
leadingIcon: Icon(e.icon()),
value: e,
),
)
Expand Down
3 changes: 2 additions & 1 deletion app/lib/selections/tools/table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class TableToolSelection extends ToolSelection<TableTool> {
}

@override
IconGetter get icon => PhosphorIcons.table;
PhosphorIconData icon({bool filled = false}) =>
filled ? PhosphorIconsFill.table : PhosphorIconsLight.table;
}

class _TableBorderControls extends StatefulWidget {
Expand Down
3 changes: 2 additions & 1 deletion app/lib/selections/tools/texture.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ class TextureToolSelection extends ToolSelection<TextureTool> {
}

@override
IconGetter get icon => selected.first.icon;
PhosphorIconData icon({bool filled = false}) =>
selected.first.icon(filled: filled);
}
8 changes: 5 additions & 3 deletions app/lib/selections/tools/tool.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,14 @@ class ToolSelection<T extends Tool> extends Selection<T> {
}

@override
IconGetter get icon {
PhosphorIconData icon({bool filled = false}) {
final type = selected.first.runtimeType;
if (selected.every((e) => e.runtimeType == type)) {
return selected.first.icon;
return selected.first.icon(filled: filled);
}
return PhosphorIcons.paintRoller;
return filled
? PhosphorIconsFill.paintRoller
: PhosphorIconsLight.paintRoller;
}

@override
Expand Down
4 changes: 2 additions & 2 deletions app/lib/settings/pages/connections.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ final _connectionsSettingsPage = SettingsLeapPage<ButterflySettings>(
)
: null,
leading: remote.icon?.isEmpty ?? true
? PhosphorIcon(remote.typeIcon(PhosphorIconsStyle.light))
? PhosphorIcon(remote.typeIcon())
: Image.memory(remote.icon!),
onTap: () => context.pushNamed(
'connection',
Expand Down Expand Up @@ -108,7 +108,7 @@ Widget? buildConnectionsSettingsFloatingActionButton(
.map(
(e) => ListTile(
title: Text(e.getLocalizedTypeName(context)),
leading: PhosphorIcon(e.typeIcon(PhosphorIconsStyle.light)),
leading: PhosphorIcon(e.typeIcon()),
onTap: () => Navigator.pop(context, e),
),
)
Expand Down
8 changes: 2 additions & 6 deletions app/lib/views/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,7 @@ class _AppBarTitleState extends State<_AppBarTitle> {
),
if (state.absolute)
IconButton(
icon: PhosphorIcon(
currentIndex.location.fileType.icon(PhosphorIconsStyle.light),
),
icon: PhosphorIcon(currentIndex.location.fileType.icon()),
tooltip: AppLocalizations.of(context).export,
onPressed: () => context.read<ImportService>().export(),
),
Expand Down Expand Up @@ -725,9 +723,7 @@ class MainPopupMenu extends StatelessWidget {
)
.map(
(e) => MenuItemButton(
leadingIcon: PhosphorIcon(
e.icon(PhosphorIconsStyle.light),
),
leadingIcon: PhosphorIcon(e.icon()),
child: Text(e.getLocalizedName(context)),
onPressed: () {
context
Expand Down
Loading
Loading