From 0975b8e7e80f540ca5cb8b1973d51caacb3ef6ab Mon Sep 17 00:00:00 2001 From: Alessandro Liparoti Date: Sun, 5 Nov 2023 13:16:41 +0100 Subject: [PATCH] fix onboarding flow --- lib/screens/CreateMatch.dart | 37 ++++++++++++++++++------------- lib/screens/Launch.dart | 4 ++-- lib/screens/Login.dart | 2 +- lib/screens/MatchDetails.dart | 1 + lib/screens/PlayerOfTheMatch.dart | 2 +- lib/screens/UserPage.dart | 2 +- 6 files changed, 27 insertions(+), 21 deletions(-) diff --git a/lib/screens/CreateMatch.dart b/lib/screens/CreateMatch.dart index b62e971..936d867 100644 --- a/lib/screens/CreateMatch.dart +++ b/lib/screens/CreateMatch.dart @@ -846,26 +846,31 @@ class CreateMatchState extends State { bool? v = _formKey.currentState?.validate(); if (v != null && v) { try { - var dateTime = tz.TZDateTime( - tz.getLocation(sportCenter!.timezoneId), - start!.year, - start!.month, - start!.day, - startTime!.hour, - startTime!.minute); - var endDateTime = tz.TZDateTime( - tz.getLocation(sportCenter!.timezoneId), - start!.year, - start!.month, - start!.day, - endTime!.hour, - endTime!.minute); var forWeeks = repeatsForWeeks; Iterable> idsFuture = Iterable.generate(forWeeks).map((w) async { + var dToAdd = Duration(days: 7 * w); + + var startDateTime = tz.TZDateTime( + tz.getLocation(sportCenter!.timezoneId), + start!.year, + start!.month, + start!.day, + startTime!.hour, + startTime!.minute) + .add(dToAdd); + var endDateTime = tz.TZDateTime( + tz.getLocation(sportCenter!.timezoneId), + start!.year, + start!.month, + start!.day, + endTime!.hour, + endTime!.minute) + .add(dToAdd); + var match = Match( - dateTime, + startDateTime, (isSavedSportCenter) ? sportCenter!.placeId : null, @@ -880,7 +885,7 @@ class CreateMatchState extends State { .toInt(), organiserWithFee ? 50 : 0) : null, - endDateTime.difference(dateTime), + endDateTime.difference(startDateTime), isTest, numberOfPeopleRangeValues.start.toInt(), widget.existingMatch != null diff --git a/lib/screens/Launch.dart b/lib/screens/Launch.dart index 47dbc57..ca38418 100644 --- a/lib/screens/Launch.dart +++ b/lib/screens/Launch.dart @@ -250,10 +250,10 @@ class LaunchWidgetState extends State { color: Palette.primary, ), child: - Stack(children: [getBackgoundImages(context), mainWidgets]))); + Stack(children: [getBackgroundImages(context), mainWidgets]))); } - static Widget getBackgoundImages(BuildContext context) => Row(children: [ + static Widget getBackgroundImages(BuildContext context) => Row(children: [ Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/screens/Login.dart b/lib/screens/Login.dart index 2bb890a..3ee52b6 100644 --- a/lib/screens/Login.dart +++ b/lib/screens/Login.dart @@ -45,7 +45,7 @@ class Login extends StatelessWidget { Container( constraints: BoxConstraints.expand(), decoration: new BoxDecoration(color: Palette.primary)), - LaunchWidgetState.getBackgoundImages(context), + LaunchWidgetState.getBackgroundImages(context), LoginArea(from: from) ]) ), diff --git a/lib/screens/MatchDetails.dart b/lib/screens/MatchDetails.dart index 972467f..957f055 100644 --- a/lib/screens/MatchDetails.dart +++ b/lib/screens/MatchDetails.dart @@ -195,6 +195,7 @@ class MatchDetailsState extends State { var widgets; if (skeletons == null) { var completeOrganiserWidget = organizerView && + match.price != null && userState.getLoggedUserDetails()?.areChargesEnabled(isTest) != null && !userState.getLoggedUserDetails()!.areChargesEnabled(isTest) diff --git a/lib/screens/PlayerOfTheMatch.dart b/lib/screens/PlayerOfTheMatch.dart index f32a503..54c4680 100644 --- a/lib/screens/PlayerOfTheMatch.dart +++ b/lib/screens/PlayerOfTheMatch.dart @@ -40,7 +40,7 @@ class PlayerOfTheMatch extends StatelessWidget { Container( constraints: BoxConstraints.expand(), decoration: new BoxDecoration(color: Palette.primary)), - LaunchWidgetState.getBackgoundImages(context), + LaunchWidgetState.getBackgroundImages(context), MainArea(userId: userId ?? context.read().currentUserId!) ]), ); diff --git a/lib/screens/UserPage.dart b/lib/screens/UserPage.dart index e6157d1..9becb1e 100644 --- a/lib/screens/UserPage.dart +++ b/lib/screens/UserPage.dart @@ -348,7 +348,7 @@ class UserPageState extends State { widgets.addAll([ Row(children: [ Expanded( - child: CompleteOrganiserAccountWidget(isTest: true)) + child: CompleteOrganiserAccountWidget(isTest: isTest)) ]), verticalSpace ]);