chore: fix scrolling issue (#3863)

pull/2245/head
ggurdin 2 months ago committed by GitHub
parent 740b2287f9
commit 8ea131bf5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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/utils/stream_extension.dart';
import 'package:fluffychat/widgets/future_loading_dialog.dart';
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
class ActivitySessionStartView extends StatelessWidget {
final ActivitySessionStartController controller;
@ -54,138 +53,105 @@ class ActivitySessionStartView extends StatelessWidget {
),
],
),
body: MaxWidthBody(
showBorder: false,
withScrolling: false,
child: Stack(
body: SafeArea(
child: Column(
children: [
Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
spacing: 12.0,
children: [
ActivitySummary(
room: controller.room,
showInstructions: controller.showInstructions,
toggleInstructions:
controller.toggleInstructions,
onTapParticipant: controller.selectRole,
isParticipantSelected:
controller.isParticipantSelected,
canSelectParticipant:
controller.canSelectParticipant,
),
const SizedBox(height: 250.0),
],
Expanded(
child: SingleChildScrollView(
child: Container(
constraints: const BoxConstraints(
maxWidth: 600.0,
),
padding: const EdgeInsets.all(12.0),
child: Column(
spacing: 12.0,
children: [
ActivitySummary(
room: controller.room,
showInstructions: controller.showInstructions,
toggleInstructions: controller.toggleInstructions,
onTapParticipant: controller.selectRole,
isParticipantSelected:
controller.isParticipantSelected,
canSelectParticipant:
controller.canSelectParticipant,
),
),
],
),
),
],
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: AnimatedSize(
duration: FluffyThemes.animationDuration,
child: Container(
decoration: BoxDecoration(
border: Border(
top: BorderSide(color: theme.dividerColor),
),
color: theme.colorScheme.surface,
AnimatedSize(
duration: FluffyThemes.animationDuration,
child: Container(
decoration: BoxDecoration(
border: Border(
top: BorderSide(color: theme.dividerColor),
),
padding: const EdgeInsets.all(24.0),
child: Column(
spacing: 16.0,
children: [
Text(
controller.descriptionText,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
textAlign: TextAlign.center,
color: theme.colorScheme.surface,
),
padding: const EdgeInsets.all(24.0),
child: Column(
spacing: 16.0,
children: [
Text(
controller.descriptionText,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
if (controller.state ==
SessionState.confirmedRole) ...[
if (controller.room.courseParent != null)
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.pingCourse,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
L10n.of(context).pingParticipants,
),
],
textAlign: TextAlign.center,
),
if (controller.state == SessionState.confirmedRole) ...[
if (controller.room.courseParent != null)
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),
),
),
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),
],
),
onPressed: () => showFutureLoadingDialog(
context: context,
future: controller.pingCourse,
),
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),
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: () => context.go(
"/rooms/${controller.room.id}/invite",
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(L10n.of(context).inviteFriends),
],
),
),
],
] else
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:
@ -197,18 +163,40 @@ class ActivitySessionStartView extends StatelessWidget {
borderRadius: BorderRadius.circular(20.0),
),
),
onPressed: controller.enableButtons
? controller.onTap
: null,
onPressed: () => context.go(
"/rooms/${controller.room.id}/invite",
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(controller.buttonText),
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 Stack(
children: [
SizedBox(
height: 300.0,
child: Scrollbar(
controller: scrollController,
child: SingleChildScrollView(
return SizedBox(
height: 300.0,
child: Column(
children: [
Expanded(
child: Scrollbar(
controller: scrollController,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 8),
ChoicesArray(
originalSpan: controller.pangeaMatch!.matchContent,
isLoading: controller.fetchingData,
choices: controller.pangeaMatch!.match.choices
?.map(
(e) => Choice(
text: e.value,
color: e.selected ? e.type.color : null,
isGold: e.type.name == 'bestCorrection',
),
)
.toList(),
onPressed: (value, index) =>
controller._onChoiceSelect(index),
selectedChoiceIndex: controller.selectedChoiceIndex,
id: controller.pangeaMatch!.hashCode.toString(),
langCode: MatrixState.pangeaController.languageController
.activeL2Code(),
),
const SizedBox(height: 12),
PromptAndFeedback(controller: controller),
const SizedBox(height: 60.0),
],
child: SingleChildScrollView(
controller: scrollController,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 8),
ChoicesArray(
originalSpan: controller.pangeaMatch!.matchContent,
isLoading: controller.fetchingData,
choices: controller.pangeaMatch!.match.choices
?.map(
(e) => Choice(
text: e.value,
color: e.selected ? e.type.color : null,
isGold: e.type.name == 'bestCorrection',
),
)
.toList(),
onPressed: (value, index) =>
controller._onChoiceSelect(index),
selectedChoiceIndex: controller.selectedChoiceIndex,
id: controller.pangeaMatch!.hashCode.toString(),
langCode: MatrixState.pangeaController.languageController
.activeL2Code(),
),
const SizedBox(height: 12),
PromptAndFeedback(controller: controller),
],
),
),
),
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
Container(
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
),
@ -303,8 +299,8 @@ class WordMatchContent extends StatelessWidget {
],
),
),
),
],
],
),
);
}
}

Loading…
Cancel
Save