OverlayConfig class
Configuration class for the overlay bubble appearance and behavior.
This class provides comprehensive customization options for the TypeMate overlay bubble that appears when users type in text fields.
Usage Example
final config = OverlayConfig(
autoShow: true,
autoHideDuration: 5000, // 5 seconds
bubbleSize: 64.0,
bubbleOpacity: 0.9,
enableSpellCheck: true,
enableGrammarCheck: true,
enableVibration: false,
initialX: 100,
initialY: 200,
);
// Use with TypeMate
// await TypeMate.instance.startOverlayService(config); // Future feature
Configuration Options
The configuration supports:
- Appearance: Size, opacity, color, and position
- Behavior: Auto-show, auto-hide, vibration feedback
- Features: Enable/disable spell check and grammar check
All properties have sensible defaults and can be customized as needed.
See also:
- TypeMate.startOverlayService for using the configuration
- Individual property documentation for detailed options
Constructors
- OverlayConfig({bool autoShow = true, int autoHideDuration = 3000, bool enableVibration = false, String? bubbleColor, double bubbleSize = 56.0, double bubbleOpacity = 0.9, bool enableSpellCheck = true, bool enableGrammarCheck = true, int initialX = 100, int initialY = 200})
-
const
-
OverlayConfig.fromMap(Map<
String, dynamic> map) -
Creates an OverlayConfig from a map.
factory
Properties
- autoHideDuration → int
-
Duration in milliseconds for auto-hide (0 means never auto-hide).
final
- autoShow → bool
-
Whether to show the bubble automatically when text fields are focused.
final
- bubbleColor → String?
-
Custom background color for the bubble (hex string, e.g., "#FF5722").
final
- bubbleOpacity → double
-
The opacity of the overlay bubble (0.0 to 1.0).
final
- bubbleSize → double
-
The size of the overlay bubble in dp.
final
- enableGrammarCheck → bool
-
Whether to enable grammar checking feature.
final
- enableSpellCheck → bool
-
Whether to enable spell checking feature.
final
- enableVibration → bool
-
Whether to vibrate when the bubble appears.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- initialX → int
-
Initial X position of the bubble on screen.
final
- initialY → int
-
Initial Y position of the bubble on screen.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copyWith(
{bool? autoShow, int? autoHideDuration, bool? enableVibration, String? bubbleColor, double? bubbleSize, double? bubbleOpacity, bool? enableSpellCheck, bool? enableGrammarCheck, int? initialX, int? initialY}) → OverlayConfig - Creates a copy of this config with the given fields replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, dynamic> - Converts this config to a map for platform communication.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override