|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- 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<String, dynamic> data;
-
- const MineHeader(this.data, {Key key}) : super(key: key);
-
- @override
- _MineHeaderState createState() => _MineHeaderState();
- }
-
- class _MineHeaderState extends State<MineHeader> {
- @override
- Widget build(BuildContext context) {
- return _MineContainer(widget.data);
- }
- }
-
- class _MineContainer extends StatefulWidget {
- final Map<String, dynamic> data;
- Map<String, dynamic> 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: <Widget>[
- 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: <Widget>[
- 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),
- )),
- ],
- ))
- ],
- ),
- );
- }
- }
|