import 'package:anyway/structs/landmark.dart'; import 'package:flutter/material.dart'; class SinglePreference { String slug; String name; String description; int value; int minVal; int maxVal; Icon icon; SinglePreference({ required this.slug, required this.name, required this.description, required this.value, required this.icon, this.minVal = 0, this.maxVal = 5, }); } class UserPreferences { SinglePreference sightseeing = SinglePreference( name: "Sightseeing", slug: "sightseeing", description: "How much do you like sightseeing?", value: 0, icon: typeSightseeing.icon, ); SinglePreference shopping = SinglePreference( name: "Shopping", slug: "shopping", description: "How much do you like shopping?", value: 0, icon: typeShopping.icon, ); SinglePreference nature = SinglePreference( name: "Nature", slug: "nature", description: "How much do you like nature?", value: 0, icon: typeNature.icon, ); SinglePreference maxTime = SinglePreference( name: "Trip duration", slug: "duration", description: "How long should your trip be?", value: 30, minVal: 30, maxVal: 720, icon: Icon(Icons.timer), ); Map toJson() { // This is "opinionated" JSON, corresponding to the backend's expectations return { "sightseeing": {"type": "sightseeing", "score": sightseeing.value}, "shopping": {"type": "shopping", "score": shopping.value}, "nature": {"type": "nature", "score": nature.value}, "max_time_minute": maxTime.value }; } }