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

class FlutMediaQueryData extends FlutImmutableObject {
  final MediaQueryData data;
  const FlutMediaQueryData(this.data) : super('MediaQueryData');

  @override
  Map<String, dynamic> flutEncode() {
    final result = flutBaseProps();
    result['size'] = FlutSize(data.size).flutEncode();
    result['padding'] = FlutEdgeInsets(data.padding).flutEncode();
    result['viewInsets'] = FlutEdgeInsets(data.viewInsets).flutEncode();
    result['viewPadding'] = FlutEdgeInsets(data.viewPadding).flutEncode();
    result['devicePixelRatio'] = data.devicePixelRatio;
    return result;
  }
}

class FlutMediaQuery {
  FlutMediaQuery._();

  static void registerStatics(FlutRuntime runtime) {
    runtime.registerStatic('MediaQuery.of', of);
  }

  static MediaQueryData of(FlutRuntime runtime, BuildContext context) {
    return MediaQuery.of(context);
  }
}
