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

class FlutAppBar {
  FlutAppBar._();

  static AppBar? flutDecode(FlutRuntime runtime, Map<String, dynamic> data) {
    return AppBar(
      key: runtime.decodeKey(data),
      leading: runtime.unpackOptionalField<Widget>(data, 'leading'),
      title: runtime.unpackOptionalField<Widget>(data, 'title'),
      actions: runtime.unpackOptionalField<List<Widget>>(data, 'actions'),
      elevation: runtime.unpackOptionalField<double>(data, 'elevation'),
      scrolledUnderElevation: runtime.unpackOptionalField<double>(
        data,
        'scrolledUnderElevation',
      ),
      backgroundColor: runtime.unpackOptionalField<Color>(
        data,
        'backgroundColor',
      ),
      centerTitle: runtime.unpackOptionalField<bool>(data, 'centerTitle'),
    );
  }
}
