Skip to content

Commit

Permalink
improve: Require params to create stim
Browse files Browse the repository at this point in the history
improve: Add stim params to config

refactor: Pass stim specs to config
  • Loading branch information
mario-bermonti committed Jun 9, 2024
1 parent a43adbc commit 45d908c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
12 changes: 9 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ class _HomePageState extends State<HomePage> {

// Define config for practice session
UserConfig practiceConfig = UserConfig(
stimList: ['12'],
minStimSize: 2,
maxStimSize: 2,
countEachSize: 1,
participantID: participantID,
sessionID: sessionID,
sessionType: SessionType.practice,
Expand All @@ -93,7 +95,9 @@ class _HomePageState extends State<HomePage> {

// Define config for experimental session
UserConfig experimentalConfig = UserConfig(
stimList: ['5678', '98765'],
minStimSize: 4,
maxStimSize: 5,
countEachSize: 1,
participantID: participantID,
sessionID: sessionID,
sessionType: SessionType.experimental,
Expand All @@ -110,7 +114,9 @@ class _HomePageState extends State<HomePage> {
required String sessionID,
}) async {
UserConfig config = UserConfig(
stimList: ['901234'],
minStimSize: 6,
maxStimSize: 6,
countEachSize: 1,
participantID: participantID,
sessionID: sessionID,
restInstructions: const RestInstructions(),
Expand Down
20 changes: 12 additions & 8 deletions lib/src/digit_span_task/components/config/user_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ import 'session_type.dart';
/// The [UserConfig] contains settings the user can use to modify the behavior
/// of the app.
class UserConfig extends GetxController {
/// [stimList] is the list of stimuli to be presented to participants.
/// The digits in the digit sets of [stimList]
/// are randomized (e.g., "123" may be turned into "213").
late final List<String> stimList;
/// Size of smallest digit set
final int minStimSize;

/// Size of largest digit set
final int maxStimSize;

/// Number of sets to create for each size
final int countEachSize;

/// ID that uniquely identifies this participant's session.
/// It will be used to pair the different data collected by [digit_span_tasks]
Expand All @@ -37,12 +41,12 @@ class UserConfig extends GetxController {
final Widget restInstructions;

UserConfig({
required stimList,
required this.sessionID,
required this.participantID,
required this.sessionType,
required this.restInstructions,
}) {
this.stimList = randomizeDigitsInSets(stimList);
}
required this.minStimSize,
required this.maxStimSize,
required this.countEachSize,
});
}

0 comments on commit 45d908c

Please sign in to comment.