-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmtooltip_controller_impl.dart
More file actions
40 lines (35 loc) · 1.1 KB
/
mtooltip_controller_impl.dart
File metadata and controls
40 lines (35 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import '../core/mtooltip.dart';
import 'mtooltip_controller.dart';
/// Concrete implementation of [MTooltipController].
///
/// This controller is intended to be provided to the [MTooltip] widget and
/// attached to the widget's internal state. Calls to [show] and [remove]
/// are forwarded to the attached [MTooltipState]. If no state is attached
/// the methods are no-ops.
class IMTooltipController implements MTooltipController {
IMTooltipController();
MTooltipState? _state;
/// Attach the controller to the live [MTooltipState].
///
/// The controller will forward subsequent [show] and [remove] calls to the
/// provided state instance.
@override
void attach(MTooltipState state) {
_state = state;
}
/// Request the tooltip to be shown.
///
/// If no [MTooltipState] is attached this method does nothing.
@override
void show() {
_state?.show();
}
/// Request the tooltip to be removed/dismissed.
///
/// Delegates to the attached state's [dismiss] method. If no state is
/// attached this method is a no-op.
@override
void remove() {
_state?.dismiss();
}
}