Browse Source

添加个人信息

tags/0.0.1
Weller 4 years ago
parent
commit
3d70eb7b31
6 changed files with 164 additions and 9 deletions
  1. +3
    -3
      .dart_tool/package_config.json
  2. +1
    -1
      lib/widgets/home/home_goods/models/home_goods_style_model.g.dart
  3. +63
    -4
      lib/widgets/mine/mine_header/mine_header.dart
  4. +1
    -1
      lib/widgets/mine/mine_header/mine_header_bloc.dart
  5. +58
    -0
      lib/widgets/mine/mine_header/model/mine_header_model.dart
  6. +38
    -0
      lib/widgets/mine/mine_header/model/mine_header_model.g.dart

+ 3
- 3
.dart_tool/package_config.json View File

@@ -255,9 +255,9 @@
}, },
{ {
"name": "fluttertoast", "name": "fluttertoast",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-7.0.4",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-4.0.1",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.7"
"languageVersion": "2.0"
}, },
{ {
"name": "glob", "name": "glob",
@@ -680,7 +680,7 @@
"languageVersion": "2.1" "languageVersion": "2.1"
} }
], ],
"generated": "2020-09-14T04:30:17.438032Z",
"generated": "2020-09-15T02:01:44.342412Z",
"generator": "pub", "generator": "pub",
"generatorVersion": "2.7.2" "generatorVersion": "2.7.2"
} }

+ 1
- 1
lib/widgets/home/home_goods/models/home_goods_style_model.g.dart View File

@@ -32,6 +32,6 @@ Map<String, dynamic> _$HomeGoodsStyleModelToJson(
'coupon_font_color': instance.couponFontColor, 'coupon_font_color': instance.couponFontColor,
'commission_background_color': instance.commissionBackgroundColor, 'commission_background_color': instance.commissionBackgroundColor,
'commission_font_color': instance.commissionFontColor, 'commission_font_color': instance.commissionFontColor,
'MarketPriceColor': instance.marketPriceColor,
'market_price_color': instance.marketPriceColor,
'current_price_color': instance.currentPriceColor, 'current_price_color': instance.currentPriceColor,
}; };

+ 63
- 4
lib/widgets/mine/mine_header/mine_header.dart View File

@@ -1,7 +1,10 @@
import 'dart:convert' as convert;

import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';

import 'mine_header_sk.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 { class MineHeader extends StatefulWidget {
final Map<String, dynamic> data; final Map<String, dynamic> data;
@@ -15,11 +18,21 @@ class MineHeader extends StatefulWidget {
class _MineHeaderState extends State<MineHeader> { class _MineHeaderState extends State<MineHeader> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return _MineContainer();
return _MineContainer(widget.data);
} }
} }


class _MineContainer extends StatefulWidget { 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 @override
_MineContainerState createState() => _MineContainerState(); _MineContainerState createState() => _MineContainerState();
} }
@@ -27,6 +40,52 @@ class _MineContainer extends StatefulWidget {
class _MineContainerState extends State<_MineContainer> { class _MineContainerState extends State<_MineContainer> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MineHeaderSkeleton();
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),
)),
],
))
],
),
);
} }
} }

+ 1
- 1
lib/widgets/mine/mine_header/mine_header_bloc.dart View File

@@ -18,7 +18,7 @@ class MineHeaderBloc extends BlocBase {
} }


void loadData(int id) { void loadData(int id) {
NetUtil.request('/api/v1/mod',
NetUtil.request('/api/v1/user/profile',
method: NetMethod.POST, method: NetMethod.POST,
params: Map<String, dynamic>.from({ params: Map<String, dynamic>.from({
'ids': [id] 'ids': [id]


+ 58
- 0
lib/widgets/mine/mine_header/model/mine_header_model.dart View File

@@ -0,0 +1,58 @@
import 'package:json_annotation/json_annotation.dart';

part 'mine_header_model.g.dart';

@JsonSerializable()
class MineHeaderModel extends Object {
@JsonKey(name: 'non_login_avatar')
String defaultAvatar;

@JsonKey(name: 'user_name_color')
String userNameColor;

@JsonKey(name: 'invited_code_text')
String invitedCodeText;

@JsonKey(name: 'invited_code_color')
String invitedCodeColor;

@JsonKey(name: 'login_color')
String loginColor;

@JsonKey(name: 'login_name')
String loginName;

@JsonKey(name: 'login_name_help_text')
String loginNameHelpText;

@JsonKey(name: 'coype_icon')
String coypeIcon;

@JsonKey(name: 'required_login')
String requiredLogin;

@JsonKey(name: 'required_taobao_auth')
String requiredTaobaoAuth;

@JsonKey(name: 'skip_identifier')
String skipIdentifier;

MineHeaderModel(
this.defaultAvatar,
this.userNameColor,
this.invitedCodeText,
this.invitedCodeColor,
this.loginColor,
this.loginName,
this.loginNameHelpText,
this.coypeIcon,
this.requiredLogin,
this.requiredTaobaoAuth,
this.skipIdentifier,
);

factory MineHeaderModel.fromJson(Map<String, dynamic> srcJson) =>
_$MineHeaderModelFromJson(srcJson);

Map<String, dynamic> toJson() => _$MineHeaderModelToJson(this);
}

+ 38
- 0
lib/widgets/mine/mine_header/model/mine_header_model.g.dart View File

@@ -0,0 +1,38 @@
// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'mine_header_model.dart';

// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************

MineHeaderModel _$MineHeaderModelFromJson(Map<String, dynamic> json) {
return MineHeaderModel(
json['non_login_avatar'] as String,
json['user_name_color'] as String,
json['invited_code_text'] as String,
json['invited_code_color'] as String,
json['login_color'] as String,
json['login_name'] as String,
json['login_name_help_text'] as String,
json['coype_icon'] as String,
json['required_login'] as String,
json['required_taobao_auth'] as String,
json['skip_identifier'] as String,
);
}

Map<String, dynamic> _$MineHeaderModelToJson(MineHeaderModel instance) =>
<String, dynamic>{
'non_login_avatar': instance.defaultAvatar,
'user_name_color': instance.userNameColor,
'invited_code_text': instance.invitedCodeText,
'invited_code_color': instance.invitedCodeColor,
'login_color': instance.loginColor,
'login_name': instance.loginName,
'login_name_help_text': instance.loginNameHelpText,
'coype_icon': instance.coypeIcon,
'required_login': instance.requiredLogin,
'required_taobao_auth': instance.requiredTaobaoAuth,
'skip_identifier': instance.skipIdentifier,
};

Loading…
Cancel
Save