chore: fix scrolling issue (#3863)
This commit is contained in:
parent
740b2287f9
commit
8ea131bf5e
2 changed files with 159 additions and 175 deletions
|
|
@ -12,7 +12,6 @@ import 'package:fluffychat/pangea/common/widgets/share_room_button.dart';
|
||||||
import 'package:fluffychat/pangea/extensions/pangea_room_extension.dart';
|
import 'package:fluffychat/pangea/extensions/pangea_room_extension.dart';
|
||||||
import 'package:fluffychat/utils/stream_extension.dart';
|
import 'package:fluffychat/utils/stream_extension.dart';
|
||||||
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
import 'package:fluffychat/widgets/future_loading_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
|
||||||
|
|
||||||
class ActivitySessionStartView extends StatelessWidget {
|
class ActivitySessionStartView extends StatelessWidget {
|
||||||
final ActivitySessionStartController controller;
|
final ActivitySessionStartController controller;
|
||||||
|
|
@ -54,138 +53,57 @@ class ActivitySessionStartView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: MaxWidthBody(
|
body: SafeArea(
|
||||||
showBorder: false,
|
child: Column(
|
||||||
withScrolling: false,
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Expanded(
|
||||||
children: [
|
child: SingleChildScrollView(
|
||||||
Expanded(
|
child: Container(
|
||||||
child: SingleChildScrollView(
|
constraints: const BoxConstraints(
|
||||||
child: Padding(
|
maxWidth: 600.0,
|
||||||
padding: const EdgeInsets.all(12.0),
|
),
|
||||||
child: Column(
|
padding: const EdgeInsets.all(12.0),
|
||||||
spacing: 12.0,
|
child: Column(
|
||||||
children: [
|
spacing: 12.0,
|
||||||
ActivitySummary(
|
children: [
|
||||||
room: controller.room,
|
ActivitySummary(
|
||||||
showInstructions: controller.showInstructions,
|
room: controller.room,
|
||||||
toggleInstructions:
|
showInstructions: controller.showInstructions,
|
||||||
controller.toggleInstructions,
|
toggleInstructions: controller.toggleInstructions,
|
||||||
onTapParticipant: controller.selectRole,
|
onTapParticipant: controller.selectRole,
|
||||||
isParticipantSelected:
|
isParticipantSelected:
|
||||||
controller.isParticipantSelected,
|
controller.isParticipantSelected,
|
||||||
canSelectParticipant:
|
canSelectParticipant:
|
||||||
controller.canSelectParticipant,
|
controller.canSelectParticipant,
|
||||||
),
|
|
||||||
const SizedBox(height: 250.0),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
AnimatedSize(
|
||||||
bottom: 0,
|
duration: FluffyThemes.animationDuration,
|
||||||
left: 0,
|
child: Container(
|
||||||
right: 0,
|
decoration: BoxDecoration(
|
||||||
child: AnimatedSize(
|
border: Border(
|
||||||
duration: FluffyThemes.animationDuration,
|
top: BorderSide(color: theme.dividerColor),
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border(
|
|
||||||
top: BorderSide(color: theme.dividerColor),
|
|
||||||
),
|
|
||||||
color: theme.colorScheme.surface,
|
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.all(24.0),
|
color: theme.colorScheme.surface,
|
||||||
child: Column(
|
),
|
||||||
spacing: 16.0,
|
padding: const EdgeInsets.all(24.0),
|
||||||
children: [
|
child: Column(
|
||||||
Text(
|
spacing: 16.0,
|
||||||
controller.descriptionText,
|
children: [
|
||||||
style: const TextStyle(
|
Text(
|
||||||
fontSize: 16,
|
controller.descriptionText,
|
||||||
fontWeight: FontWeight.w600,
|
style: const TextStyle(
|
||||||
),
|
fontSize: 16,
|
||||||
textAlign: TextAlign.center,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
if (controller.state ==
|
textAlign: TextAlign.center,
|
||||||
SessionState.confirmedRole) ...[
|
),
|
||||||
if (controller.room.courseParent != null)
|
if (controller.state == SessionState.confirmedRole) ...[
|
||||||
ElevatedButton(
|
if (controller.room.courseParent != null)
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor:
|
|
||||||
theme.colorScheme.primaryContainer,
|
|
||||||
foregroundColor:
|
|
||||||
theme.colorScheme.onPrimaryContainer,
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(20.0),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onPressed: () => showFutureLoadingDialog(
|
|
||||||
context: context,
|
|
||||||
future: controller.pingCourse,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
L10n.of(context).pingParticipants,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (controller.room.isRoomAdmin) ...[
|
|
||||||
ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor:
|
|
||||||
theme.colorScheme.primaryContainer,
|
|
||||||
foregroundColor:
|
|
||||||
theme.colorScheme.onPrimaryContainer,
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(20.0),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onPressed: () => showFutureLoadingDialog(
|
|
||||||
context: context,
|
|
||||||
future: () => controller.room
|
|
||||||
.invite(BotName.byEnvironment),
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(L10n.of(context).playWithBot),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor:
|
|
||||||
theme.colorScheme.primaryContainer,
|
|
||||||
foregroundColor:
|
|
||||||
theme.colorScheme.onPrimaryContainer,
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(20.0),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onPressed: () => context.go(
|
|
||||||
"/rooms/${controller.room.id}/invite",
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(L10n.of(context).inviteFriends),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
] else
|
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
|
|
@ -197,18 +115,88 @@ class ActivitySessionStartView extends StatelessWidget {
|
||||||
borderRadius: BorderRadius.circular(20.0),
|
borderRadius: BorderRadius.circular(20.0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: controller.enableButtons
|
onPressed: () => showFutureLoadingDialog(
|
||||||
? controller.onTap
|
context: context,
|
||||||
: null,
|
future: controller.pingCourse,
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(controller.buttonText),
|
Text(
|
||||||
|
L10n.of(context).pingParticipants,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
if (controller.room.isRoomAdmin) ...[
|
||||||
),
|
ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor:
|
||||||
|
theme.colorScheme.primaryContainer,
|
||||||
|
foregroundColor:
|
||||||
|
theme.colorScheme.onPrimaryContainer,
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(20.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () => showFutureLoadingDialog(
|
||||||
|
context: context,
|
||||||
|
future: () => controller.room
|
||||||
|
.invite(BotName.byEnvironment),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(L10n.of(context).playWithBot),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor:
|
||||||
|
theme.colorScheme.primaryContainer,
|
||||||
|
foregroundColor:
|
||||||
|
theme.colorScheme.onPrimaryContainer,
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(20.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () => context.go(
|
||||||
|
"/rooms/${controller.room.id}/invite",
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(L10n.of(context).inviteFriends),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
] else
|
||||||
|
ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor:
|
||||||
|
theme.colorScheme.primaryContainer,
|
||||||
|
foregroundColor:
|
||||||
|
theme.colorScheme.onPrimaryContainer,
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(20.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: controller.enableButtons
|
||||||
|
? controller.onTap
|
||||||
|
: null,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(controller.buttonText),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -203,51 +203,47 @@ class WordMatchContent extends StatelessWidget {
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Stack(
|
return SizedBox(
|
||||||
children: [
|
height: 300.0,
|
||||||
SizedBox(
|
child: Column(
|
||||||
height: 300.0,
|
children: [
|
||||||
child: Scrollbar(
|
Expanded(
|
||||||
controller: scrollController,
|
child: Scrollbar(
|
||||||
child: SingleChildScrollView(
|
|
||||||
controller: scrollController,
|
controller: scrollController,
|
||||||
child: Column(
|
child: SingleChildScrollView(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
controller: scrollController,
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
child: Column(
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
const SizedBox(height: 8),
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
ChoicesArray(
|
children: [
|
||||||
originalSpan: controller.pangeaMatch!.matchContent,
|
const SizedBox(height: 8),
|
||||||
isLoading: controller.fetchingData,
|
ChoicesArray(
|
||||||
choices: controller.pangeaMatch!.match.choices
|
originalSpan: controller.pangeaMatch!.matchContent,
|
||||||
?.map(
|
isLoading: controller.fetchingData,
|
||||||
(e) => Choice(
|
choices: controller.pangeaMatch!.match.choices
|
||||||
text: e.value,
|
?.map(
|
||||||
color: e.selected ? e.type.color : null,
|
(e) => Choice(
|
||||||
isGold: e.type.name == 'bestCorrection',
|
text: e.value,
|
||||||
),
|
color: e.selected ? e.type.color : null,
|
||||||
)
|
isGold: e.type.name == 'bestCorrection',
|
||||||
.toList(),
|
),
|
||||||
onPressed: (value, index) =>
|
)
|
||||||
controller._onChoiceSelect(index),
|
.toList(),
|
||||||
selectedChoiceIndex: controller.selectedChoiceIndex,
|
onPressed: (value, index) =>
|
||||||
id: controller.pangeaMatch!.hashCode.toString(),
|
controller._onChoiceSelect(index),
|
||||||
langCode: MatrixState.pangeaController.languageController
|
selectedChoiceIndex: controller.selectedChoiceIndex,
|
||||||
.activeL2Code(),
|
id: controller.pangeaMatch!.hashCode.toString(),
|
||||||
),
|
langCode: MatrixState.pangeaController.languageController
|
||||||
const SizedBox(height: 12),
|
.activeL2Code(),
|
||||||
PromptAndFeedback(controller: controller),
|
),
|
||||||
const SizedBox(height: 60.0),
|
const SizedBox(height: 12),
|
||||||
],
|
PromptAndFeedback(controller: controller),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Container(
|
||||||
Positioned(
|
|
||||||
bottom: 0,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).cardColor,
|
color: Theme.of(context).cardColor,
|
||||||
),
|
),
|
||||||
|
|
@ -303,8 +299,8 @@ class WordMatchContent extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue