diff --git a/api/pubspec.lock b/api/pubspec.lock index 407151a00bef..d47e1a1878d5 100644 --- a/api/pubspec.lock +++ b/api/pubspec.lock @@ -331,8 +331,8 @@ packages: dependency: "direct main" description: path: "packages/lw_file_system_api" - ref: a0752f136913f64a975cb8b20ccb16fb6ce37737 - resolved-ref: a0752f136913f64a975cb8b20ccb16fb6ce37737 + ref: "5ab1b96bea6ef0e0c07629ff4e7152b4437cf8ee" + resolved-ref: "5ab1b96bea6ef0e0c07629ff4e7152b4437cf8ee" url: "https://github.com/LinwoodDev/dart_pkgs" source: git version: "1.0.0" diff --git a/api/pubspec.yaml b/api/pubspec.yaml index f7c905ef61cc..0c8342dc6ea0 100644 --- a/api/pubspec.yaml +++ b/api/pubspec.yaml @@ -19,7 +19,7 @@ dependencies: git: url: https://github.com/LinwoodDev/dart_pkgs path: packages/lw_file_system_api - ref: a0752f136913f64a975cb8b20ccb16fb6ce37737 + ref: 5ab1b96bea6ef0e0c07629ff4e7152b4437cf8ee dart_leap: git: url: https://github.com/LinwoodDev/dart_pkgs diff --git a/app/lib/bloc/document_bloc.dart b/app/lib/bloc/document_bloc.dart index a7cb26e980b4..65c03f0be731 100644 --- a/app/lib/bloc/document_bloc.dart +++ b/app/lib/bloc/document_bloc.dart @@ -406,7 +406,9 @@ class DocumentBloc extends ReplayBloc { }).toList()))); final updatedCurrent = event.tools.entries.firstWhereOrNull((element) => oldTools[element.key] == - current.currentIndexCubit.state.handler.data); + current.currentIndexCubit.state.handler.data || + current.currentIndexCubit.state.toggleableHandlers + .containsKey(element.key)); if (updatedCurrent != null) { current.currentIndexCubit.updateTool(this, updatedCurrent.value); } diff --git a/app/lib/cubits/current_index.dart b/app/lib/cubits/current_index.dart index d1991b5abaae..9f4791a8b6e3 100644 --- a/app/lib/cubits/current_index.dart +++ b/app/lib/cubits/current_index.dart @@ -90,6 +90,12 @@ class CurrentIndex with _$CurrentIndex { ...rendererStates, ...?temporaryRendererStates, }; + + List getAllForegrounds([bool networking = true]) => [ + ...(temporaryForegrounds ?? foregrounds), + ...toggleableForegrounds.values.expand((e) => e), + if (networking) ...networkingForegrounds, + ]; } class CurrentIndexCubit extends Cubit { @@ -129,7 +135,7 @@ class CurrentIndexCubit extends Cubit { BuildContext? context, Handler? handler, }) async { - resetInput(bloc); + await resetInput(bloc); final blocState = bloc.state; if (blocState is! DocumentLoadSuccess) return null; final document = blocState.data; @@ -139,7 +145,11 @@ class CurrentIndexCubit extends Cubit { return null; } handler ??= Handler.fromTool(info.tools[index]); - if (context == null || handler.onSelected(context)) { + var selectState = SelectState.normal; + if (context != null) { + selectState = handler.onSelected(context); + } + if (selectState != SelectState.none) { state.handler.dispose(bloc); state.temporaryHandler?.dispose(bloc); _disposeForegrounds(); @@ -149,19 +159,36 @@ class CurrentIndexCubit extends Cubit { await Future.wait(foregrounds.map((e) async => await e.setup(document, blocState.assetService, blocState.page))); } - emit(state.copyWith( - index: index, - handler: handler, - cursor: handler.cursor ?? MouseCursor.defer, - foregrounds: foregrounds, - toolbar: handler.getToolbar(bloc), - rendererStates: handler.rendererStates, - temporaryForegrounds: null, - temporaryHandler: null, - temporaryToolbar: null, - temporaryCursor: null, - temporaryRendererStates: null, - )); + if (selectState == SelectState.normal) { + emit(state.copyWith( + index: index, + handler: handler, + cursor: handler.cursor ?? MouseCursor.defer, + foregrounds: foregrounds, + toolbar: handler.getToolbar(bloc), + rendererStates: handler.rendererStates, + temporaryForegrounds: null, + temporaryHandler: null, + temporaryToolbar: null, + temporaryCursor: null, + temporaryRendererStates: null, + )); + } else { + if (isHandlerEnabled(index)) { + disableHandler(bloc, index); + } else { + emit(state.copyWith( + toggleableHandlers: { + ...state.toggleableHandlers, + index: handler, + }, + toggleableForegrounds: { + ...state.toggleableForegrounds, + index: foregrounds + }, + )); + } + } } return handler; } @@ -186,7 +213,7 @@ class CurrentIndexCubit extends Cubit { cursor ??= state.lastPosition ?? Offset.zero; state.networkingService.sendUser(NetworkingUser( cursor: state.transformCubit.state.localToGlobal(cursor).toPoint(), - foreground: (foregrounds ?? getForegrounds(false)) + foreground: (foregrounds ?? state.getAllForegrounds(false)) .map((e) => e.element) .whereType() .toList(), @@ -427,9 +454,22 @@ class CurrentIndexCubit extends Cubit { return null; } - void enableHandler(DocumentBloc bloc, int index, Handler handler) { + void toggleHandler(DocumentBloc bloc, int index) { + if (state.toggleableHandlers.containsKey(index)) { + disableHandler(bloc, index); + } else { + enableHandler(bloc, index); + } + } + + Handler? enableHandler(DocumentBloc bloc, int index) { final blocState = bloc.state; - if (blocState is! DocumentLoaded) return; + if (blocState is! DocumentLoaded) return null; + if (index < 0 || index >= blocState.info.tools.length) { + return null; + } + final tool = blocState.info.tools[index]; + final handler = Handler.fromTool(tool); final document = blocState.data; final page = blocState.page; final info = blocState.info; @@ -445,6 +485,7 @@ class CurrentIndexCubit extends Cubit { ..[index] = handler, toggleableForegrounds: Map.from(state.toggleableForegrounds) ..[index] = foregrounds)); + return handler; } bool disableHandler(DocumentBloc bloc, int index) { @@ -453,14 +494,16 @@ class CurrentIndexCubit extends Cubit { return false; } handler.dispose(bloc); - final foregrounds = state.toggleableForegrounds[index]; - for (final r in foregrounds ?? []) { + final foregrounds = + Map>.from(state.toggleableForegrounds); + final current = foregrounds.remove(index); + for (final r in current ?? []) { r.dispose(); } emit(state.copyWith( - toggleableHandlers: Map.from(state.toggleableHandlers)..remove(index), - toggleableForegrounds: Map.from(state.toggleableForegrounds) - ..remove(index))); + toggleableHandlers: Map.from(state.toggleableHandlers)..remove(index), + toggleableForegrounds: foregrounds, + )); return true; } @@ -518,12 +561,14 @@ class CurrentIndexCubit extends Cubit { tool, bloc: bloc, temporaryState: temporaryState, + index: index, ); } Future?> changeTemporaryHandler( BuildContext context, T tool, {DocumentBloc? bloc, + int? index, TemporaryState temporaryState = TemporaryState.allowClick}) async { bloc ??= context.read(); final handler = Handler.fromTool(tool); @@ -533,7 +578,9 @@ class CurrentIndexCubit extends Cubit { final page = blocState.page; final currentArea = blocState.currentArea; state.temporaryHandler?.dispose(bloc); - if (handler.onSelected(context)) { + final selectState = handler.onSelected(context); + + if (selectState == SelectState.normal) { _disposeTemporaryForegrounds(); final temporaryForegrounds = handler.createForegrounds( this, document, page, blocState.info, currentArea); @@ -549,15 +596,12 @@ class CurrentIndexCubit extends Cubit { temporaryRendererStates: handler.rendererStates, temporaryState: temporaryState, )); + } else if (selectState == SelectState.toggle && index != null) { + toggleHandler(bloc, index); } return handler; } - List getForegrounds([bool networking = true]) => [ - ...(state.temporaryForegrounds ?? state.foregrounds), - if (networking) ...state.networkingForegrounds, - ]; - void resetReleaseHandler(DocumentBloc bloc) { if (state.temporaryState == TemporaryState.removeAfterRelease) { resetTemporaryHandler(bloc, true); @@ -989,8 +1033,8 @@ class CurrentIndexCubit extends Cubit { emit(state.copyWith(buttons: null)); } - void resetInput(DocumentBloc bloc) { - state.handler.resetInput(bloc); + Future resetInput(DocumentBloc bloc) async { + await state.handler.resetInput(bloc); emit(state.copyWith(buttons: null, pointers: [])); } diff --git a/app/lib/dialogs/import/add.dart b/app/lib/dialogs/import/add.dart index 81ca6d3a7761..65971d0e0a92 100644 --- a/app/lib/dialogs/import/add.dart +++ b/app/lib/dialogs/import/add.dart @@ -45,6 +45,7 @@ class _AddDialogState extends State { currentIndexCubit.changeTool( bloc, index: state.info.tools.length, + context: context, handler: Handler.fromTool(defaultTool), ); } diff --git a/app/lib/handlers/collection.dart b/app/lib/handlers/collection.dart index 43596e13d9fa..2a506068bb97 100644 --- a/app/lib/handlers/collection.dart +++ b/app/lib/handlers/collection.dart @@ -4,7 +4,7 @@ class CollectionHandler extends Handler { CollectionHandler(super.data); @override - bool onSelected(BuildContext context, [bool wasAdded = true]) { + SelectState onSelected(BuildContext context, [bool wasAdded = true]) { final bloc = context.read(); showDialog( context: context, @@ -13,6 +13,6 @@ class CollectionHandler extends Handler { child: const CollectionsDialog(), ), ); - return false; + return SelectState.normal; } } diff --git a/app/lib/handlers/export.dart b/app/lib/handlers/export.dart index d14cf11524ee..56f3bca4677b 100644 --- a/app/lib/handlers/export.dart +++ b/app/lib/handlers/export.dart @@ -4,7 +4,7 @@ class ExportHandler extends Handler { ExportHandler(super.data); @override - bool onSelected(BuildContext context, [bool wasAdded = true]) { + SelectState onSelected(BuildContext context, [bool wasAdded = true]) { final bloc = context.read(); showDialog( context: context, @@ -14,6 +14,6 @@ class ExportHandler extends Handler { options: data.options, ), )); - return false; + return SelectState.none; } } diff --git a/app/lib/handlers/eye_dropper.dart b/app/lib/handlers/eye_dropper.dart index 08b55243e22f..4c62dbe2feab 100644 --- a/app/lib/handlers/eye_dropper.dart +++ b/app/lib/handlers/eye_dropper.dart @@ -4,7 +4,7 @@ class EyeDropperHandler extends Handler { EyeDropperHandler(super.data); @override - bool onSelected(BuildContext context, [bool wasAdded = true]) { + SelectState onSelected(BuildContext context, [bool wasAdded = true]) { if (!wasAdded) { context.read().changeTemporaryHandler(context, data, temporaryState: TemporaryState.removeAfterRelease); diff --git a/app/lib/handlers/full_screen.dart b/app/lib/handlers/full_screen.dart index a87ecbd06b2b..7130bb1c48b4 100644 --- a/app/lib/handlers/full_screen.dart +++ b/app/lib/handlers/full_screen.dart @@ -4,9 +4,9 @@ class FullScreenHandler extends Handler { FullScreenHandler(super.data); @override - bool onSelected(BuildContext context, [bool wasAdded = true]) { + SelectState onSelected(BuildContext context, [bool wasAdded = true]) { context.read().toggleFullScreen(); - return false; + return SelectState.none; } @override diff --git a/app/lib/handlers/grid.dart b/app/lib/handlers/grid.dart new file mode 100644 index 000000000000..54076e8e424b --- /dev/null +++ b/app/lib/handlers/grid.dart @@ -0,0 +1,56 @@ +part of 'handler.dart'; + +class GridHandler extends Handler { + GridHandler(super.data); + + @override + List createForegrounds(CurrentIndexCubit currentIndexCubit, + NoteData document, DocumentPage page, DocumentInfo info, + [Area? currentArea]) => + [GridRenderer(data)]; + + @override + SelectState onSelected(BuildContext context, [bool wasAdded = true]) { + return SelectState.toggle; + } +} + +class GridRenderer extends Renderer { + GridRenderer(super.element); + + @override + void build(Canvas canvas, Size size, NoteData document, DocumentPage page, + DocumentInfo info, CameraTransform transform, + [ColorScheme? colorScheme, bool foreground = false]) { + if (element.xSize > 0) { + double x = 0; + while (x < size.width) { + final localX = x / transform.size; + canvas.drawLine( + Offset(localX + transform.position.dx, transform.position.dy), + Offset(localX + transform.position.dx, + size.height / transform.size + transform.position.dy), + Paint() + ..strokeWidth = 1 / transform.size + ..color = element.color.toColor(), + ); + x += element.xSize; + } + } + if (element.ySize > 0) { + double y = 0; + while (y < size.height) { + final localY = y / transform.size; + canvas.drawLine( + Offset(transform.position.dx, transform.position.dy + localY), + Offset(transform.position.dx + size.width / transform.size, + transform.position.dy + localY), + Paint() + ..strokeWidth = 1 / transform.size + ..color = element.color.toColor(), + ); + y += element.ySize; + } + } + } +} diff --git a/app/lib/handlers/handler.dart b/app/lib/handlers/handler.dart index a725c0b94336..6e14674fd7ba 100644 --- a/app/lib/handlers/handler.dart +++ b/app/lib/handlers/handler.dart @@ -70,6 +70,8 @@ part 'pen.dart'; part 'eye_dropper.dart'; part 'presentation.dart'; part 'redo.dart'; +part 'ruler.dart'; +part 'grid.dart'; part 'select.dart'; part 'shape.dart'; part 'spacer.dart'; @@ -153,12 +155,15 @@ class EventContext { enum ToolStatus { normal, disabled } +enum SelectState { normal, none, toggle } + abstract class Handler { final T data; const Handler(this.data); - bool onSelected(BuildContext context, [bool wasAdded = true]) => true; + SelectState onSelected(BuildContext context, [bool wasAdded = true]) => + SelectState.normal; List createForegrounds(CurrentIndexCubit currentIndexCubit, NoteData document, DocumentPage page, DocumentInfo info, @@ -210,7 +215,7 @@ abstract class Handler { bool canChange(PointerDownEvent event, EventContext context) => true; - void resetInput(DocumentBloc bloc) {} + FutureOr resetInput(DocumentBloc bloc) {} ToolStatus getStatus(DocumentBloc bloc) => ToolStatus.normal; @@ -244,7 +249,8 @@ abstract class Handler { AssetTool() => AssetHandler(tool), EyeDropperTool() => EyeDropperHandler(tool), ExportTool() => ExportHandler(tool), - _ => FallbackHandler(tool), + GridTool() => GridHandler(tool), + RulerTool() => RulerHandler(tool), } as Handler; } diff --git a/app/lib/handlers/redo.dart b/app/lib/handlers/redo.dart index 7c6eb72bb6ba..d52e1f14379e 100644 --- a/app/lib/handlers/redo.dart +++ b/app/lib/handlers/redo.dart @@ -4,11 +4,11 @@ class RedoHandler extends Handler { RedoHandler(super.data); @override - bool onSelected(BuildContext context, [bool wasAdded = true]) { + SelectState onSelected(BuildContext context, [bool wasAdded = true]) { final bloc = context.read(); bloc.redo(); bloc.load().then((value) => bloc.bake().then((value) => bloc.save())); - return false; + return SelectState.none; } @override diff --git a/app/lib/handlers/ruler.dart b/app/lib/handlers/ruler.dart new file mode 100644 index 000000000000..58ca7c378d7a --- /dev/null +++ b/app/lib/handlers/ruler.dart @@ -0,0 +1,109 @@ +part of 'handler.dart'; + +class RulerHandler extends Handler { + Offset _position = Offset.zero; + double _rotation = 0; + + RulerHandler(super.data); + + @override + List createForegrounds(CurrentIndexCubit currentIndexCubit, + NoteData document, DocumentPage page, DocumentInfo info, + [Area? currentArea]) => + [ + RulerRenderer(data, position: _position, rotation: _rotation), + ]; + + @override + SelectState onSelected(BuildContext context, [bool wasAdded = true]) { + return SelectState.toggle; + } + + void move(Offset offset, EventContext context) { + _position = offset; + context.refresh(); + } + + void rotate(double rotation, EventContext context) { + _rotation = rotation; + context.refresh(); + } +} + +class RulerRenderer extends Renderer { + final Offset position; + @override + final double rotation; + + RulerRenderer( + super.element, { + this.position = Offset.zero, + this.rotation = 0, + }); + + Rect getRulerRect(Size size, CameraTransform transform) { + const rulerSize = 100.0; + return Rect.fromLTWH( + transform.position.dx, + transform.position.dy + + (size.height / 2 + -rulerSize / 2) / transform.size, + size.width / transform.size, + rulerSize / transform.size, + ); + } + + @override + void build(Canvas canvas, Size size, NoteData document, DocumentPage page, + DocumentInfo info, CameraTransform transform, + [ColorScheme? colorScheme, bool foreground = false]) { + final rulerColor = colorScheme?.primary ?? Colors.grey; + final rulerBackgroundColor = element.color?.toColor() ?? + (colorScheme?.primaryContainer ?? Colors.grey).withAlpha(200); + final rulerForegroundColor = colorScheme?.onPrimary ?? Colors.white; + final rulerPaint = Paint() + ..color = rulerColor + ..strokeWidth = 1 / transform.size + ..style = PaintingStyle.stroke + ..strokeJoin = StrokeJoin.round; + final rulerBackgroundPaint = Paint() + ..color = rulerBackgroundColor + ..style = PaintingStyle.fill; + final rulerForegroundPaint = Paint()..color = rulerForegroundColor; + final rulerRect = getRulerRect(size, transform); + + // Calculate steps based on zoom level + var steps = 50; + + // Paint ruler background + canvas.drawRect(rulerRect, rulerBackgroundPaint); + canvas.drawLine( + Offset(rulerRect.left, rulerRect.top), + Offset(rulerRect.right, rulerRect.top), + rulerPaint, + ); + canvas.drawLine( + Offset(rulerRect.left, rulerRect.bottom), + Offset(rulerRect.right, rulerRect.bottom), + rulerPaint, + ); + + // Paint ruler lines + double x = 0; + var even = (transform.position.dx ~/ (steps / transform.size)) % 2 == 0; + while (x <= size.width / transform.size) { + final posX = x - + (transform.position.dx % (steps / transform.size)) + + transform.position.dx; + canvas.drawLine( + Offset(posX, rulerRect.top), + Offset( + posX, + rulerRect.top + + (even ? rulerRect.height / 8 : rulerRect.height / 4)), + rulerForegroundPaint, + ); + even = !even; + x += steps / transform.size; + } + } +} diff --git a/app/lib/handlers/select.dart b/app/lib/handlers/select.dart index 750439adedcc..ceb2ea4395d0 100644 --- a/app/lib/handlers/select.dart +++ b/app/lib/handlers/select.dart @@ -31,12 +31,12 @@ class SelectHandler extends Handler { : {}; @override - void resetInput(DocumentBloc bloc) { + Future resetInput(DocumentBloc bloc) async { _submitTransform(bloc); _rectangleFreeSelection = null; _lassoFreeSelection = null; _selectionManager.reset(); - bloc.refresh(); + await bloc.refresh(); } @override diff --git a/app/lib/handlers/undo.dart b/app/lib/handlers/undo.dart index 018b52869cf6..1474d6c0e902 100644 --- a/app/lib/handlers/undo.dart +++ b/app/lib/handlers/undo.dart @@ -4,11 +4,11 @@ class UndoHandler extends Handler { UndoHandler(super.data); @override - bool onSelected(BuildContext context, [bool wasAdded = true]) { + SelectState onSelected(BuildContext context, [bool wasAdded = true]) { final bloc = context.read(); bloc.undo(); bloc.load().then((value) => bloc.bake().then((value) => bloc.save())); - return false; + return SelectState.none; } @override diff --git a/app/lib/renderers/renderer.dart b/app/lib/renderers/renderer.dart index 31048d671a4e..4be18c784e7c 100644 --- a/app/lib/renderers/renderer.dart +++ b/app/lib/renderers/renderer.dart @@ -171,7 +171,8 @@ abstract class Renderer { element is PadElement ? (element as PadElement).rotation : 0.0; String get id => - (element is PadElement ? (element as PadElement).id : null) ?? ''; + (element is PadElement ? (element as PadElement).id : null) ?? + createUniqueId(); @mustCallSuper FutureOr setup(NoteData document, AssetService assetService, diff --git a/app/lib/renderers/utilities.dart b/app/lib/renderers/utilities.dart index 49aad6c18a08..45e71f241f7f 100644 --- a/app/lib/renderers/utilities.dart +++ b/app/lib/renderers/utilities.dart @@ -34,38 +34,7 @@ class UtilitiesRenderer extends Renderer { void build(Canvas canvas, Size size, NoteData document, DocumentPage page, DocumentInfo info, CameraTransform transform, [ColorScheme? colorScheme, bool foreground = false]) { - /*if (element.gridEnabled) { - if (option.gridXSize > 0) { - double x = 0; - while (x < size.width) { - final localX = x / transform.size; - canvas.drawLine( - Offset(localX + transform.position.dx, transform.position.dy), - Offset(localX + transform.position.dx, - size.height / transform.size + transform.position.dy), - Paint() - ..strokeWidth = 1 / transform.size - ..color = option.gridColor.toColor(), - ); - x += option.gridXSize; - } - } - if (option.gridYSize > 0) { - double y = 0; - while (y < size.height) { - final localY = y / transform.size; - canvas.drawLine( - Offset(transform.position.dx, transform.position.dy + localY), - Offset(transform.position.dx + size.width / transform.size, - transform.position.dy + localY), - Paint() - ..strokeWidth = 1 / transform.size - ..color = option.gridColor.toColor(), - ); - y += option.gridYSize; - } - } - } + /* if (element.rulerEnabled) { final rulerColor = colorScheme?.primary ?? Colors.grey; final rulerBackgroundColor = diff --git a/app/lib/views/edit.dart b/app/lib/views/edit.dart index 00ef540de263..c4d4d382ce76 100644 --- a/app/lib/views/edit.dart +++ b/app/lib/views/edit.dart @@ -90,6 +90,8 @@ class _EditToolbarState extends State { buildWhen: (previous, current) => previous.index != current.index || previous.handler != current.handler || + previous.toggleableHandlers != + current.toggleableHandlers || previous.temporaryHandler != current.temporaryHandler || previous.selection != current.selection, builder: (context, currentIndex) { @@ -295,24 +297,27 @@ class _EditToolbarState extends State { .read() .changeSelection(tool), focussed: shortcuts.contains(i), - selected: selected, - alwaysShowBottom: tool.isAction(), + selected: selected || + currentIndex.toggleableHandlers.containsKey(i), + showBottom: selected || tool.isAction(), highlighted: highlighted, - bottomIcon: PhosphorIcon(tool.isAction() - ? PhosphorIconsLight.playCircle - : isMobile - ? PhosphorIconsLight.caretUp - : switch (settings.toolbarPosition) { - ToolbarPosition.top || - ToolbarPosition.inline => - PhosphorIconsLight.caretDown, - ToolbarPosition.bottom => - PhosphorIconsLight.caretUp, - ToolbarPosition.left => - PhosphorIconsLight.caretRight, - ToolbarPosition.right => - PhosphorIconsLight.caretLeft, - }), + bottomIcon: selected || tool.isAction() + ? PhosphorIcon(tool.isAction() + ? PhosphorIconsLight.playCircle + : isMobile + ? PhosphorIconsLight.caretUp + : switch (settings.toolbarPosition) { + ToolbarPosition.top || + ToolbarPosition.inline => + PhosphorIconsLight.caretDown, + ToolbarPosition.bottom => + PhosphorIconsLight.caretUp, + ToolbarPosition.left => + PhosphorIconsLight.caretRight, + ToolbarPosition.right => + PhosphorIconsLight.caretLeft, + }) + : null, selectedIcon: _buildIcon(icon, size, color), icon: _buildIcon(icon, size, color), onPressed: () { diff --git a/app/lib/views/view.dart b/app/lib/views/view.dart index 0f0af8af9c87..e44e650f8965 100644 --- a/app/lib/views/view.dart +++ b/app/lib/views/view.dart @@ -190,6 +190,8 @@ class _MainViewViewportState extends State previous.foregrounds != current.foregrounds || previous.handler != current.handler || previous.temporaryHandler != current.temporaryHandler || + previous.toggleableForegrounds != + current.toggleableForegrounds || previous.temporaryForegrounds != current.temporaryForegrounds || previous.rendererStates != current.rendererStates || previous.networkingForegrounds != @@ -440,7 +442,7 @@ class _MainViewViewportState extends State CustomPaint( size: Size.infinite, foregroundPainter: ForegroundPainter( - cubit.getForegrounds(), + currentIndex.getAllForegrounds(), state.data, state.page, state.info, diff --git a/app/lib/widgets/option_button.dart b/app/lib/widgets/option_button.dart index 7719801568f9..ec3f2cf22600 100644 --- a/app/lib/widgets/option_button.dart +++ b/app/lib/widgets/option_button.dart @@ -5,7 +5,7 @@ class OptionButton extends StatefulWidget { final Widget icon; final Widget? selectedIcon, bottomIcon, leadingIcon; final VoidCallback? onPressed, onSecondaryPressed, onLongPressed; - final bool selected, highlighted, focussed, alwaysShowBottom; + final bool selected, highlighted, focussed, showBottom; final String tooltip; const OptionButton({ @@ -21,7 +21,7 @@ class OptionButton extends StatefulWidget { this.selected = false, this.highlighted = false, this.focussed = false, - this.alwaysShowBottom = false, + this.showBottom = false, }); @override @@ -54,8 +54,7 @@ class _OptionButtonState extends State _animationController.dispose(); } - double get _nextValue => - widget.alwaysShowBottom || widget.selected || widget.highlighted ? 1 : 0; + double get _nextValue => widget.showBottom ? 1 : 0; @override void didUpdateWidget(covariant OptionButton oldWidget) { diff --git a/app/pubspec.lock b/app/pubspec.lock index c366716fddfb..35e274ab270b 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -782,8 +782,8 @@ packages: dependency: "direct main" description: path: "packages/lw_file_system" - ref: "2325ec71be6691f64725bc78a911cabed68d901b" - resolved-ref: "2325ec71be6691f64725bc78a911cabed68d901b" + ref: "54f7ac141410938babff9539dca190f5d130a0db" + resolved-ref: "54f7ac141410938babff9539dca190f5d130a0db" url: "https://github.com/LinwoodDev/dart_pkgs" source: git version: "1.0.0" @@ -791,8 +791,8 @@ packages: dependency: transitive description: path: "packages/lw_file_system_api" - ref: a0752f136913f64a975cb8b20ccb16fb6ce37737 - resolved-ref: a0752f136913f64a975cb8b20ccb16fb6ce37737 + ref: "5ab1b96bea6ef0e0c07629ff4e7152b4437cf8ee" + resolved-ref: "5ab1b96bea6ef0e0c07629ff4e7152b4437cf8ee" url: "https://github.com/LinwoodDev/dart_pkgs" source: git version: "1.0.0" @@ -841,8 +841,8 @@ packages: dependency: "direct main" description: path: "packages/material_leap" - ref: "307657c0e0b93de9af1e1aa9bd96900e0bb7d27c" - resolved-ref: "307657c0e0b93de9af1e1aa9bd96900e0bb7d27c" + ref: "54f7ac141410938babff9539dca190f5d130a0db" + resolved-ref: "54f7ac141410938babff9539dca190f5d130a0db" url: "https://github.com/LinwoodDev/dart_pkgs" source: git version: "0.0.1" diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 11f93d3afad9..b6fbfbd1abc4 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -79,7 +79,7 @@ dependencies: material_leap: git: url: https://github.com/LinwoodDev/dart_pkgs - ref: 307657c0e0b93de9af1e1aa9bd96900e0bb7d27c + ref: 54f7ac141410938babff9539dca190f5d130a0db path: packages/material_leap lw_sysapi: git: @@ -99,7 +99,7 @@ dependencies: lw_file_system: git: url: https://github.com/LinwoodDev/dart_pkgs - ref: 2325ec71be6691f64725bc78a911cabed68d901b + ref: 54f7ac141410938babff9539dca190f5d130a0db path: packages/lw_file_system flutter_localized_locales: ^2.0.5 dynamic_color: ^1.7.0