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

class FlutInputDecoration extends FlutImmutableObject {
  final InputDecoration inputDecoration;

  const FlutInputDecoration(this.inputDecoration) : super('InputDecoration');

  @override
  Map<String, dynamic> flutEncode() => flutBaseProps();

  static InputDecoration? flutDecode(
    FlutRuntime runtime,
    Map<String, dynamic> data,
  ) {
    return InputDecoration(
      hintText: runtime.unpackOptionalField<String>(data, 'hintText'),
      contentPadding: runtime.unpackOptionalField<EdgeInsets>(
        data,
        'contentPadding',
      ),
      filled: runtime.unpackOptionalField<bool>(data, 'filled'),
      fillColor: runtime.unpackOptionalField<Color>(data, 'fillColor'),
      border: runtime.unpackOptionalField<InputBorder>(data, 'border'),
    );
  }
}
