Browse Source

0113 个人中心累计收益数据结构调整

tags/0.0.3+6
23028876916@qq.com 4 years ago
parent
commit
fc59965e19
2 changed files with 34 additions and 23 deletions
  1. +5
    -5
      lib/widgets/mine/mine_data/mine_data_widget.dart
  2. +29
    -18
      lib/widgets/mine/mine_nav/mine_nav.dart

+ 5
- 5
lib/widgets/mine/mine_data/mine_data_widget.dart View File

@@ -118,7 +118,7 @@ class _MineDataWidgetState extends State<MineDataWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
_isiOSReview ? '' : '累计收益',
_isiOSReview ? '' : widget?.profile?.gridViews[0]?.name ?? "累计收益",
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
@@ -126,7 +126,7 @@ class _MineDataWidgetState extends State<MineDataWidget> {
),
),
Text(
'${widget.profile?.total ?? '0.00'}',
widget?.profile?.gridViews[0]?.value ?? "¥0",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w800,
@@ -188,7 +188,7 @@ class _MineDataWidgetState extends State<MineDataWidget> {
}
List<Widget> rows = List();
List<Widget> columns = List();
int i = 0;
int i = 1;
for (; i < row; i++) {
rows.add(
_createrCenterItem(datas[i].name, datas[i].value, i),
@@ -250,7 +250,7 @@ class _MineDataWidgetState extends State<MineDataWidget> {
return Expanded(
child: GestureDetector(
onTap: () {
RouterUtil.route(_style.listStyle[i + 1], _style.listStyle[i + 1].toJson(), context);
RouterUtil.route(_style.listStyle[i], _style.listStyle[i].toJson(), context);
},
behavior: HitTestBehavior.opaque,
child: Container(
@@ -286,7 +286,7 @@ class _MineDataWidgetState extends State<MineDataWidget> {
return Expanded(
child: GestureDetector(
onTap: () {
RouterUtil.route(_style.listStyle[i + 1], _style.listStyle[i + 1].toJson(), context);
RouterUtil.route(_style.listStyle[i], _style.listStyle[i].toJson(), context);
},
behavior: HitTestBehavior.opaque,
child: Container(


+ 29
- 18
lib/widgets/mine/mine_nav/mine_nav.dart View File

@@ -12,6 +12,8 @@ class MineNavDelegate extends SliverPersistentHeaderDelegate {
Color _color;

List<Widget> _icons = List();
double marginTop;
double marginLeftRight;

MineNavDelegate(this.data) : super() {
_height = MediaQueryData.fromWindow(window).padding.top + 44;
@@ -29,13 +31,20 @@ class MineNavDelegate extends SliverPersistentHeaderDelegate {
return MineNavIcon(icon['icon'], model);
}).toList();
}
marginTop = 0;
if (json.containsKey("is_top_margin") && json.containsKey("top_margin")) {
marginTop = json['is_top_margin'] == "1" ? double.parse(json['top_margin']) : 0;
}
marginLeftRight = 0;
if (json.containsKey("is_left_right_margin") && json.containsKey("left_right_margin")) {
marginLeftRight = json['is_left_right_margin'] == "1" ? double.parse(json['left_right_margin']) : 0;
}
}

@override
Widget build(
BuildContext context, double shrinkOffset, bool overlapsContent) {
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
double percent = shrinkOffset / _height;
return MineNav(_color.withOpacity(percent), _icons);
return MineNav(_color.withOpacity(percent), _icons, marginTop, marginLeftRight);
}

@override
@@ -45,19 +54,21 @@ class MineNavDelegate extends SliverPersistentHeaderDelegate {
double get minExtent => _height;

@override
bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) =>
false; // 如果内容需要更新,设置为true
bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) => false; // 如果内容需要更新,设置为true
}

class MineNav extends StatelessWidget {
final Color color;
final List<Widget> widgets;
double marginLeftRight;
double marginTop;

MineNav(this.color, this.widgets);
MineNav(this.color, this.widgets, this.marginTop, this.marginLeftRight);

@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(top: marginTop, left: marginLeftRight, right: marginLeftRight),
padding: EdgeInsets.only(left: 12, right: 12),
color: color,
child: Column(
@@ -78,23 +89,23 @@ class MineNav extends StatelessWidget {
}

class MineNavIcon extends StatelessWidget {
final String imgUrl;
final SkipModel skipModel;
final String imgUrl;
final SkipModel skipModel;

const MineNavIcon(this.imgUrl, this.skipModel, {Key key}) : super(key: key);

@override
Widget build(BuildContext context) {
return GestureDetector(child: Container(
width: 24,
height: 24,
margin: EdgeInsets.only(left: 6),
child: CachedNetworkImage(
imageUrl: imgUrl,
),
),
onTap:() {
return GestureDetector(
child: Container(
width: 24,
height: 24,
margin: EdgeInsets.only(left: 6),
child: CachedNetworkImage(
imageUrl: imgUrl,
),
),
onTap: () {
RouterUtil.route(skipModel, skipModel.toJson(), context);
});
}


Loading…
Cancel
Save