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

class FlutCenter {
  FlutCenter._();

  static Center? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return Center(
      key: runtime.decodeKey(data),
      child: runtime.unpackOptionalField<Widget>(data, 'child'),
    );
  }
}

class FlutPadding {
  FlutPadding._();

  static Padding? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return Padding(
      key: runtime.decodeKey(data),
      padding: runtime.unpackRequiredField<EdgeInsets>(data, 'padding'),
      child: runtime.unpackOptionalField<Widget>(data, 'child'),
    );
  }
}

class FlutAlign {
  FlutAlign._();

  static Align? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return Align(
      key: runtime.decodeKey(data),
      alignment: runtime.unpackRequiredField<Alignment>(data, 'alignment'),
      child: runtime.unpackOptionalField<Widget>(data, 'child'),
    );
  }
}

class FlutOpacity {
  FlutOpacity._();

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

class FlutClipRRect {
  FlutClipRRect._();

  static ClipRRect? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return ClipRRect(
      key: runtime.decodeKey(data),
      borderRadius: runtime.unpackRequiredField<BorderRadius>(
        data,
        'borderRadius',
      ),
      child: runtime.unpackOptionalField<Widget>(data, 'child'),
    );
  }
}

class FlutSizedBox {
  FlutSizedBox._();

  static SizedBox? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return SizedBox(
      key: runtime.decodeKey(data),
      width: runtime.unpackOptionalField<double>(data, 'width'),
      height: runtime.unpackOptionalField<double>(data, 'height'),
      child: runtime.unpackOptionalField<Widget>(data, 'child'),
    );
  }
}

class FlutExpanded {
  FlutExpanded._();

  static Expanded? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return Expanded(
      key: runtime.decodeKey(data),
      flex: runtime.unpackRequiredField<int>(data, 'flex'),
      child: runtime.unpackRequiredField<Widget>(data, 'child'),
    );
  }
}

class FlutFlexible {
  FlutFlexible._();

  static Flexible? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return Flexible(
      key: runtime.decodeKey(data),
      flex: runtime.unpackRequiredField<int>(data, 'flex'),
      fit: runtime.unpackRequiredField<FlexFit>(data, 'fit'),
      child: runtime.unpackRequiredField<Widget>(data, 'child'),
    );
  }
}

class FlutSpacer {
  FlutSpacer._();

  static Spacer? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return Spacer(
      key: runtime.decodeKey(data),
      flex: runtime.unpackRequiredField<int>(data, 'flex'),
    );
  }
}

class FlutColumn {
  FlutColumn._();

  static Column? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return Column(
      key: runtime.decodeKey(data),
      mainAxisAlignment: runtime.unpackRequiredField<MainAxisAlignment>(
        data,
        'mainAxisAlignment',
      ),
      mainAxisSize: runtime.unpackRequiredField<MainAxisSize>(
        data,
        'mainAxisSize',
      ),
      crossAxisAlignment: runtime.unpackRequiredField<CrossAxisAlignment>(
        data,
        'crossAxisAlignment',
      ),
      children: runtime.unpackRequiredField<List<Widget>>(data, 'children'),
    );
  }
}

class FlutRow {
  FlutRow._();

  static Row? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return Row(
      key: runtime.decodeKey(data),
      mainAxisAlignment: runtime.unpackRequiredField<MainAxisAlignment>(
        data,
        'mainAxisAlignment',
      ),
      mainAxisSize: runtime.unpackRequiredField<MainAxisSize>(
        data,
        'mainAxisSize',
      ),
      crossAxisAlignment: runtime.unpackRequiredField<CrossAxisAlignment>(
        data,
        'crossAxisAlignment',
      ),
      children: runtime.unpackRequiredField<List<Widget>>(data, 'children'),
    );
  }
}

class FlutStack {
  FlutStack._();

  static Stack? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return Stack(
      key: runtime.decodeKey(data),
      children: runtime.unpackRequiredField<List<Widget>>(data, 'children'),
    );
  }
}

class FlutPositioned {
  FlutPositioned._();

  static Positioned? flutDecode(
    FlutRuntime runtime,
    Map<String, dynamic> data,
  ) {
    return Positioned(
      key: runtime.decodeKey(data),
      left: runtime.unpackOptionalField<double>(data, 'left'),
      top: runtime.unpackOptionalField<double>(data, 'top'),
      right: runtime.unpackOptionalField<double>(data, 'right'),
      bottom: runtime.unpackOptionalField<double>(data, 'bottom'),
      width: runtime.unpackOptionalField<double>(data, 'width'),
      height: runtime.unpackOptionalField<double>(data, 'height'),
      child: runtime.unpackRequiredField<Widget>(data, 'child'),
    );
  }
}

class FlutMouseRegion {
  FlutMouseRegion._();

  static Widget? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return MouseRegion(
      key: runtime.decodeKey(data),
      cursor: runtime.unpackRequiredField<MouseCursor>(data, 'cursor'),
      onEnter: runtime.unpackOptionalCallback(data, 'onEnterId'),
      onExit: runtime.unpackOptionalCallback(data, 'onExitId'),
      child: runtime.unpackOptionalField<Widget>(data, 'child'),
    );
  }
}

class FlutCustomPaint {
  FlutCustomPaint._();

  static CustomPaint? flutDecode(
    FlutRuntime runtime,
    Map<String, dynamic> data,
  ) {
    return CustomPaint(
      key: runtime.decodeKey(data),
      size: runtime.unpackRequiredField<Size>(data, 'size'),
      painter: runtime.unpackOptionalField<CustomPainter>(data, 'painter'),
      child: runtime.unpackOptionalField<Widget>(data, 'child'),
    );
  }
}

class FlutWrap {
  FlutWrap._();

  static Wrap? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return Wrap(
      key: runtime.decodeKey(data),
      direction: runtime.unpackRequiredField<Axis>(data, 'direction'),
      alignment: runtime.unpackRequiredField<WrapAlignment>(data, 'alignment'),
      spacing: runtime.unpackRequiredField<double>(data, 'spacing'),
      runAlignment: runtime.unpackRequiredField<WrapAlignment>(
        data,
        'runAlignment',
      ),
      runSpacing: runtime.unpackRequiredField<double>(data, 'runSpacing'),
      crossAxisAlignment: runtime.unpackRequiredField<WrapCrossAlignment>(
        data,
        'crossAxisAlignment',
      ),
      children: runtime.unpackRequiredField<List<Widget>>(data, 'children'),
    );
  }
}

class FlutTransformRotate {
  FlutTransformRotate._();

  static Widget? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return Transform.rotate(
      key: runtime.decodeKey(data),
      angle: runtime.unpackRequiredField<double>(data, 'angle'),
      origin: runtime.unpackOptionalField<Offset>(data, 'origin'),
      alignment: runtime.unpackOptionalField<Alignment>(data, 'alignment'),
      transformHitTests: runtime.unpackRequiredField<bool>(
        data,
        'transformHitTests',
      ),
      child: runtime.unpackOptionalField<Widget>(data, 'child'),
    );
  }
}

class FlutTransformScale {
  FlutTransformScale._();

  static Widget? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return Transform.scale(
      key: runtime.decodeKey(data),
      scale: runtime.unpackOptionalField<double>(data, 'scale'),
      scaleX: runtime.unpackOptionalField<double>(data, 'scaleX'),
      scaleY: runtime.unpackOptionalField<double>(data, 'scaleY'),
      origin: runtime.unpackOptionalField<Offset>(data, 'origin'),
      alignment: runtime.unpackOptionalField<Alignment>(data, 'alignment'),
      transformHitTests: runtime.unpackRequiredField<bool>(
        data,
        'transformHitTests',
      ),
      child: runtime.unpackOptionalField<Widget>(data, 'child'),
    );
  }
}

class FlutTransformTranslate {
  FlutTransformTranslate._();

  static Widget? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return Transform.translate(
      key: runtime.decodeKey(data),
      offset: runtime.unpackRequiredField<Offset>(data, 'offset'),
      transformHitTests: runtime.unpackRequiredField<bool>(
        data,
        'transformHitTests',
      ),
      child: runtime.unpackOptionalField<Widget>(data, 'child'),
    );
  }
}
