|
|
|
|
@ -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),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|