Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix race condition when joining a school class with courses #1781

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 25 additions & 10 deletions app/lib/groups/group_join/group_join_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import 'package:bloc_provider/bloc_provider.dart';
import 'package:crash_analytics/crash_analytics.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:sharezone/main/application_bloc.dart';
import 'package:sharezone/groups/src/widgets/contact_support.dart';
import 'package:sharezone/support/support_page.dart';
Expand All @@ -21,30 +22,44 @@ import 'widgets/group_join_text_field.dart';
/// Auf dieser Seite kann der Nutzer einen Sharecode eingeben oder QrCode scannen und
/// dadurch einer Gruppe beitreten.
Future<dynamic> openGroupJoinPage(BuildContext context) {
final api = BlocProvider.of<SharezoneContext>(context).api;
return Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BlocProvider(
bloc: GroupJoinBloc(api.connectionsGateway, getCrashAnalytics()),
child: const _GroupJoinPage(),
),
builder: (context) => const _GroupJoinPage(),
settings: const RouteSettings(name: _GroupJoinPage.tag),
),
);
}

class _GroupJoinPage extends StatelessWidget {
class _GroupJoinPage extends StatefulWidget {
const _GroupJoinPage();

static const tag = "group-join-page";

@override
State<_GroupJoinPage> createState() => _GroupJoinPageState();
}

class _GroupJoinPageState extends State<_GroupJoinPage> {
late GroupJoinBloc bloc;

@override
void initState() {
super.initState();
final api = BlocProvider.of<SharezoneContext>(context).api;
final analytics = context.read<CrashAnalytics>();
bloc = GroupJoinBloc(api.connectionsGateway, analytics);
}

@override
Widget build(BuildContext context) {
return const Scaffold(
appBar: GroupJoinAppBar(),
body: SafeArea(child: SingleChildScrollView(child: GroupJoinHelp())),
bottomNavigationBar: ContactSupport(),
return BlocProvider(
bloc: bloc,
child: const Scaffold(
appBar: GroupJoinAppBar(),
body: SafeArea(child: SingleChildScrollView(child: GroupJoinHelp())),
bottomNavigationBar: ContactSupport(),
),
);
}
}
Expand Down
Loading