import 'package:flutter/material.dart';
import 'package:flut/flut/runtime.dart';

class FlutTooltip {
  FlutTooltip._();

  static Widget? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return Tooltip(
      key: runtime.decodeKey(data),
      message: runtime.unpackOptionalField<String>(data, 'message'),
      verticalOffset: runtime.unpackOptionalField<double>(
        data,
        'verticalOffset',
      ),
      preferBelow: runtime.unpackOptionalField<bool>(data, 'preferBelow'),
      textStyle: runtime.unpackOptionalField<TextStyle>(data, 'textStyle'),
      waitDuration: runtime.unpackOptionalField<Duration>(data, 'waitDuration'),
      showDuration: runtime.unpackOptionalField<Duration>(data, 'showDuration'),
      child: runtime.unpackOptionalField<Widget>(data, 'child'),
    );
  }
}
