import 'dart:convert' as convert; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:zhiying_base_widget/widgets/mine/mine_header/model/mine_header_model.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; class MineHeader extends StatefulWidget { final Map data; const MineHeader(this.data, {Key key}) : super(key: key); @override _MineHeaderState createState() => _MineHeaderState(); } class _MineHeaderState extends State { @override Widget build(BuildContext context) { return _MineContainer(widget.data); } } class _MineContainer extends StatefulWidget { final Map data; Map json; MineHeaderModel staticModel; _MineContainer(this.data, {Key key}) : super(key: key) { String d = data['data']; json = convert.jsonDecode(d); staticModel = MineHeaderModel.fromJson(json); } @override _MineContainerState createState() => _MineContainerState(); } class _MineContainerState extends State<_MineContainer> { @override Widget build(BuildContext context) { return Container( child: Row( children: [ GestureDetector( child: Container( margin: EdgeInsets.only(left: 20, top: 20, bottom: 20, right: 12), width: 56, height: 56, child: ClipRRect( borderRadius: BorderRadius.circular(28), child: CachedNetworkImage( imageUrl: widget.staticModel.defaultAvatar, fit: BoxFit.cover)), ), onTap: () { RouterUtil.route(widget.json, context); }, ), Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( width: 120, height: 20, child: Text( widget.staticModel.loginName, style: TextStyle( color: HexColor.fromHex(widget.staticModel.loginColor), fontSize: 17), ), ), Container( margin: EdgeInsets.only(top: 8), width: 80, child: Text( widget.staticModel.loginNameHelpText, style: TextStyle( color: HexColor.fromHex(widget.staticModel.loginColor), fontSize: 13), )), ], )) ], ), ); } }