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

class FlutListTile {
  FlutListTile._();

  static Widget? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return ListTile(
      key: runtime.decodeKey(data),
      leading: runtime.unpackOptionalField<Widget>(data, 'leading'),
      title: runtime.unpackOptionalField<Widget>(data, 'title'),
      subtitle: runtime.unpackOptionalField<Widget>(data, 'subtitle'),
      trailing: runtime.unpackOptionalField<Widget>(data, 'trailing'),
      dense: runtime.unpackOptionalField<bool>(data, 'dense'),
      iconColor: runtime.unpackOptionalField<Color>(data, 'iconColor'),
      textColor: runtime.unpackOptionalField<Color>(data, 'textColor'),
      titleTextStyle: runtime.unpackOptionalField<TextStyle>(
        data,
        'titleTextStyle',
      ),
      subtitleTextStyle: runtime.unpackOptionalField<TextStyle>(
        data,
        'subtitleTextStyle',
      ),
      contentPadding: runtime.unpackOptionalField<EdgeInsets>(
        data,
        'contentPadding',
      ),
      enabled: runtime.unpackRequiredField<bool>(data, 'enabled'),
      onTap: runtime.unpackOptionalCallback(data, 'onTapId'),
      onLongPress: runtime.unpackOptionalCallback(data, 'onLongPressId'),
      selected: runtime.unpackRequiredField<bool>(data, 'selected'),
      tileColor: runtime.unpackOptionalField<Color>(data, 'tileColor'),
      selectedTileColor: runtime.unpackOptionalField<Color>(
        data,
        'selectedTileColor',
      ),
    );
  }
}
