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

class FlutBoxDecoration extends FlutImmutableObject {
  final BoxDecoration boxDecoration;

  const FlutBoxDecoration(this.boxDecoration) : super('BoxDecoration');

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

  static BoxDecoration? flutDecode(
    FlutRuntime runtime,
    Map<String, dynamic> data,
  ) {
    return BoxDecoration(
      color: runtime.unpackOptionalField<Color>(data, 'color'),
      border: runtime.unpackOptionalField<Border>(data, 'border'),
      borderRadius: runtime.unpackOptionalField<BorderRadius>(
        data,
        'borderRadius',
      ),
    );
  }
}
