diff --git a/api/lib/src/models/element.dart b/api/lib/src/models/element.dart index cbe677d719e4..0703e6b6650d 100644 --- a/api/lib/src/models/element.dart +++ b/api/lib/src/models/element.dart @@ -53,8 +53,7 @@ abstract class PathElement { PathProperty get property; } -mixin LabelElement on PadElement { - @override +mixin LabelElement { String get layer; Point get position; double get scale; @@ -63,7 +62,8 @@ mixin LabelElement on PadElement { int get foreground; AreaProperty get areaProperty { - return maybeMap( + final element = this as PadElement; + return element.maybeMap( markdown: (e) => e.areaProperty, text: (e) => e.area.areaProperty, orElse: () => throw UnimplementedError(), @@ -71,7 +71,8 @@ mixin LabelElement on PadElement { } String get text { - return maybeMap( + final element = this as PadElement; + return element.maybeMap( markdown: (e) => e.text, text: (e) => e.area.paragraph.text, orElse: () => throw UnimplementedError(), diff --git a/app/lib/handlers/label.dart b/app/lib/handlers/label.dart index 6726ae50e81a..92e850ba03f7 100644 --- a/app/lib/handlers/label.dart +++ b/app/lib/handlers/label.dart @@ -159,7 +159,7 @@ class LabelHandler extends Handler } else { final page = context.getPage(); if (page == null) return; - final index = page.content.indexOf(labelRenderer.element); + final index = page.content.indexOf(labelRenderer.element as PadElement); context.getDocumentBloc().add(ElementsRemoved([index])); _context = _createContext(document, element: labelRenderer.element); } diff --git a/app/lib/selections/elements/text.dart b/app/lib/selections/elements/text.dart index d4df457d112e..5d45a29fca71 100644 --- a/app/lib/selections/elements/text.dart +++ b/app/lib/selections/elements/text.dart @@ -1,11 +1,11 @@ part of '../selection.dart'; -class LabelElementSelection extends ElementSelection { +class LabelElementSelection extends ElementSelection { LabelElementSelection(super.selected); @override List buildProperties(BuildContext context) { - final element = selected.first.element; + final element = selected.first.element as LabelElement; return [ ...super.buildProperties(context), ExactSlider( @@ -40,7 +40,8 @@ class LabelElementSelection extends ElementSelection { @override Selection insert(element) { if (element is Renderer) { - return LabelElementSelection([...selected, element]); + return LabelElementSelection( + [...selected, element as Renderer]); } return super.insert(element); } diff --git a/app/lib/selections/tools/label.dart b/app/lib/selections/tools/label.dart index 485f29ac1e66..eb49f47a7675 100644 --- a/app/lib/selections/tools/label.dart +++ b/app/lib/selections/tools/label.dart @@ -8,29 +8,8 @@ class LabelToolSelection extends ToolSelection { final bloc = context.read(); final state = bloc.state; if (state is! DocumentLoadSuccess) return []; - final packs = state.data.getPacks(); - final packName = selected.first.styleSheet.pack; - final currentPack = state.data.getPack(packName); return [ ...super.buildProperties(context), - CheckboxListTile( - value: selected.first.zoomDependent, - title: Text(AppLocalizations.of(context).zoomDependent), - onChanged: (value) => update( - context, - selected - .map((e) => e.copyWith( - zoomDependent: value ?? selected.first.zoomDependent)) - .toList())), - ExactSlider( - header: Text(AppLocalizations.of(context).scale), - min: 0.1, - max: 15, - value: selected.first.scale, - defaultValue: 5, - onChangeEnd: (value) => update( - context, selected.map((e) => e.copyWith(scale: value)).toList()), - ), ColorField( value: Color(selected.first.foreground), onChanged: (value) => update(context, @@ -52,60 +31,6 @@ class LabelToolSelection extends ToolSelection { Color(e.foreground).withAlpha(value.toInt()).value)) .toList()), ), - const SizedBox(height: 16), - DropdownButtonFormField( - items: packs - .map((e) => DropdownMenuItem(value: e, child: Text(e))) - .toList(), - decoration: InputDecoration( - labelText: AppLocalizations.of(context).pack, - filled: true, - counterText: - packs.isEmpty ? AppLocalizations.of(context).noPacks : null, - suffixIcon: IconButton( - icon: const PhosphorIcon(PhosphorIconsLight.package), - tooltip: AppLocalizations.of(context).packs, - onPressed: () { - Actions.maybeInvoke(context, PacksIntent(context)); - }, - ), - ), - value: currentPack?.name, - onChanged: (pack) { - if (pack == null) return; - update( - context, - selected - .map((e) => e.copyWith(styleSheet: PackAssetLocation(pack))) - .toList()); - }, - ), - const SizedBox(height: 8), - const Divider(), - const SizedBox(height: 8), - Column( - children: currentPack - ?.getStyles() - .map((style) => Dismissible( - key: ValueKey(style), - background: Container(color: Colors.red), - onDismissed: (direction) { - bloc.add(PackUpdated( - packName, currentPack.removeStyle(style))); - }, - child: ListTile( - title: Text(style), - selected: style == selected.first.styleSheet.name, - onTap: () => update( - context, - selected - .map((e) => e.copyWith( - styleSheet: - PackAssetLocation(packName, style))) - .toList()), - ))) - .toList() ?? - []), ]; } diff --git a/app/lib/views/app_bar.dart b/app/lib/views/app_bar.dart index b92815785f78..2099e9ff5f18 100644 --- a/app/lib/views/app_bar.dart +++ b/app/lib/views/app_bar.dart @@ -569,9 +569,7 @@ class _MainPopupMenu extends StatelessWidget { ), ), ), - builder: (BuildContext context, MenuController controller, - Widget? child) => - Align( + builder: (context, controller, child) => Align( child: AspectRatio( aspectRatio: 1, child: IconButton( diff --git a/app/lib/views/property.dart b/app/lib/views/property.dart index 9124fc0a1fb4..b6820161b01f 100644 --- a/app/lib/views/property.dart +++ b/app/lib/views/property.dart @@ -151,7 +151,9 @@ class _PropertyViewState extends State : MenuAnchor( controller: controller, builder: defaultFilledMenuButton( - icon: Row( + iconBuilder: + (context, controller, child) => + Row( children: [ icon, const SizedBox(width: 8), diff --git a/app/pubspec.lock b/app/pubspec.lock index 9b470cebabba..abcaee264f99 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -796,8 +796,8 @@ packages: dependency: "direct main" description: path: "packages/material_leap" - ref: "524e4189e7b36bda022b6b153778e701a74f4dc1" - resolved-ref: "524e4189e7b36bda022b6b153778e701a74f4dc1" + ref: "0ec9d6cdeffd298f1f8165059d8df1aecb5e7cb9" + resolved-ref: "0ec9d6cdeffd298f1f8165059d8df1aecb5e7cb9" url: "https://github.com/LinwoodDev/dart_pkgs.git" source: git version: "0.0.1" diff --git a/app/pubspec.yaml b/app/pubspec.yaml index e68509677a39..8ff22ced2704 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -70,7 +70,7 @@ dependencies: material_leap: git: url: https://github.com/LinwoodDev/dart_pkgs.git - ref: 524e4189e7b36bda022b6b153778e701a74f4dc1 + ref: 0ec9d6cdeffd298f1f8165059d8df1aecb5e7cb9 path: packages/material_leap lw_sysinfo: git: diff --git a/fastlane/metadata/android/en-US/changelogs/86.txt b/fastlane/metadata/android/en-US/changelogs/86.txt index 7614620dd8d5..1a8e4a312f12 100644 --- a/fastlane/metadata/android/en-US/changelogs/86.txt +++ b/fastlane/metadata/android/en-US/changelogs/86.txt @@ -3,4 +3,5 @@ * Add scale to label selection view * Add markdown element selection view * Fix moving data directory ([#562](https://github.com/LinwoodDev/Butterfly/issues/562)) -* Fix various issues with the label tool \ No newline at end of file +* Fix various issues with the label tool +* Fix display icon \ No newline at end of file