68 lines
1.6 KiB
Dart
68 lines
1.6 KiB
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: Icon(Icons.church),
|
|
);
|
|
SinglePreference shopping = SinglePreference(
|
|
name: "Shopping",
|
|
slug: "shopping",
|
|
description: "How much do you like shopping?",
|
|
value: 0,
|
|
icon: Icon(Icons.shopping_bag),
|
|
);
|
|
SinglePreference nature = SinglePreference(
|
|
name: "Nature",
|
|
slug: "nature",
|
|
description: "How much do you like nature?",
|
|
value: 0,
|
|
icon: Icon(Icons.landscape),
|
|
);
|
|
|
|
SinglePreference maxTime = SinglePreference(
|
|
name: "Trip duration",
|
|
slug: "duration",
|
|
description: "How long do you want your trip to be?",
|
|
value: 30,
|
|
minVal: 30,
|
|
maxVal: 720,
|
|
icon: Icon(Icons.timer),
|
|
);
|
|
|
|
|
|
Map<String, dynamic> 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
|
|
};
|
|
}
|
|
} |