Overlay topic

Overlay

Controller

Here comes IEasyOverlayController which suddenly has pretty similar responsibilities to that of the Manager, such as inserting and removing dialogs into the Overlay using two methods.

abstract class IEasyOverlayController implements TickerProvider {
  void insertDialog(EasyOverlayBoxInsert strategy);

  void removeDialog(EasyOverlayBoxRemove strategy);
}

You may notice the strategy named argument, and you would be correct in thinking that it refers to the strategies mentioned earlier.

Box

It is the strict variation of Map with generic types which is using only for storing Overlay entries and associated Managers:

abstract class IEasyDialogsOverlayBox {
  void put(Object key, Object value);

  T? remove<T>(Object key);

  T? get<T>(Object key);

  T putIfAbsent<T>(Object key, T Function() ifAbsent);
}

Note:
Each Manager can provide its own complex structure for state as complex as it needs to be. For example, the PositionedDialogManager stores its data in the format of another Map, or BasicDialogInsertStrategy uses a List of integers as identifiers of inserted dialogs.

Box mutation

So that's it - the strategy for inserting/removing Manager data into IEasyDialogsOverlayBox. The basis of this is called BoxMutation, which has the single responsibility of mutating the storage state of this Box:

abstract class EasyOverlayBoxMutation<M extends EasyDialogManager,
    R extends EasyOverlayEntry?> {
  const EasyOverlayBoxMutation();

  Type get key => M;

  R apply(IEasyOverlayBox box);
}

The result of applying of the mutation strategy must be an any derived class of EasyOverlayEntry (specific class derived from OverlayEntry) which can later could be used within IEasyOverlayController to insert that entry into EasyOverlay. For the sake of simplicity, there are two classes.

One is for inserting:

abstract class EasyOverlayBoxInsert<M extends EasyDialogManager>
    extends EasyOverlayBoxMutation<M, EasyOverlayEntry> {
  final Widget dialog;

  const EasyOverlayBoxInsert({
    required this.dialog,
  });
}

Which provides the dialog to be inserted into EasyDialogsOverlay.

And the another is for removing, which result could be nullable as it could be no such dialog entry existing withing the IEasyDialogsOverlayBox

abstract class EasyOverlayBoxRemove<M extends EasyDialogManager>
    extends EasyOverlayBoxMutation<M, EasyOverlayEntry?> {
  const EasyOverlayBoxRemove();
}
EasyDialogsOverlay

This is the core widget that provides all possibilities of dialogs to appear at any time and in any place within the wrapped application. Its state is responsible for storing IEasyDialogsOverlayBox and implementing IEasyOverlayController. There isn't much to know, to be honest.

Classes

EasyDialogsOverlayEntry Overlay
Simple overlay entry.
EasyDialogsOverlayEntry Overlay
Simple overlay entry.
EasyOverlayBoxInsert<M extends EasyDialogManager<EasyDialogManagerShowParams?, EasyDialogManagerHideParams?>> Overlay Custom
Insert mutation.
EasyOverlayBoxInsert<M extends EasyDialogManager<EasyDialogManagerShowParams?, EasyDialogManagerHideParams?>> Overlay Custom
Insert mutation.
EasyOverlayBoxMutation<M extends EasyDialogManager<EasyDialogManagerShowParams?, EasyDialogManagerHideParams?>, R extends EasyOverlayEntry?> Overlay Custom
Similar to Command/Strategy class for applying specific mutation within IEasyDialogsOverlayBox.
EasyOverlayBoxMutation<M extends EasyDialogManager<EasyDialogManagerShowParams?, EasyDialogManagerHideParams?>, R extends EasyOverlayEntry?> Overlay Custom
Similar to Command/Strategy class for applying specific mutation within IEasyDialogsOverlayBox.
EasyOverlayBoxRemove<M extends EasyDialogManager<EasyDialogManagerShowParams?, EasyDialogManagerHideParams?>> Overlay Custom
Remove mutation.
EasyOverlayBoxRemove<M extends EasyDialogManager<EasyDialogManagerShowParams?, EasyDialogManagerHideParams?>> Overlay Custom
Remove mutation.
EasyOverlayEntry Overlay
The EasyOverlayEntry class is an abstract class that extends OverlayEntry.
EasyOverlayEntry Overlay
The EasyOverlayEntry class is an abstract class that extends OverlayEntry.
IEasyDialogsOverlayBox Overlay Custom
Box for storing dialog specific entries.
IEasyDialogsOverlayBox Overlay Custom
Box for storing dialog specific entries.
IEasyOverlayController Overlay Custom
Controller for manipulating overlay with the dialogs.
IEasyOverlayController Overlay Custom
Controller for manipulating overlay with the dialogs.