diff --git a/app/android/Gemfile.lock b/app/android/Gemfile.lock index 3b13b0dd607f..35c785bb70c2 100644 --- a/app/android/Gemfile.lock +++ b/app/android/Gemfile.lock @@ -8,7 +8,7 @@ GEM artifactory (3.0.15) atomos (0.1.3) aws-eventstream (1.2.0) - aws-partitions (1.834.0) + aws-partitions (1.835.0) aws-sdk-core (3.185.1) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) @@ -107,7 +107,7 @@ GEM xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3) gh_inspector (1.1.3) - google-apis-androidpublisher_v3 (0.50.0) + google-apis-androidpublisher_v3 (0.51.0) google-apis-core (>= 0.11.0, < 2.a) google-apis-core (0.11.1) addressable (~> 2.5, >= 2.5.1) diff --git a/app/lib/dialogs/file_system/move.dart b/app/lib/dialogs/file_system/move.dart index 6f9fd188eb45..7604ff3de7ea 100644 --- a/app/lib/dialogs/file_system/move.dart +++ b/app/lib/dialogs/file_system/move.dart @@ -53,17 +53,11 @@ class _FileSystemAssetMoveDialogState extends State { @override Widget build(BuildContext context) { - String title; - switch (widget.moveMode) { - case MoveMode.duplicate: - title = AppLocalizations.of(context).duplicate; - break; - case MoveMode.move: - title = AppLocalizations.of(context).move; - break; - default: - title = AppLocalizations.of(context).changeDocumentPath; - } + String title = switch (widget.moveMode) { + MoveMode.duplicate => AppLocalizations.of(context).duplicate, + MoveMode.move => AppLocalizations.of(context).move, + _ => AppLocalizations.of(context).changeDocumentPath, + }; return AlertDialog( actions: [ TextButton( diff --git a/app/lib/dialogs/packs/select.dart b/app/lib/dialogs/packs/select.dart index 0c3930a51a1f..cab334b792f5 100644 --- a/app/lib/dialogs/packs/select.dart +++ b/app/lib/dialogs/packs/select.dart @@ -21,31 +21,17 @@ class SelectPackAssetDialog extends StatelessWidget { this.selected, }); - List _getAssets(NoteData document) { - final packs = document - .getPacks() - .map((e) => document.getPack(e)) - .whereNotNull() - .toList(); - switch (type) { - case PackAssetType.component: - return packs - .expand((pack) => pack - .getComponents() - .map((e) => PackAssetLocation(pack.name!, e))) - .toList(); - case PackAssetType.style: - return packs - .expand((pack) => - pack.getStyles().map((e) => PackAssetLocation(pack.name!, e))) - .toList(); - case PackAssetType.palette: - return packs - .expand((pack) => - pack.getPalettes().map((e) => PackAssetLocation(pack.name!, e))) - .toList(); - } - } + List _getAssets(NoteData document) => document + .getPacks() + .map((e) => document.getPack(e)) + .whereNotNull() + .expand((pack) => switch (type) { + PackAssetType.component => pack.getComponents(), + PackAssetType.style => pack.getStyles(), + PackAssetType.palette => pack.getPalettes(), + } + .map((e) => PackAssetLocation(pack.name!, e))) + .toList(); NoteData _createAsset(NoteData pack, String name) => switch (type) { PackAssetType.component => diff --git a/app/lib/dialogs/packs/styles/text.dart b/app/lib/dialogs/packs/styles/text.dart index b9e5f04feb57..4bf2e5fcf939 100644 --- a/app/lib/dialogs/packs/styles/text.dart +++ b/app/lib/dialogs/packs/styles/text.dart @@ -1,3 +1,4 @@ +import 'package:butterfly/visualizer/text.dart'; import 'package:butterfly_api/butterfly_text.dart' as text; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; @@ -181,32 +182,12 @@ class _TextStyleViewState extends State { initialSelection: widget.value.decorationStyle, dropdownMenuEntries: [ ...text.TextDecorationStyle.values - .map((style) { - String name; - switch (style) { - case text.TextDecorationStyle.solid: - name = - AppLocalizations.of(context).solid; - break; - case text.TextDecorationStyle.dashed: - name = - AppLocalizations.of(context).dashed; - break; - case text.TextDecorationStyle.dotted: - name = - AppLocalizations.of(context).dotted; - break; - case text.TextDecorationStyle.double: - name = - AppLocalizations.of(context).double; - break; - case text.TextDecorationStyle.wavy: - name = - AppLocalizations.of(context).wavy; - } - return DropdownMenuEntry( - value: style, label: name); - }).toList(), + .map((style) => DropdownMenuEntry( + value: style, + label: + style.getLocalizedName(context), + )) + .toList(), DropdownMenuEntry( value: null, label: AppLocalizations.of(context).notSet, diff --git a/app/lib/handlers/select.dart b/app/lib/handlers/select.dart index 24a9060730f9..815626dca298 100644 --- a/app/lib/handlers/select.dart +++ b/app/lib/handlers/select.dart @@ -120,28 +120,17 @@ extension HandTransformCornerExtension on HandTransformCorner { } } - Offset getFromRect(Rect rect) { - switch (this) { - case HandTransformCorner.topLeft: - return rect.topLeft; - case HandTransformCorner.topCenter: - return rect.topCenter; - case HandTransformCorner.topRight: - return rect.topRight; - case HandTransformCorner.centerLeft: - return rect.centerLeft; - case HandTransformCorner.centerRight: - return rect.centerRight; - case HandTransformCorner.bottomLeft: - return rect.bottomLeft; - case HandTransformCorner.bottomCenter: - return rect.bottomCenter; - case HandTransformCorner.bottomRight: - return rect.bottomRight; - case HandTransformCorner.center: - return rect.center; - } - } + Offset getFromRect(Rect rect) => switch (this) { + HandTransformCorner.topLeft => rect.topLeft, + HandTransformCorner.topCenter => rect.topCenter, + HandTransformCorner.topRight => rect.topRight, + HandTransformCorner.centerLeft => rect.centerLeft, + HandTransformCorner.centerRight => rect.centerRight, + HandTransformCorner.bottomLeft => rect.bottomLeft, + HandTransformCorner.bottomCenter => rect.bottomCenter, + HandTransformCorner.bottomRight => rect.bottomRight, + HandTransformCorner.center => rect.center, + }; } class SelectHandler extends Handler { diff --git a/app/lib/models/label.dart b/app/lib/models/label.dart index 01ba6b526491..6df8f7558ab5 100644 --- a/app/lib/models/label.dart +++ b/app/lib/models/label.dart @@ -197,13 +197,10 @@ extension LabelElementLayouter on LabelElement { Point getOffset(double height) { final align = areaProperty.alignment; final current = position; - switch (align) { - case txt.VerticalAlignment.top: - return current; - case txt.VerticalAlignment.bottom: - return current + Point(0, height); - case txt.VerticalAlignment.center: - return current + Point(0, height / 2); - } + return switch (align) { + txt.VerticalAlignment.top => current, + txt.VerticalAlignment.bottom => current + Point(0, height), + txt.VerticalAlignment.center => current + Point(0, height / 2), + }; } } diff --git a/app/lib/services/import.dart b/app/lib/services/import.dart index c6fd2f1ca33b..993db83bcb67 100644 --- a/app/lib/services/import.dart +++ b/app/lib/services/import.dart @@ -85,23 +85,16 @@ class ImportService { } Future import( - AssetFileType type, Uint8List bytes, NoteData document, - {Offset? position}) async { - switch (type) { - case AssetFileType.note: - return importBfly(bytes, document, position); - case AssetFileType.image: - return importImage(bytes, document, position); - case AssetFileType.svg: - return importSvg(bytes, document, position); - case AssetFileType.markdown: - return importMarkdown(bytes, document, position); - case AssetFileType.pdf: - return importPdf(bytes, document, position, true); - case AssetFileType.page: - return importPage(bytes, document, position); - } - } + AssetFileType type, Uint8List bytes, NoteData document, + {Offset? position}) async => + switch (type) { + AssetFileType.note => importBfly(bytes, document, position), + AssetFileType.image => importImage(bytes, document, position), + AssetFileType.svg => importSvg(bytes, document, position), + AssetFileType.markdown => importMarkdown(bytes, document, position), + AssetFileType.pdf => importPdf(bytes, document, position, true), + AssetFileType.page => importPage(bytes, document, position), + }; FutureOr importBfly(Uint8List bytes, [NoteData? document, Offset? position]) async { diff --git a/app/lib/settings/home.dart b/app/lib/settings/home.dart index 03cbbd67da0f..65695c79ac70 100644 --- a/app/lib/settings/home.dart +++ b/app/lib/settings/home.dart @@ -20,36 +20,22 @@ enum SettingsView { personalization, connections; - String getLocalizedName(BuildContext context) { - switch (this) { - case SettingsView.general: - return AppLocalizations.of(context).general; - case SettingsView.data: - return AppLocalizations.of(context).data; - case SettingsView.behaviors: - return AppLocalizations.of(context).behaviors; - case SettingsView.personalization: - return AppLocalizations.of(context).personalization; - case SettingsView.connections: - return AppLocalizations.of(context).connections; - } - } - - PhosphorIconData getIcon() { - switch (this) { - case SettingsView.general: - return PhosphorIconsLight.gear; - case SettingsView.data: - return PhosphorIconsLight.database; - case SettingsView.behaviors: - return PhosphorIconsLight.faders; - case SettingsView.personalization: - return PhosphorIconsLight.monitor; - case SettingsView.connections: - return PhosphorIconsLight.cloud; - } - } + String getLocalizedName(BuildContext context) => switch (this) { + SettingsView.general => AppLocalizations.of(context).general, + SettingsView.data => AppLocalizations.of(context).data, + SettingsView.behaviors => AppLocalizations.of(context).behaviors, + SettingsView.personalization => + AppLocalizations.of(context).personalization, + SettingsView.connections => AppLocalizations.of(context).connections, + }; + IconGetter get icon => switch (this) { + SettingsView.general => PhosphorIcons.gear, + SettingsView.data => PhosphorIcons.database, + SettingsView.behaviors => PhosphorIcons.faders, + SettingsView.personalization => PhosphorIcons.monitor, + SettingsView.connections => PhosphorIcons.cloud, + }; String get path => '/settings/$name'; } @@ -107,7 +93,8 @@ class _SettingsPageState extends State { shrinkWrap: true, children: [ ...SettingsView.values.map((view) => ListTile( - leading: PhosphorIcon(view.getIcon()), + leading: PhosphorIcon( + view.icon(PhosphorIconsStyle.light)), title: Text(view.getLocalizedName(context)), onTap: () => navigateTo(view), selected: _view == view && !isMobile, @@ -146,24 +133,15 @@ class _SettingsPageState extends State { if (isMobile) { return navigation; } - Widget content; - switch (_view) { - case SettingsView.general: - content = const GeneralSettingsPage(inView: true); - break; - case SettingsView.data: - content = const DataSettingsPage(inView: true); - break; - case SettingsView.behaviors: - content = const BehaviorsSettingsPage(inView: true); - break; - case SettingsView.personalization: - content = const PersonalizationSettingsPage(inView: true); - break; - case SettingsView.connections: - content = const ConnectionsSettingsPage(inView: true); - break; - } + final content = switch (_view) { + SettingsView.general => const GeneralSettingsPage(inView: true), + SettingsView.data => const DataSettingsPage(inView: true), + SettingsView.behaviors => const BehaviorsSettingsPage(inView: true), + SettingsView.personalization => + const PersonalizationSettingsPage(inView: true), + SettingsView.connections => + const ConnectionsSettingsPage(inView: true), + }; return Row(crossAxisAlignment: CrossAxisAlignment.stretch, children: [ SizedBox(width: 300, child: navigation), Expanded(child: content), diff --git a/app/lib/settings/personalization.dart b/app/lib/settings/personalization.dart index d5b7f95c7dce..5aac3aaf1450 100644 --- a/app/lib/settings/personalization.dart +++ b/app/lib/settings/personalization.dart @@ -14,18 +14,11 @@ class PersonalizationSettingsPage extends StatelessWidget { final bool inView; const PersonalizationSettingsPage({super.key, this.inView = false}); - String _getThemeName(BuildContext context, ThemeMode mode) { - switch (mode) { - case ThemeMode.system: - return AppLocalizations.of(context).systemTheme; - case ThemeMode.light: - return AppLocalizations.of(context).lightTheme; - case ThemeMode.dark: - return AppLocalizations.of(context).darkTheme; - default: - return AppLocalizations.of(context).systemTheme; - } - } + String _getThemeName(BuildContext context, ThemeMode mode) => switch (mode) { + ThemeMode.system => AppLocalizations.of(context).systemTheme, + ThemeMode.light => AppLocalizations.of(context).lightTheme, + ThemeMode.dark => AppLocalizations.of(context).darkTheme, + }; String _getPlatformThemeName(BuildContext context, PlatformTheme theme) => switch (theme) { diff --git a/app/lib/views/files.dart b/app/lib/views/files.dart index f5a18ada5084..f8ba74cb6932 100644 --- a/app/lib/views/files.dart +++ b/app/lib/views/files.dart @@ -80,16 +80,11 @@ class _FilesViewState extends State { } } - String getLocalizedNameOfSortBy(SortBy sortBy) { - switch (sortBy) { - case SortBy.name: - return AppLocalizations.of(context).name; - case SortBy.created: - return AppLocalizations.of(context).created; - case SortBy.modified: - return AppLocalizations.of(context).modified; - } - } + String getLocalizedNameOfSortBy(SortBy sortBy) => switch (sortBy) { + SortBy.name => AppLocalizations.of(context).name, + SortBy.created => AppLocalizations.of(context).created, + SortBy.modified => AppLocalizations.of(context).modified, + }; void _setFilesFuture() { _fileSystem = DocumentFileSystem.fromPlatform(remote: _remote); diff --git a/app/lib/views/home.dart b/app/lib/views/home.dart index c2dbc045c47f..0c8eef48ef6f 100644 --- a/app/lib/views/home.dart +++ b/app/lib/views/home.dart @@ -17,28 +17,21 @@ import '../api/open_release_notes.dart'; import '../main.dart'; import 'files.dart'; -PhosphorIconData _getIconOfBannerVisibility(BannerVisibility visibility) { - switch (visibility) { - case BannerVisibility.always: - return PhosphorIconsLight.caretDown; - case BannerVisibility.never: - return PhosphorIconsLight.caretUp; - case BannerVisibility.onlyOnUpdates: - return PhosphorIconsLight.caretRight; - } -} +PhosphorIconData _getIconOfBannerVisibility(BannerVisibility visibility) => + switch (visibility) { + BannerVisibility.always => PhosphorIconsLight.caretDown, + BannerVisibility.never => PhosphorIconsLight.caretUp, + BannerVisibility.onlyOnUpdates => PhosphorIconsLight.caretRight, + }; String _getLocalizedNameOfBannerVisibility( - BuildContext context, BannerVisibility visibility) { - switch (visibility) { - case BannerVisibility.always: - return AppLocalizations.of(context).always; - case BannerVisibility.never: - return AppLocalizations.of(context).never; - case BannerVisibility.onlyOnUpdates: - return AppLocalizations.of(context).onlyOnUpdates; - } -} + BuildContext context, BannerVisibility visibility) => + switch (visibility) { + BannerVisibility.always => AppLocalizations.of(context).always, + BannerVisibility.never => AppLocalizations.of(context).never, + BannerVisibility.onlyOnUpdates => + AppLocalizations.of(context).onlyOnUpdates, + }; Widget _getBannerVisibilityWidget( BuildContext context, ButterflySettings settings) { diff --git a/app/lib/visualizer/element.dart b/app/lib/visualizer/element.dart index 1dc7b499db23..c8c09619fb31 100644 --- a/app/lib/visualizer/element.dart +++ b/app/lib/visualizer/element.dart @@ -73,32 +73,21 @@ extension ElementConstraintsVisualizer on ElementConstraints? { } extension LabelModeVisualizer on LabelMode { - String getLocalizedName(BuildContext context) { - switch (this) { - case LabelMode.markdown: - return AppLocalizations.of(context).markdown; - case LabelMode.text: - return AppLocalizations.of(context).text; - } - } + String getLocalizedName(BuildContext context) => switch (this) { + LabelMode.markdown => AppLocalizations.of(context).markdown, + LabelMode.text => AppLocalizations.of(context).text, + }; - IconGetter get icon { - switch (this) { - case LabelMode.markdown: - return PhosphorIcons.textbox; - case LabelMode.text: - return PhosphorIcons.textT; - } - } + IconGetter get icon => switch (this) { + LabelMode.markdown => PhosphorIcons.textbox, + LabelMode.text => PhosphorIcons.textT, + }; } extension SurfaceTextureVisualizer on SurfaceTexture { - String getLocalizedName(BuildContext context) { - final loc = AppLocalizations.of(context); - return switch (this) { - PatternTexture() => loc.pattern, - }; - } + String getLocalizedName(BuildContext context) => switch (this) { + PatternTexture() => AppLocalizations.of(context).pattern, + }; IconGetter get icon => switch (this) { PatternTexture() => PhosphorIcons.gridFour, diff --git a/app/lib/visualizer/event.dart b/app/lib/visualizer/event.dart index 89e29f1903bf..e51a831c9932 100644 --- a/app/lib/visualizer/event.dart +++ b/app/lib/visualizer/event.dart @@ -7,28 +7,18 @@ import 'package:phosphor_flutter/phosphor_flutter.dart'; extension ArangementVisualizer on Arrangement { String getLocalizedName(BuildContext context) { final loc = AppLocalizations.of(context); - switch (this) { - case Arrangement.back: - return loc.sendToBack; - case Arrangement.front: - return loc.bringToFront; - case Arrangement.backward: - return loc.sendBackward; - case Arrangement.forward: - return loc.bringForward; - } + return switch (this) { + Arrangement.back => loc.sendToBack, + Arrangement.front => loc.bringToFront, + Arrangement.backward => loc.sendBackward, + Arrangement.forward => loc.bringForward, + }; } - IconGetter get icon { - switch (this) { - case Arrangement.back: - return PhosphorIcons.arrowDown; - case Arrangement.front: - return PhosphorIcons.arrowUp; - case Arrangement.backward: - return PhosphorIcons.arrowDownLeft; - case Arrangement.forward: - return PhosphorIcons.arrowUpRight; - } - } + IconGetter get icon => switch (this) { + Arrangement.back => PhosphorIcons.arrowDown, + Arrangement.front => PhosphorIcons.arrowUp, + Arrangement.backward => PhosphorIcons.arrowDownLeft, + Arrangement.forward => PhosphorIcons.arrowUpRight, + }; } diff --git a/app/lib/visualizer/preset.dart b/app/lib/visualizer/preset.dart index b5b51747e339..ace19b9ad2e7 100644 --- a/app/lib/visualizer/preset.dart +++ b/app/lib/visualizer/preset.dart @@ -16,14 +16,10 @@ extension PatternTemplateHelper on PatternTemplate { } extension AspectRatioPresetVisualizer on AspectRatioPreset { - String getLocalizedName(BuildContext context) { - switch (this) { - case AspectRatioPreset.square: - return AppLocalizations.of(context).square; - case AspectRatioPreset.portrait: - return AppLocalizations.of(context).pagePortrait; - case AspectRatioPreset.landscape: - return AppLocalizations.of(context).pageLandscape; - } - } + String getLocalizedName(BuildContext context) => switch (this) { + AspectRatioPreset.square => AppLocalizations.of(context).square, + AspectRatioPreset.portrait => AppLocalizations.of(context).pagePortrait, + AspectRatioPreset.landscape => + AppLocalizations.of(context).pageLandscape, + }; } diff --git a/app/lib/visualizer/sync.dart b/app/lib/visualizer/sync.dart index 6dc342b18f9d..b1eb1f32f3f8 100644 --- a/app/lib/visualizer/sync.dart +++ b/app/lib/visualizer/sync.dart @@ -6,119 +6,66 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:phosphor_flutter/phosphor_flutter.dart'; extension FileSyncStatusVisualizer on FileSyncStatus? { - String getLocalizedName(BuildContext context) { - switch (this) { - case FileSyncStatus.localLatest: - return AppLocalizations.of(context).localLatest; - case FileSyncStatus.remoteLatest: - return AppLocalizations.of(context).connectionLatest; - case FileSyncStatus.synced: - return AppLocalizations.of(context).synced; - case FileSyncStatus.conflict: - return AppLocalizations.of(context).conflict; - case FileSyncStatus.offline: - return AppLocalizations.of(context).offline; - default: - return AppLocalizations.of(context).loading; - } - } + String getLocalizedName(BuildContext context) => switch (this) { + FileSyncStatus.localLatest => AppLocalizations.of(context).localLatest, + FileSyncStatus.remoteLatest => + AppLocalizations.of(context).connectionLatest, + FileSyncStatus.synced => AppLocalizations.of(context).synced, + FileSyncStatus.conflict => AppLocalizations.of(context).conflict, + FileSyncStatus.offline => AppLocalizations.of(context).offline, + _ => AppLocalizations.of(context).loading, + }; - PhosphorIconData getIcon() { - switch (this) { - case FileSyncStatus.localLatest: - return PhosphorIconsLight.upload; - case FileSyncStatus.remoteLatest: - return PhosphorIconsLight.download; - case FileSyncStatus.synced: - return PhosphorIconsLight.check; - case FileSyncStatus.conflict: - return PhosphorIconsLight.warning; - case FileSyncStatus.offline: - return PhosphorIconsLight.wifiSlash; - default: - return PhosphorIconsLight.arrowClockwise; - } - } + PhosphorIconData getIcon() => switch (this) { + FileSyncStatus.localLatest => PhosphorIconsLight.upload, + FileSyncStatus.remoteLatest => PhosphorIconsLight.download, + FileSyncStatus.synced => PhosphorIconsLight.check, + FileSyncStatus.conflict => PhosphorIconsLight.warning, + FileSyncStatus.offline => PhosphorIconsLight.wifiSlash, + _ => PhosphorIconsLight.arrowClockwise, + }; - Color getColor(ColorScheme colorScheme) { - switch (this) { - case FileSyncStatus.synced: - return colorScheme.primary; - case FileSyncStatus.localLatest: - return colorScheme.secondary; - case FileSyncStatus.remoteLatest: - return colorScheme.tertiary; - case FileSyncStatus.conflict: - return colorScheme.error; - case FileSyncStatus.offline: - return colorScheme.onSurface; - default: - return colorScheme.onSurface; - } - } + Color getColor(ColorScheme colorScheme) => switch (this) { + FileSyncStatus.synced => colorScheme.primary, + FileSyncStatus.localLatest => colorScheme.secondary, + FileSyncStatus.remoteLatest => colorScheme.tertiary, + FileSyncStatus.conflict => colorScheme.error, + FileSyncStatus.offline => colorScheme.onSurface, + _ => colorScheme.onSurface, + }; } extension SyncStatusVisualizer on SyncStatus? { - String getLocalizedName(BuildContext context) { - switch (this) { - case SyncStatus.syncing: - return AppLocalizations.of(context).syncing; - case SyncStatus.synced: - return AppLocalizations.of(context).synced; - case SyncStatus.error: - return AppLocalizations.of(context).error; - default: - return AppLocalizations.of(context).loading; - } - } + String getLocalizedName(BuildContext context) => switch (this) { + SyncStatus.syncing => AppLocalizations.of(context).syncing, + SyncStatus.synced => AppLocalizations.of(context).synced, + SyncStatus.error => AppLocalizations.of(context).error, + _ => AppLocalizations.of(context).loading, + }; - PhosphorIconData getIcon() { - switch (this) { - case SyncStatus.syncing: - return PhosphorIconsLight.arrowClockwise; - case SyncStatus.synced: - return PhosphorIconsLight.check; - case SyncStatus.error: - return PhosphorIconsLight.warning; - default: - return PhosphorIconsLight.arrowClockwise; - } - } + PhosphorIconData getIcon() => switch (this) { + SyncStatus.synced => PhosphorIconsLight.check, + SyncStatus.error => PhosphorIconsLight.warning, + _ => PhosphorIconsLight.arrowClockwise, + }; - Color getColor(ColorScheme colorScheme) { - switch (this) { - case SyncStatus.syncing: - return colorScheme.onSurface; - case SyncStatus.synced: - return colorScheme.primary; - case SyncStatus.error: - return colorScheme.error; - default: - return colorScheme.onSurface; - } - } + Color getColor(ColorScheme colorScheme) => switch (this) { + SyncStatus.synced => colorScheme.primary, + SyncStatus.error => colorScheme.error, + _ => colorScheme.onSurface, + }; } extension SyncModeVisualizer on SyncMode { - String getLocalizedName(BuildContext context) { - switch (this) { - case SyncMode.always: - return AppLocalizations.of(context).always; - case SyncMode.noMobile: - return AppLocalizations.of(context).noMobile; - case SyncMode.manual: - return AppLocalizations.of(context).manual; - } - } + String getLocalizedName(BuildContext context) => switch (this) { + SyncMode.always => AppLocalizations.of(context).always, + SyncMode.noMobile => AppLocalizations.of(context).noMobile, + SyncMode.manual => AppLocalizations.of(context).manual, + }; - PhosphorIconData getIcon() { - switch (this) { - case SyncMode.always: - return PhosphorIconsLight.wifiHigh; - case SyncMode.noMobile: - return PhosphorIconsLight.wifiSlash; - case SyncMode.manual: - return PhosphorIconsLight.arrowClockwise; - } - } + PhosphorIconData getIcon() => switch (this) { + SyncMode.always => PhosphorIconsLight.wifiHigh, + SyncMode.noMobile => PhosphorIconsLight.wifiSlash, + SyncMode.manual => PhosphorIconsLight.arrowClockwise, + }; } diff --git a/app/lib/visualizer/text.dart b/app/lib/visualizer/text.dart index cf7351ccdcb3..84896dce91ec 100644 --- a/app/lib/visualizer/text.dart +++ b/app/lib/visualizer/text.dart @@ -1,37 +1,25 @@ import 'package:butterfly_api/butterfly_text.dart' as text; import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:material_leap/material_leap.dart'; extension HorizontalTextAlignmentFlutterConverter on text.HorizontalAlignment { - TextAlign toFlutter() { - switch (this) { - case text.HorizontalAlignment.left: - return TextAlign.left; - case text.HorizontalAlignment.right: - return TextAlign.right; - case text.HorizontalAlignment.center: - return TextAlign.center; - case text.HorizontalAlignment.justify: - return TextAlign.justify; - } - } + TextAlign toFlutter() => switch (this) { + text.HorizontalAlignment.left => TextAlign.left, + text.HorizontalAlignment.right => TextAlign.right, + text.HorizontalAlignment.center => TextAlign.center, + text.HorizontalAlignment.justify => TextAlign.justify, + }; } extension TextDecorationStyleFlutterConverter on text.TextDecorationStyle { - TextDecorationStyle toFlutter() { - switch (this) { - case text.TextDecorationStyle.solid: - return TextDecorationStyle.solid; - case text.TextDecorationStyle.double: - return TextDecorationStyle.double; - case text.TextDecorationStyle.dotted: - return TextDecorationStyle.dotted; - case text.TextDecorationStyle.dashed: - return TextDecorationStyle.dashed; - case text.TextDecorationStyle.wavy: - return TextDecorationStyle.wavy; - } - } + TextDecorationStyle toFlutter() => switch (this) { + text.TextDecorationStyle.solid => TextDecorationStyle.solid, + text.TextDecorationStyle.double => TextDecorationStyle.double, + text.TextDecorationStyle.dotted => TextDecorationStyle.dotted, + text.TextDecorationStyle.dashed => TextDecorationStyle.dashed, + text.TextDecorationStyle.wavy => TextDecorationStyle.wavy, + }; String toCss() => name; } @@ -94,3 +82,13 @@ extension StyleSheetVisualizer on text.TextStyleSheet { .map((e) => '$spanPrefix${e.key}{\n${e.value.toCss()}}') ].join('\n'); } + +extension TextDecorationStyleVisualizer on text.TextDecorationStyle { + String getLocalizedName(BuildContext context) => switch (this) { + text.TextDecorationStyle.solid => AppLocalizations.of(context).solid, + text.TextDecorationStyle.double => AppLocalizations.of(context).double, + text.TextDecorationStyle.dotted => AppLocalizations.of(context).dotted, + text.TextDecorationStyle.dashed => AppLocalizations.of(context).dashed, + text.TextDecorationStyle.wavy => AppLocalizations.of(context).wavy, + }; +} diff --git a/app/macos/Flutter/GeneratedPluginRegistrant.swift b/app/macos/Flutter/GeneratedPluginRegistrant.swift index d867c4028827..67b0dd802535 100644 --- a/app/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/app/macos/Flutter/GeneratedPluginRegistrant.swift @@ -21,7 +21,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin")) DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin")) FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) - FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) + FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PrintingPlugin.register(with: registry.registrar(forPlugin: "PrintingPlugin")) ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin")) diff --git a/app/pubspec.lock b/app/pubspec.lock index eca1f4dc5cfb..7617755a74bb 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -252,10 +252,10 @@ packages: dependency: "direct main" description: name: connectivity_plus - sha256: "94d51c6f1299133a2baa4c5c3d2c11ec7d7fb4768dee5c52a56f7d7522fcf70e" + sha256: b502a681ba415272ecc41400bd04fe543ed1a62632137dc84d25a91e7746f55f url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.0.1" connectivity_plus_platform_interface: dependency: transitive description: @@ -765,10 +765,10 @@ packages: dependency: "direct main" description: name: package_info_plus - sha256: "6ff267fcd9d48cb61c8df74a82680e8b82e940231bb5f68356672fde0397334a" + sha256: "7e76fad405b3e4016cd39d08f455a4eb5199723cf594cd1b8916d47140d93017" url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "4.2.0" package_info_plus_platform_interface: dependency: transitive description: @@ -1007,10 +1007,10 @@ packages: dependency: "direct main" description: name: share_plus - sha256: "6cec740fa0943a826951223e76218df002804adb588235a8910dc3d6b0654e11" + sha256: "2dafa6c1f8d8ee67b0e0587881947b78baab4671b7c08792cf91279e7ac14192" url: "https://pub.dev" source: hosted - version: "7.1.0" + version: "7.2.0" share_plus_platform_interface: dependency: transitive description: diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 829a216d0cef..4f651987babd 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -37,8 +37,8 @@ dependencies: url: https://github.com/CodeDoctorDE/phosphor-flutter ref: f370dd2c25d3ea51ffb8f1c7c183bc9f33889c82 replay_bloc: ^0.2.4 - share_plus: ^7.1.0 - package_info_plus: ^4.1.0 + share_plus: ^7.2.0 + package_info_plus: ^4.2.0 idb_shim: ^2.3.2 go_router: ^11.1.4 xml: ^6.4.2 @@ -60,7 +60,7 @@ dependencies: rxdart: ^0.27.7 archive: ^3.4.6 animations: ^2.0.8 - connectivity_plus: ^5.0.0 + connectivity_plus: ^5.0.1 cross_file: ^0.3.3+5 args: ^2.4.2 perfect_freehand: