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

Use only one library .dart file in sharezone_widgets package. #538 #543

Merged
merged 11 commits into from
Apr 2, 2023

Conversation

Marc-R2
Copy link
Contributor

@Marc-R2 Marc-R2 commented Mar 31, 2023

Description

All files in lib/sharezone_widgets/lib/[...].dart that contained only exports were merged into one sharezone_widgets/lib/sharezone_widgets.dart and the individual export files were removed.

Note:
There were two duplicate widgets PlaceholderModel && PlaceholderWidgetWithAnimation implemented in both app/lib/homework/shared/placeholder_templates.dart and lib/sharezone_widgets/lib/src/placeholder.dart.
This caused an import conflict as both were imported due to the bundling. Since the widgets were (almost) identical, I merged them into lib/sharezone_widgets/lib/src/placeholder.dart and removed them from app/lib/homework/shared/placeholder_templates.dart (and the associated private widgets were also moved).

Related Tickets

Closes #538

@docs-page
Copy link

docs-page bot commented Mar 31, 2023

To view this pull requests documentation preview, visit the following URL:

docs.page/sharezoneapp/sharezone-app~543

Documentation is deployed and generated using docs.page.

@CLAassistant
Copy link

CLAassistant commented Mar 31, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added feature: attachments Attachments are files that can be added to homeworks or information sheets. feature: authentification Logging in/out (anonymous, sign-in with X, etc.) and registration. feature: comments Comment on contents (homeworks, info sheets) to e.g. ask for clarifications on a task. feature: donation Donating money to us via Sharezone. feature: feedback Users can send us feedback to improve the app. feature: file-sharing Files can be shared inside Sharezone e.g. by uploading them in a file-sharing folder of a course. feature: group permissions Group admins can set what permissions different course members can do (e.g. only read content). feature: groups:courses Specific to only courses (instead of e.g. classes) feature: groups:classes Specific to only classes (instead of e.g. courses) feature: groups Groups umbrella term for courses and classes. feature: homework feature: homework-submissions Submissions can be toggled for homeworks so that pupils can upload their solutions for the teacher. feature: information sheet Information sheets are posted to courses as a way to announce information. feature: navigation Navigation inside the app (e.g. switching to a different screen). feature: notifications Push-Notifications and In-App-Notifications. feature: onboarding The steps (setting username, courses, etc.) after creating a new account. feature: report Users can report content inside Sharezone (e.g. if an info sheet contains hate speech). feature: timetable / calendar Includes anything regarding lessons (timetable) and events (calendar). feature: universal file features File features (downloading, preview, etc.) that are used by multiple Sharezone features. platform: web testing ui / ux labels Mar 31, 2023
@Marc-R2 Marc-R2 changed the title Use only one library .dart file in sharezone_widgets package. #538 Use only one library .dart file in sharezone_widgets package. #538 Mar 31, 2023
Copy link
Collaborator

@Jonas-Sander Jonas-Sander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey thanks for your PR! :)

Looks good so far, although there are some things that still need to be changed:

  • Your auto-formatting seemed to have mode some changes to Strings inside our code (see the example I commented on below). For this PR I would like to not make these kind of changes. If possible please revert these changes.
  • Under [...]/sharezone_widgets/lib there are still the files animated_visibility.dart, expanded_chip.dart, sharezone_widgets.dart, wrapper.dart. These can be moved to sharezone_widgets/lib/src and also be exported inside sharezone_widgets/lib/sharezone_widgets.dart.
  • I get the error that The imported package 'flare_flutter' isn't a dependency of the importing package. Try adding a dependency for 'flare_flutter' in the 'pubspec.yaml' file.
    I don't know why this wasn't an error before, but it needs to be fixed anyways. So this means that flare_flutter: ^3.0.2 needs to be added to the sharezone_widgets/pubspec.yaml (this is the same version that is in the app/pubspec.yaml)
  • There are several lints that are shown in my IDE. These need to be fixed, otherwise our pipeline will fail.

Analyzer lints:

sharezone_widgets (lib/sharezone_widgets):
  error - Target of URI doesn't exist: 'package:flare_flutter/flare_actor.dart' at lib\src\placeholder.dart:9:8 - (uri_does_not_exist)
  error - The method 'FlareActor' isn't defined for the type '_Rive' at lib\src\placeholder.dart:219:14 - (undefined_method)
  info - The import of '../../dialog_wrapper.dart' is unnecessary because all of the used elements are also provided by the import of 'package:sharezone_widgets/sharezone_widgets.dart' at lib\src\adaptive_dialog\left_and_right_action_dialog\left_and_right_action_adaptive_dialog.dart:15:8 - (unnecessary_import)
  info - The import of '../adaptive_dialog_action.dart' is unnecessary because all of the used elements are also provided by the import of 'package:sharezone_widgets/sharezone_widgets.dart' at lib\src\adaptive_dialog\left_and_right_action_dialog\left_and_right_action_adaptive_dialog.dart:16:8 - (unnecessary_import)
  info - The import of 'long_press.dart' is unnecessary because all of the used elements are also provided by the import of 'package:sharezone_widgets/sharezone_widgets.dart' at lib\src\adaptive_dialog\long_press_dialog\long_press_adaptive_dialog.dart:15:8 - (unnecessary_import)
  info - The imported package 'flare_flutter' isn't a dependency of the importing package at lib\src\placeholder.dart:9:8 - (depend_on_referenced_packages)
  info - Constructors for public widgets should have a named 'key' parameter at lib\src\placeholder.dart:18:9 - (use_key_in_widget_constructors)
  info - Use 'const' with the constructor to improve performance at lib\src\placeholder.dart:88:26 - (prefer_const_constructors)
  info - The import of 'package:sharezone_widgets/src/state_sheet/state_dialog_content.dart' is unnecessary because all of the used elements are also provided by the import of 'package:sharezone_widgets/sharezone_widgets.dart' at lib\src\state_sheet\dialog.dart:11:8 - (unnecessary_import)
  info - The import of '../dialog_wrapper.dart' is unnecessary because all of the used elements are also provided by the import of 'package:sharezone_widgets/sharezone_widgets.dart' at lib\src\state_sheet\dialog.dart:14:8 - (unnecessary_import)
  info - The import of 'state_sheet_content.dart' is unnecessary because all of the used elements are also provided by the import of 'package:sharezone_widgets/sharezone_widgets.dart' at lib\src\state_sheet\sheet.dart:12:8 - (unnecessary_import)
  
sharezone_app (app):
  info - Sort directive sections alphabetically at lib\blackboard\details\blackboard_details.dart:28:1 - (directives_ordering)
  info - Unused import: 'package:sharezone/homework/shared/placeholder_templates.dart' at lib\pages\homework\homework_details\submissions\homework_create_submission_page.dart:17:8 - (unused_import)

Comment on lines 51 to 57
content: Text(
'Möchtest du den Kurs "$courseName" wirklich endgültig löschen?\n\nEs werden alle Stunden & Termine aus dem Stundenplan, Hausaufgaben und Einträge aus dem Schwarzen Brett und gelöscht.\n\nAuf den Kurs kann von niemanden mehr zugegriffen werden!'));
context: context,
right: AdaptiveDialogAction.delete,
defaultValue: false,
title: "Kurs löschen?",
content: Text(
'Möchtest du den Kurs "$courseName" wirklich endgültig löschen?\n\n'
'Es werden alle Stunden & Termine aus dem Stundenplan, Hausaufgaben '
'und Einträge aus dem Schwarzen Brett und gelöscht.\n\n'
'Auf den Kurs kann von niemanden mehr zugegriffen werden!',
),
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this was done by some auto-formatting on your end? This change was made in several places in this PR.

I mean it's not a bad change per se but as we don't use that kind of String formatting currently I would be more comfortable if you could revert these kind of changes in this PR.

@Jonas-Sander
Copy link
Collaborator

Jonas-Sander commented Mar 31, 2023

Some actions (should be android-integration-test, ios-integration-test, macos-build-test, web-preview) currently will always fail for external PRs, so don't be confused (#348)

@Marc-R2
Copy link
Contributor Author

Marc-R2 commented Mar 31, 2023

Thanks for the feedback.

I moved the remaining files to src/ and added them to the bundle accordingly, and worked on the lints.

I also tried fixing the flare dependency. I suspect this was related to the duplicate widgets mentioned above and the corresponding pubspec.lock (please check - otherwise I'll have to think about it again).

I am still working on reverting the strings. This may well be a result of my formatter, as I find strings more readable that way, and the autoformat key is quickly pressed - I apologise

@github-actions github-actions bot added dependencies Changing, updating, adding or removing one or more dependencies. legal Regarding Licenses, Policy updates, Warnings to users (that might cause trouble if not there) etc. labels Mar 31, 2023
Copy link
Collaborator

@Jonas-Sander Jonas-Sander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only two more minor changes needed, otherwise it LGTM! :)

.gitignore Outdated
Comment on lines 10 to 20
# IDE

## VS Code
.vscode/*
!.vscode/launch.json
!.vscode/settings.json

## Android Studio / IntelliJ
.idea/

# FVM will create a relative symlink in your project from .fvm/flutter_sdk to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert since it has nothing todo with the goal of this PR.

app/pubspec.yaml Outdated
@@ -74,7 +74,6 @@ dependencies:
firebase_messaging: ^14.2.5
firebase_performance: ^0.9.0+14
firebase_storage: ^11.0.14
flare_flutter: ^3.0.2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't remove it here. We need it both in app/pubspec.yaml and lib/sharezone_widgets/pubspec.yaml.

Marc-R2 added 3 commits April 1, 2023 15:54
# Conflicts:
#	app/lib/donate/page/donate_page.dart
#	app/lib/navigation/models/navigation_item.dart
Copy link
Collaborator

@Jonas-Sander Jonas-Sander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 💙🎉

@Jonas-Sander
Copy link
Collaborator

@nilsreichardt How should we go about merging this? Just force-merge? Might the merge queue cause problems?

Copy link
Member

@nilsreichardt nilsreichardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -54,7 +54,10 @@ class _Title extends StatelessWidget {
Widget build(BuildContext context) {
return Text(
name,
style: const TextStyle(color: Colors.white, fontFamily: rubik),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note for future PRs: Would be great to only have changes in a PR that fit the purpose of the PR. This purpose of the PR is to refactor the imports of the sharezone_widgets package and should not contain any formatting changes like this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean I guess thats the same kind of auto-formatting that would happen if we save the file again to edit the imports ourselves, no? So I don't know if thats the case I don't have a problem with it really 🤷‍♂️
Or is it different formatting from ours?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, in this case a comma has been added manually after fontFamily: rubit and then it was formatted

@nilsreichardt
Copy link
Member

@nilsreichardt How should we go about merging this? Just force-merge? Might the merge queue cause problems?

Yes, just force merging. Force merging also skips the merge queue.

@Jonas-Sander
Copy link
Collaborator

Alright, thanks again @Marc-R2 :)

@Jonas-Sander Jonas-Sander merged commit 4c8e57f into SharezoneApp:main Apr 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Changing, updating, adding or removing one or more dependencies. feature: attachments Attachments are files that can be added to homeworks or information sheets. feature: authentification Logging in/out (anonymous, sign-in with X, etc.) and registration. feature: comments Comment on contents (homeworks, info sheets) to e.g. ask for clarifications on a task. feature: donation Donating money to us via Sharezone. feature: feedback Users can send us feedback to improve the app. feature: file-sharing Files can be shared inside Sharezone e.g. by uploading them in a file-sharing folder of a course. feature: group permissions Group admins can set what permissions different course members can do (e.g. only read content). feature: groups:classes Specific to only classes (instead of e.g. courses) feature: groups:courses Specific to only courses (instead of e.g. classes) feature: groups Groups umbrella term for courses and classes. feature: homework feature: homework-submissions Submissions can be toggled for homeworks so that pupils can upload their solutions for the teacher. feature: information sheet Information sheets are posted to courses as a way to announce information. feature: navigation Navigation inside the app (e.g. switching to a different screen). feature: notifications Push-Notifications and In-App-Notifications. feature: onboarding The steps (setting username, courses, etc.) after creating a new account. feature: report Users can report content inside Sharezone (e.g. if an info sheet contains hate speech). feature: timetable / calendar Includes anything regarding lessons (timetable) and events (calendar). feature: universal file features File features (downloading, preview, etc.) that are used by multiple Sharezone features. legal Regarding Licenses, Policy updates, Warnings to users (that might cause trouble if not there) etc. platform: web testing ui / ux user: pupil / student user: teacher
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use only one library .dart file in sharezone_widgets package.
4 participants