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

class FlutAnimatedContainer {
  FlutAnimatedContainer._();

  static AnimatedContainer? flutDecode(
    FlutRuntime runtime,
    Map<String, dynamic> data,
  ) {
    return AnimatedContainer(
      key: runtime.decodeKey(data),
      padding: runtime.unpackOptionalField<EdgeInsets>(data, 'padding'),
      margin: runtime.unpackOptionalField<EdgeInsets>(data, 'margin'),
      width: runtime.unpackOptionalField<double>(data, 'width'),
      height: runtime.unpackOptionalField<double>(data, 'height'),
      color: runtime.unpackOptionalField<Color>(data, 'color'),
      decoration: runtime.unpackOptionalField<BoxDecoration>(
        data,
        'decoration',
      ),
      alignment: runtime.unpackOptionalField<Alignment>(data, 'alignment'),
      duration: runtime.unpackRequiredField<Duration>(data, 'duration'),
      curve: runtime.unpackRequiredField<Curve>(data, 'curve'),
      child: runtime.unpackOptionalField<Widget>(data, 'child'),
    );
  }
}

class FlutAnimatedOpacity {
  FlutAnimatedOpacity._();

  static AnimatedOpacity? flutDecode(
    FlutRuntime runtime,
    Map<String, dynamic> data,
  ) {
    return AnimatedOpacity(
      key: runtime.decodeKey(data),
      opacity: runtime.unpackRequiredField<double>(data, 'opacity'),
      duration: runtime.unpackRequiredField<Duration>(data, 'duration'),
      child: runtime.unpackOptionalField<Widget>(data, 'child'),
    );
  }
}
