import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_appbar/model/WalletAppbarModel.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class WalletAppbar extends StatelessWidget {
  final Map<String, dynamic> data;

  const WalletAppbar({Key key, this.data}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    var model = WalletAppbarModel.fromJson(json.decode(data['data']));
    return Container(
      height: MediaQuery.of(context).padding.top + 56,
      child: AppBar(
        leading: Navigator.canPop(context)
            ? IconButton(
                icon: Icon(Icons.arrow_back_ios),
                onPressed: () {
                  Navigator.of(context).pop();
                })
            : Container(),
        backgroundColor: HexColor.fromHex(model.appBarBgColor),
        centerTitle: true,
        title: Text(
          model.appBarName,
          style: TextStyle(color: HexColor.fromHex(model.appBarNameColor)),
        ),
      ),
    );
  }
}
