|
|
|
|
@ -31,7 +31,8 @@ class ActivityGeneratorView extends StatelessWidget {
|
|
|
|
|
final l10n = L10n.of(context);
|
|
|
|
|
|
|
|
|
|
if (controller.loading) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
return SafeArea(
|
|
|
|
|
child: Scaffold(
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
title: Text(L10n.of(context).makeYourOwnActivity),
|
|
|
|
|
),
|
|
|
|
|
@ -39,9 +40,11 @@ class ActivityGeneratorView extends StatelessWidget {
|
|
|
|
|
padding: EdgeInsets.all(32.0),
|
|
|
|
|
child: Center(child: CircularProgressIndicator()),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
} else if (controller.error != null || controller.room == null) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
return SafeArea(
|
|
|
|
|
child: Scaffold(
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
title: Text(L10n.of(context).makeYourOwnActivity),
|
|
|
|
|
),
|
|
|
|
|
@ -60,10 +63,12 @@ class ActivityGeneratorView extends StatelessWidget {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
} else if (controller.activities != null &&
|
|
|
|
|
controller.activities!.isNotEmpty) {
|
|
|
|
|
return ActivityPlannerBuilder(
|
|
|
|
|
return SafeArea(
|
|
|
|
|
child: ActivityPlannerBuilder(
|
|
|
|
|
initialActivity: controller.activities!.first,
|
|
|
|
|
initialFilename: controller.filename,
|
|
|
|
|
room: controller.room!,
|
|
|
|
|
@ -91,10 +96,12 @@ class ActivityGeneratorView extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
return SafeArea(
|
|
|
|
|
child: Scaffold(
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
title: Text(L10n.of(context).makeYourOwnActivity),
|
|
|
|
|
leading: BackButton(
|
|
|
|
|
@ -145,26 +152,29 @@ class ActivityGeneratorView extends StatelessWidget {
|
|
|
|
|
MatrixState.pangeaController.pLanguageStore.baseOptions,
|
|
|
|
|
onChange: (val) => controller
|
|
|
|
|
.setSelectedLanguageOfInstructions(val.langCode),
|
|
|
|
|
initialLanguage: controller.selectedLanguageOfInstructions !=
|
|
|
|
|
null
|
|
|
|
|
initialLanguage:
|
|
|
|
|
controller.selectedLanguageOfInstructions != null
|
|
|
|
|
? PLanguageStore.byLangCode(
|
|
|
|
|
controller.selectedLanguageOfInstructions!,
|
|
|
|
|
)
|
|
|
|
|
: MatrixState.pangeaController.languageController.userL1,
|
|
|
|
|
: MatrixState
|
|
|
|
|
.pangeaController.languageController.userL1,
|
|
|
|
|
isL2List: false,
|
|
|
|
|
decorationText: L10n.of(context).languageOfInstructionsLabel,
|
|
|
|
|
decorationText:
|
|
|
|
|
L10n.of(context).languageOfInstructionsLabel,
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 16.0),
|
|
|
|
|
PLanguageDropdown(
|
|
|
|
|
languages:
|
|
|
|
|
MatrixState.pangeaController.pLanguageStore.targetOptions,
|
|
|
|
|
languages: MatrixState
|
|
|
|
|
.pangeaController.pLanguageStore.targetOptions,
|
|
|
|
|
onChange: (val) =>
|
|
|
|
|
controller.setSelectedTargetLanguage(val.langCode),
|
|
|
|
|
initialLanguage: controller.selectedTargetLanguage != null
|
|
|
|
|
? PLanguageStore.byLangCode(
|
|
|
|
|
controller.selectedTargetLanguage!,
|
|
|
|
|
)
|
|
|
|
|
: MatrixState.pangeaController.languageController.userL2,
|
|
|
|
|
: MatrixState
|
|
|
|
|
.pangeaController.languageController.userL2,
|
|
|
|
|
decorationText: L10n.of(context).targetLanguageLabel,
|
|
|
|
|
isL2List: true,
|
|
|
|
|
),
|
|
|
|
|
@ -221,7 +231,8 @@ class ActivityGeneratorView extends StatelessWidget {
|
|
|
|
|
onTapOutside: (_) =>
|
|
|
|
|
FocusManager.instance.primaryFocus?.unfocus(),
|
|
|
|
|
onFieldSubmitted: (_) {
|
|
|
|
|
if (controller.formKey.currentState?.validate() ?? false) {
|
|
|
|
|
if (controller.formKey.currentState?.validate() ??
|
|
|
|
|
false) {
|
|
|
|
|
controller.generate();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
@ -273,7 +284,8 @@ class ActivityGeneratorView extends StatelessWidget {
|
|
|
|
|
const SizedBox(height: 24.0),
|
|
|
|
|
ElevatedButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
if (controller.formKey.currentState?.validate() ?? false) {
|
|
|
|
|
if (controller.formKey.currentState?.validate() ??
|
|
|
|
|
false) {
|
|
|
|
|
controller.generate();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
@ -291,6 +303,7 @@ class ActivityGeneratorView extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|