Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: theme history UI #4

Merged
merged 5 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added gdsc_art/images/swirl1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gdsc_art/images/swirl2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gdsc_art/images/swirl3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gdsc_art/images/swirl4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 75 additions & 0 deletions gdsc_art/lib/Model/history_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
class HistoryModel {
final String src;
final Artist artist;
final Art art;
final String id;

HistoryModel({
required this.src,
required this.artist,
required this.art,
required this.id,
});

factory HistoryModel.fromJson(Map<String, dynamic> json) {
return HistoryModel(
src: json['src'],
artist: Artist.fromJson(json['artist']),
art: Art.fromJson(json['art']),
id: json['_id'],
);
}

Map<String, dynamic> toJson() {
return {
'src': src,
'artist': artist.toJson(),
'art': art.toJson(),
'_id': id,
};
}
}

class Artist {
final String name;
final String period;

Artist({
required this.name,
required this.period,
});

factory Artist.fromJson(Map<String, dynamic> json) {
return Artist(
name: json['name'],
period: json['period'],
);
}

Map<String, dynamic> toJson() {
return {
'name': name,
'period': period,
};
}
}

class Art {
final String year;

Art({
required this.year,
});

factory Art.fromJson(Map<String, dynamic> json) {
return Art(
year: json['year'],
);
}

Map<String, dynamic> toJson() {
return {
'year': year,
};
}
}
9 changes: 8 additions & 1 deletion gdsc_art/lib/Model/theme_model.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:gdsc_artwork/Model/history_model.dart';

class ThemeModel {
final String id;
final String title;
Expand All @@ -8,6 +10,7 @@ class ThemeModel {
final String workTitle;
final List<String> workImages;
final String workDescription;
final List<HistoryModel> history;

ThemeModel({
required this.id,
Expand All @@ -19,6 +22,7 @@ class ThemeModel {
required this.workTitle,
required this.workImages,
required this.workDescription,
required this.history,
});

factory ThemeModel.fromJson(Map<String, dynamic> json) {
Expand All @@ -32,6 +36,9 @@ class ThemeModel {
workTitle: json['work_title'],
workImages: List<String>.from(json['work_images']),
workDescription: json['work_description'],
history: (json['history'] as List)
.map((history) => HistoryModel.fromJson(history))
.toList(),
);
}
}
}
Loading
Loading