chore(front): supprimer le préremplissage et les données aléatoires à l’inscription
- Parcours AM : plus de jeu de test Marie DUBOIS ni photo factice - Parcours parent : plus de DataGenerator ; enfants vides à l’ajout - Suppression de data_generator.dart (inutilisé) Made-with: Cursor
This commit is contained in:
parent
0a07fade40
commit
481fa66630
@ -13,20 +13,7 @@ class AmRegisterStep1Screen extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final registrationData = Provider.of<AmRegistrationData>(context, listen: false);
|
final registrationData = Provider.of<AmRegistrationData>(context, listen: false);
|
||||||
|
|
||||||
// Données de test : Marie DUBOIS (jeu de test 03_seed_test_data.sql / docs/test-data)
|
final initialData = PersonalInfoData(
|
||||||
PersonalInfoData initialData;
|
|
||||||
if (registrationData.firstName.isEmpty) {
|
|
||||||
initialData = PersonalInfoData(
|
|
||||||
firstName: 'Marie',
|
|
||||||
lastName: 'DUBOIS',
|
|
||||||
phone: '0696345678',
|
|
||||||
email: 'marie.dubois@ptits-pas.fr',
|
|
||||||
address: '25 Rue de la République',
|
|
||||||
postalCode: '95870',
|
|
||||||
city: 'Bezons',
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
initialData = PersonalInfoData(
|
|
||||||
firstName: registrationData.firstName,
|
firstName: registrationData.firstName,
|
||||||
lastName: registrationData.lastName,
|
lastName: registrationData.lastName,
|
||||||
phone: registrationData.phone,
|
phone: registrationData.phone,
|
||||||
@ -35,7 +22,6 @@ class AmRegisterStep1Screen extends StatelessWidget {
|
|||||||
postalCode: registrationData.postalCode,
|
postalCode: registrationData.postalCode,
|
||||||
city: registrationData.city,
|
city: registrationData.city,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
return PersonalInfoFormScreen(
|
return PersonalInfoFormScreen(
|
||||||
stepText: 'Étape 1/4',
|
stepText: 'Étape 1/4',
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:intl/intl.dart';
|
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import '../../models/am_registration_data.dart';
|
import '../../models/am_registration_data.dart';
|
||||||
import '../../models/card_assets.dart';
|
import '../../models/card_assets.dart';
|
||||||
@ -17,24 +15,9 @@ class AmRegisterStep2Screen extends StatefulWidget {
|
|||||||
|
|
||||||
class _AmRegisterStep2ScreenState extends State<AmRegisterStep2Screen> {
|
class _AmRegisterStep2ScreenState extends State<AmRegisterStep2Screen> {
|
||||||
String? _photoPathFramework;
|
String? _photoPathFramework;
|
||||||
File? _photoFile;
|
|
||||||
|
|
||||||
Future<void> _pickPhoto() async {
|
Future<void> _pickPhoto() async {
|
||||||
// TODO: Remplacer par la vraie logique ImagePicker
|
// TODO: brancher ImagePicker ; ne pas préremplir de chemin factice
|
||||||
// final imagePicker = ImagePicker();
|
|
||||||
// final pickedFile = await imagePicker.pickImage(source: ImageSource.gallery);
|
|
||||||
// if (pickedFile != null) {
|
|
||||||
// setState(() {
|
|
||||||
// _photoFile = File(pickedFile.path);
|
|
||||||
// _photoPathFramework = pickedFile.path;
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
setState(() {
|
|
||||||
_photoPathFramework = 'assets/images/icon_assmat.png';
|
|
||||||
_photoFile = null;
|
|
||||||
});
|
|
||||||
// }
|
|
||||||
print("Photo sélectionnée: $_photoPathFramework");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -53,20 +36,6 @@ class _AmRegisterStep2ScreenState extends State<AmRegisterStep2Screen> {
|
|||||||
capacity: registrationData.capacity,
|
capacity: registrationData.capacity,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Données de test : Marie DUBOIS (jeu de test 03_seed_test_data.sql / docs/test-data)
|
|
||||||
if (registrationData.dateOfBirth == null && registrationData.nir.isEmpty) {
|
|
||||||
initialData = ProfessionalInfoData(
|
|
||||||
photoPath: 'assets/images/icon_assmat.png',
|
|
||||||
photoConsent: true,
|
|
||||||
dateOfBirth: DateTime(1980, 6, 8),
|
|
||||||
birthCity: 'Bezons',
|
|
||||||
birthCountry: 'France',
|
|
||||||
nir: '280062A00100191',
|
|
||||||
agrementNumber: 'AGR-2019-095001',
|
|
||||||
capacity: 4,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ProfessionalInfoFormScreen(
|
return ProfessionalInfoFormScreen(
|
||||||
stepText: 'Étape 2/4',
|
stepText: 'Étape 2/4',
|
||||||
title: 'Vos informations professionnelles',
|
title: 'Vos informations professionnelles',
|
||||||
|
|||||||
@ -13,22 +13,13 @@ class AmRegisterStep3Screen extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final data = Provider.of<AmRegistrationData>(context, listen: false);
|
final data = Provider.of<AmRegistrationData>(context, listen: false);
|
||||||
|
|
||||||
// Données de test : Marie DUBOIS (jeu de test 03_seed_test_data.sql / docs/test-data)
|
|
||||||
String initialText = data.presentationText;
|
|
||||||
bool initialCgu = data.cguAccepted;
|
|
||||||
|
|
||||||
if (initialText.isEmpty) {
|
|
||||||
initialText = 'Assistante maternelle agréée depuis 2019. Spécialité bébés 0-18 mois. Accueil bienveillant et cadre sécurisant. 2 places disponibles.';
|
|
||||||
initialCgu = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return PresentationFormScreen(
|
return PresentationFormScreen(
|
||||||
stepText: 'Étape 3/4',
|
stepText: 'Étape 3/4',
|
||||||
title: 'Présentation et Conditions',
|
title: 'Présentation et Conditions',
|
||||||
cardColor: CardColorHorizontal.peach,
|
cardColor: CardColorHorizontal.peach,
|
||||||
textFieldHint: 'Ex: Disponible immédiatement, 10 ans d\'expérience, formation premiers secours...',
|
textFieldHint: 'Ex: Disponible immédiatement, 10 ans d\'expérience, formation premiers secours...',
|
||||||
initialText: initialText,
|
initialText: data.presentationText,
|
||||||
initialCguAccepted: initialCgu,
|
initialCguAccepted: data.cguAccepted,
|
||||||
previousRoute: '/am-register-step2',
|
previousRoute: '/am-register-step2',
|
||||||
onSubmit: (text, cguAccepted) {
|
onSubmit: (text, cguAccepted) {
|
||||||
data.updatePresentationAndCgu(
|
data.updatePresentationAndCgu(
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import 'package:provider/provider.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
import '../../models/user_registration_data.dart';
|
import '../../models/user_registration_data.dart';
|
||||||
import '../../utils/data_generator.dart';
|
|
||||||
import '../../widgets/personal_info_form_screen.dart';
|
import '../../widgets/personal_info_form_screen.dart';
|
||||||
import '../../models/card_assets.dart';
|
import '../../models/card_assets.dart';
|
||||||
|
|
||||||
@ -15,22 +14,7 @@ class ParentRegisterStep1Screen extends StatelessWidget {
|
|||||||
final registrationData = Provider.of<UserRegistrationData>(context, listen: false);
|
final registrationData = Provider.of<UserRegistrationData>(context, listen: false);
|
||||||
final parent1 = registrationData.parent1;
|
final parent1 = registrationData.parent1;
|
||||||
|
|
||||||
// Générer des données de test si vide
|
final initialData = PersonalInfoData(
|
||||||
PersonalInfoData initialData;
|
|
||||||
if (parent1.firstName.isEmpty) {
|
|
||||||
final genFirstName = DataGenerator.firstName();
|
|
||||||
final genLastName = DataGenerator.lastName();
|
|
||||||
initialData = PersonalInfoData(
|
|
||||||
firstName: genFirstName,
|
|
||||||
lastName: genLastName,
|
|
||||||
phone: DataGenerator.phone(),
|
|
||||||
email: DataGenerator.email(genFirstName, genLastName),
|
|
||||||
address: DataGenerator.address(),
|
|
||||||
postalCode: DataGenerator.postalCode(),
|
|
||||||
city: DataGenerator.city(),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
initialData = PersonalInfoData(
|
|
||||||
firstName: parent1.firstName,
|
firstName: parent1.firstName,
|
||||||
lastName: parent1.lastName,
|
lastName: parent1.lastName,
|
||||||
phone: parent1.phone,
|
phone: parent1.phone,
|
||||||
@ -39,7 +23,6 @@ class ParentRegisterStep1Screen extends StatelessWidget {
|
|||||||
postalCode: parent1.postalCode,
|
postalCode: parent1.postalCode,
|
||||||
city: parent1.city,
|
city: parent1.city,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
return PersonalInfoFormScreen(
|
return PersonalInfoFormScreen(
|
||||||
stepText: 'Étape 1/5',
|
stepText: 'Étape 1/5',
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import 'package:provider/provider.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
import '../../models/user_registration_data.dart';
|
import '../../models/user_registration_data.dart';
|
||||||
import '../../utils/data_generator.dart';
|
|
||||||
import '../../widgets/personal_info_form_screen.dart';
|
import '../../widgets/personal_info_form_screen.dart';
|
||||||
import '../../models/card_assets.dart';
|
import '../../models/card_assets.dart';
|
||||||
|
|
||||||
@ -19,21 +18,17 @@ class ParentRegisterStep2Screen extends StatelessWidget {
|
|||||||
bool hasParent2 = parent2 != null;
|
bool hasParent2 = parent2 != null;
|
||||||
bool sameAddress = false;
|
bool sameAddress = false;
|
||||||
|
|
||||||
// Générer des données de test si vide
|
|
||||||
PersonalInfoData initialData;
|
PersonalInfoData initialData;
|
||||||
if (parent2 == null || parent2.firstName.isEmpty) {
|
if (parent2 == null || parent2.firstName.isEmpty) {
|
||||||
final genFirstName = DataGenerator.firstName();
|
sameAddress = false;
|
||||||
final genLastName = DataGenerator.lastName();
|
|
||||||
sameAddress = DataGenerator.boolean();
|
|
||||||
|
|
||||||
initialData = PersonalInfoData(
|
initialData = PersonalInfoData(
|
||||||
firstName: genFirstName,
|
firstName: parent2?.firstName ?? '',
|
||||||
lastName: genLastName,
|
lastName: parent2?.lastName ?? '',
|
||||||
phone: DataGenerator.phone(),
|
phone: parent2?.phone ?? '',
|
||||||
email: DataGenerator.email(genFirstName, genLastName),
|
email: parent2?.email ?? '',
|
||||||
address: sameAddress ? parent1.address : DataGenerator.address(),
|
address: parent2?.address ?? '',
|
||||||
postalCode: sameAddress ? parent1.postalCode : DataGenerator.postalCode(),
|
postalCode: parent2?.postalCode ?? '',
|
||||||
city: sameAddress ? parent1.city : DataGenerator.city(),
|
city: parent2?.city ?? '',
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
sameAddress = (parent2.address == parent1.address &&
|
sameAddress = (parent2.address == parent1.address &&
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import '../../widgets/hover_relief_widget.dart';
|
|||||||
import '../../widgets/child_card_widget.dart';
|
import '../../widgets/child_card_widget.dart';
|
||||||
import '../../widgets/custom_navigation_button.dart';
|
import '../../widgets/custom_navigation_button.dart';
|
||||||
import '../../models/user_registration_data.dart';
|
import '../../models/user_registration_data.dart';
|
||||||
import '../../utils/data_generator.dart';
|
|
||||||
import '../../models/card_assets.dart';
|
import '../../models/card_assets.dart';
|
||||||
import '../../config/display_config.dart';
|
import '../../config/display_config.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@ -92,8 +91,6 @@ class _ParentRegisterStep3ScreenState extends State<ParentRegisterStep3Screen> {
|
|||||||
|
|
||||||
void _addChild(UserRegistrationData registrationData) { // Prend registrationData
|
void _addChild(UserRegistrationData registrationData) { // Prend registrationData
|
||||||
setState(() {
|
setState(() {
|
||||||
bool isUnborn = DataGenerator.boolean();
|
|
||||||
|
|
||||||
// Trouver la première couleur non utilisée
|
// Trouver la première couleur non utilisée
|
||||||
CardColorVertical cardColor = _childCardColors.firstWhere(
|
CardColorVertical cardColor = _childCardColors.firstWhere(
|
||||||
(color) => !_usedColors.contains(color),
|
(color) => !_usedColors.contains(color),
|
||||||
@ -102,11 +99,11 @@ class _ParentRegisterStep3ScreenState extends State<ParentRegisterStep3Screen> {
|
|||||||
|
|
||||||
final newChild = ChildData(
|
final newChild = ChildData(
|
||||||
lastName: registrationData.parent1.lastName,
|
lastName: registrationData.parent1.lastName,
|
||||||
firstName: DataGenerator.firstName(),
|
firstName: '',
|
||||||
dob: DataGenerator.dob(isUnborn: isUnborn),
|
dob: '',
|
||||||
isUnbornChild: isUnborn,
|
isUnbornChild: false,
|
||||||
photoConsent: DataGenerator.boolean(),
|
photoConsent: false,
|
||||||
multipleBirth: DataGenerator.boolean(),
|
multipleBirth: false,
|
||||||
cardColor: cardColor,
|
cardColor: cardColor,
|
||||||
);
|
);
|
||||||
registrationData.addChild(newChild);
|
registrationData.addChild(newChild);
|
||||||
@ -317,7 +314,7 @@ class _ParentRegisterStep3ScreenState extends State<ParentRegisterStep3Screen> {
|
|||||||
onToggleIsUnborn: (newValue) {
|
onToggleIsUnborn: (newValue) {
|
||||||
final oldChild = registrationData.children[index];
|
final oldChild = registrationData.children[index];
|
||||||
registrationData.updateChild(index, ChildData(
|
registrationData.updateChild(index, ChildData(
|
||||||
firstName: oldChild.firstName, lastName: oldChild.lastName, dob: DataGenerator.dob(isUnborn: newValue),
|
firstName: oldChild.firstName, lastName: oldChild.lastName, dob: oldChild.dob,
|
||||||
photoConsent: oldChild.photoConsent, multipleBirth: oldChild.multipleBirth, isUnbornChild: newValue,
|
photoConsent: oldChild.photoConsent, multipleBirth: oldChild.multipleBirth, isUnbornChild: newValue,
|
||||||
imageFile: oldChild.imageFile, cardColor: oldChild.cardColor
|
imageFile: oldChild.imageFile, cardColor: oldChild.cardColor
|
||||||
));
|
));
|
||||||
@ -423,7 +420,7 @@ class _ParentRegisterStep3ScreenState extends State<ParentRegisterStep3Screen> {
|
|||||||
onToggleIsUnborn: (newValue) {
|
onToggleIsUnborn: (newValue) {
|
||||||
final oldChild = registrationData.children[index];
|
final oldChild = registrationData.children[index];
|
||||||
registrationData.updateChild(index, ChildData(
|
registrationData.updateChild(index, ChildData(
|
||||||
firstName: oldChild.firstName, lastName: oldChild.lastName, dob: DataGenerator.dob(isUnborn: newValue),
|
firstName: oldChild.firstName, lastName: oldChild.lastName, dob: oldChild.dob,
|
||||||
photoConsent: oldChild.photoConsent, multipleBirth: oldChild.multipleBirth, isUnbornChild: newValue,
|
photoConsent: oldChild.photoConsent, multipleBirth: oldChild.multipleBirth, isUnbornChild: newValue,
|
||||||
imageFile: oldChild.imageFile, cardColor: oldChild.cardColor
|
imageFile: oldChild.imageFile, cardColor: oldChild.cardColor
|
||||||
));
|
));
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import 'package:go_router/go_router.dart';
|
|||||||
import '../../models/user_registration_data.dart';
|
import '../../models/user_registration_data.dart';
|
||||||
import '../../widgets/presentation_form_screen.dart';
|
import '../../widgets/presentation_form_screen.dart';
|
||||||
import '../../models/card_assets.dart';
|
import '../../models/card_assets.dart';
|
||||||
import '../../utils/data_generator.dart';
|
|
||||||
|
|
||||||
class ParentRegisterStep4Screen extends StatelessWidget {
|
class ParentRegisterStep4Screen extends StatelessWidget {
|
||||||
const ParentRegisterStep4Screen({super.key});
|
const ParentRegisterStep4Screen({super.key});
|
||||||
@ -14,22 +13,13 @@ class ParentRegisterStep4Screen extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final registrationData = Provider.of<UserRegistrationData>(context, listen: false);
|
final registrationData = Provider.of<UserRegistrationData>(context, listen: false);
|
||||||
|
|
||||||
// Générer un texte de test si vide
|
|
||||||
String initialText = registrationData.motivationText;
|
|
||||||
bool initialCgu = registrationData.cguAccepted;
|
|
||||||
|
|
||||||
if (initialText.isEmpty) {
|
|
||||||
initialText = DataGenerator.motivation();
|
|
||||||
initialCgu = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return PresentationFormScreen(
|
return PresentationFormScreen(
|
||||||
stepText: 'Étape 4/5',
|
stepText: 'Étape 4/5',
|
||||||
title: 'Motivation de votre demande',
|
title: 'Motivation de votre demande',
|
||||||
cardColor: CardColorHorizontal.green,
|
cardColor: CardColorHorizontal.green,
|
||||||
textFieldHint: 'Écrivez ici pour motiver votre demande...',
|
textFieldHint: 'Écrivez ici pour motiver votre demande...',
|
||||||
initialText: initialText,
|
initialText: registrationData.motivationText,
|
||||||
initialCguAccepted: initialCgu,
|
initialCguAccepted: registrationData.cguAccepted,
|
||||||
previousRoute: '/parent-register-step3',
|
previousRoute: '/parent-register-step3',
|
||||||
onSubmit: (text, cguAccepted) {
|
onSubmit: (text, cguAccepted) {
|
||||||
registrationData.updateMotivation(text);
|
registrationData.updateMotivation(text);
|
||||||
|
|||||||
@ -1,70 +0,0 @@
|
|||||||
import 'dart:math';
|
|
||||||
|
|
||||||
class DataGenerator {
|
|
||||||
static final Random _random = Random();
|
|
||||||
|
|
||||||
// Méthodes publiques pour la génération de nombres aléatoires
|
|
||||||
static int randomInt(int max) => _random.nextInt(max);
|
|
||||||
static int randomIntInRange(int min, int max) => min + _random.nextInt(max - min);
|
|
||||||
static bool randomBool() => _random.nextBool();
|
|
||||||
|
|
||||||
static final List<String> _firstNames = [
|
|
||||||
'Alice', 'Bob', 'Charlie', 'David', 'Eva', 'Félix', 'Gabrielle', 'Hugo', 'Inès', 'Jules',
|
|
||||||
'Léa', 'Manon', 'Nathan', 'Oscar', 'Pauline', 'Quentin', 'Raphaël', 'Sophie', 'Théo', 'Victoire'
|
|
||||||
];
|
|
||||||
|
|
||||||
static final List<String> _lastNames = [
|
|
||||||
'Martin', 'Bernard', 'Dubois', 'Thomas', 'Robert', 'Richard', 'Petit', 'Durand', 'Leroy', 'Moreau',
|
|
||||||
'Simon', 'Laurent', 'Lefebvre', 'Michel', 'Garcia', 'David', 'Bertrand', 'Roux', 'Vincent', 'Fournier'
|
|
||||||
];
|
|
||||||
|
|
||||||
static final List<String> _addressSuffixes = [
|
|
||||||
'Rue de la Paix', 'Boulevard des Rêves', 'Avenue du Soleil', 'Place des Étoiles', 'Chemin des Champs'
|
|
||||||
];
|
|
||||||
|
|
||||||
static final List<String> _motivationSnippets = [
|
|
||||||
'Nous cherchons une personne de confiance.',
|
|
||||||
'Nos horaires sont atypiques.',
|
|
||||||
'Notre enfant est plein de vie.',
|
|
||||||
'Nous souhaitons une garde à temps plein.',
|
|
||||||
'Une adaptation en douceur est primordiale pour nous.',
|
|
||||||
'Nous avons hâte de vous rencontrer.',
|
|
||||||
'La pédagogie Montessori nous intéresse.'
|
|
||||||
];
|
|
||||||
|
|
||||||
static String firstName() => _firstNames[_random.nextInt(_firstNames.length)];
|
|
||||||
static String lastName() => _lastNames[_random.nextInt(_lastNames.length)];
|
|
||||||
static String address() => "${_random.nextInt(100) + 1} ${_addressSuffixes[_random.nextInt(_addressSuffixes.length)]}";
|
|
||||||
static String postalCode() => "750${_random.nextInt(10)}${_random.nextInt(10)}";
|
|
||||||
static String city() => "Paris";
|
|
||||||
static String phone() => "06${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}${_random.nextInt(10)}";
|
|
||||||
static String email(String firstName, String lastName) => "${firstName.toLowerCase()}.${lastName.toLowerCase()}@example.com";
|
|
||||||
static String password() => "password123"; // Simple pour le test
|
|
||||||
|
|
||||||
static String dob({bool isUnborn = false}) {
|
|
||||||
final now = DateTime.now();
|
|
||||||
if (isUnborn) {
|
|
||||||
final provisionalDate = now.add(Duration(days: _random.nextInt(180) + 30)); // Entre 1 et 7 mois dans le futur
|
|
||||||
return "${provisionalDate.day.toString().padLeft(2, '0')}/${provisionalDate.month.toString().padLeft(2, '0')}/${provisionalDate.year}";
|
|
||||||
} else {
|
|
||||||
final birthYear = now.year - _random.nextInt(3); // Enfants de 0 à 2 ans
|
|
||||||
final birthMonth = _random.nextInt(12) + 1;
|
|
||||||
final birthDay = _random.nextInt(28) + 1; // Simple, évite les pbs de jours/mois
|
|
||||||
return "${birthDay.toString().padLeft(2, '0')}/${birthMonth.toString().padLeft(2, '0')}/${birthYear}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool boolean() => _random.nextBool();
|
|
||||||
|
|
||||||
static String motivation() {
|
|
||||||
int count = _random.nextInt(3) + 2; // 2 à 4 phrases
|
|
||||||
List<String> chosenSnippets = [];
|
|
||||||
while(chosenSnippets.length < count) {
|
|
||||||
String snippet = _motivationSnippets[_random.nextInt(_motivationSnippets.length)];
|
|
||||||
if (!chosenSnippets.contains(snippet)) {
|
|
||||||
chosenSnippets.add(snippet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return chosenSnippets.join(' ');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user