import 'package:sport/bean/game.dart'; import 'package:sport/services/Converter.dart'; class GameRecordSum { int id; int userId; int gameId; String lastPlayAt; int times; int duration; double score; int consume; double scoreMax; int stepCount; int jumpCount; int crouchCount; int durationAvg; int scoreAvg; int consumePerMin; int durationTotalMinute; GameInfoData game; GameRecordSum( {this.id, this.userId, this.gameId, this.lastPlayAt, this.times, this.duration, this.score, this.consume, this.scoreMax, this.stepCount, this.jumpCount, this.crouchCount, this.durationAvg, this.scoreAvg, this.consumePerMin, this.durationTotalMinute}); GameRecordSum.fromJson(Map json) { id = json['id']; userId = json['user_id']; gameId = json['game_id']; lastPlayAt = json['last_play_at']; times = json['times']; duration = json['duration']; score = Converter.toDouble(json['score']); consume = json['consume']; scoreMax = Converter.toDouble(json['score_max']); stepCount = json['step_count']; jumpCount = json['jump_count']; crouchCount = json['crouch_count']; durationAvg = json['duration_avg']; scoreAvg = json['score_avg']; consumePerMin = json['consume_per_min']; durationTotalMinute = json['duration_minute']; game = json['game'] != null ? new GameInfoData.fromJson(json['game']) : null; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['user_id'] = this.userId; data['game_id'] = this.gameId; data['last_play_at'] = this.lastPlayAt; data['times'] = this.times; data['duration'] = this.duration; data['score'] = this.score; data['consume'] = this.consume; data['score_max'] = this.scoreMax; data['step_count'] = this.stepCount; data['jump_count'] = this.jumpCount; data['crouch_count'] = this.crouchCount; data['duration_avg'] = this.durationAvg; data['score_avg'] = this.scoreAvg; data['consume_per_min'] = this.consumePerMin; data['duration_minute'] = this.durationTotalMinute; return data; } }