From f933cb871a0fc5610df0122a4b50ba4c89349ac1 Mon Sep 17 00:00:00 2001 From: Minas Giannekas Date: Fri, 13 May 2022 23:57:14 +0300 Subject: [PATCH 1/5] fix: don't show app window toolbar when in full screen --- example/macos/Runner/MainFlutterWindow.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/example/macos/Runner/MainFlutterWindow.swift b/example/macos/Runner/MainFlutterWindow.swift index 321151fc..1c6ce4e9 100644 --- a/example/macos/Runner/MainFlutterWindow.swift +++ b/example/macos/Runner/MainFlutterWindow.swift @@ -34,8 +34,9 @@ class BlurryContainerViewController: NSViewController { } } -class MainFlutterWindow: NSWindow { +class MainFlutterWindow: NSWindow, NSWindowDelegate { override func awakeFromNib() { + delegate = self let blurryContainerViewController = BlurryContainerViewController() let windowFrame = self.frame self.contentViewController = blurryContainerViewController @@ -64,8 +65,17 @@ class MainFlutterWindow: NSWindow { super.awakeFromNib() } + // Hides the toolbar when in fullscreen mode func window(_ window: NSWindow, willUseFullScreenPresentationOptions proposedOptions: NSApplication.PresentationOptions = []) -> NSApplication.PresentationOptions { - // Hides the toolbar when in fullscreen mode + return [.autoHideToolbar, .autoHideMenuBar, .fullScreen] } + + func windowWillEnterFullScreen(_ notification: Notification) { + self.toolbar?.isVisible = false + } + + func windowDidExitFullScreen(_ notification: Notification) { + self.toolbar?.isVisible = true + } } \ No newline at end of file From e315cce7f1034d3b86b106babcea6fc3aedf8a31 Mon Sep 17 00:00:00 2001 From: Minas Giannekas Date: Fri, 13 May 2022 23:59:39 +0300 Subject: [PATCH 2/5] chore: update README --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7e08784d..564ab085 100644 --- a/README.md +++ b/README.md @@ -187,8 +187,9 @@ class BlurryContainerViewController: NSViewController { } } -class MainFlutterWindow: NSWindow { +class MainFlutterWindow: NSWindow, NSWindowDelegate { override func awakeFromNib() { + delegate = self let blurryContainerViewController = BlurryContainerViewController() let windowFrame = self.frame self.contentViewController = blurryContainerViewController @@ -218,9 +219,16 @@ class MainFlutterWindow: NSWindow { } func window(_ window: NSWindow, willUseFullScreenPresentationOptions proposedOptions: NSApplication.PresentationOptions = []) -> NSApplication.PresentationOptions { - // Hides the toolbar when in fullscreen mode return [.autoHideToolbar, .autoHideMenuBar, .fullScreen] } + + func windowWillEnterFullScreen(_ notification: Notification) { + self.toolbar?.isVisible = false + } + + func windowDidExitFullScreen(_ notification: Notification) { + self.toolbar?.isVisible = true + } } ``` From 4ad22c2bbd15dca3da600ce7712eafccb97056a5 Mon Sep 17 00:00:00 2001 From: Minas Giannekas Date: Sat, 14 May 2022 00:01:21 +0300 Subject: [PATCH 3/5] chore: update brick app window code --- .../__brick__/macos/Runner/MainFlutterWindow.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/starter_app/bricks/macosui_starter/__brick__/macos/Runner/MainFlutterWindow.swift b/starter_app/bricks/macosui_starter/__brick__/macos/Runner/MainFlutterWindow.swift index cfbfad74..dba01102 100644 --- a/starter_app/bricks/macosui_starter/__brick__/macos/Runner/MainFlutterWindow.swift +++ b/starter_app/bricks/macosui_starter/__brick__/macos/Runner/MainFlutterWindow.swift @@ -34,8 +34,9 @@ class BlurryContainerViewController: NSViewController { } } -class MainFlutterWindow: NSWindow { +class MainFlutterWindow: NSWindow, NSWindowDelegate { override func awakeFromNib() { + delegate = self let blurryContainerViewController = BlurryContainerViewController() let windowFrame = self.frame self.contentViewController = blurryContainerViewController @@ -69,6 +70,14 @@ class MainFlutterWindow: NSWindow { // Hides the toolbar when in fullscreen mode return [.autoHideToolbar, .autoHideMenuBar, .fullScreen] } + + func windowWillEnterFullScreen(_ notification: Notification) { + self.toolbar?.isVisible = false + } + + func windowDidExitFullScreen(_ notification: Notification) { + self.toolbar?.isVisible = true + } } {{/use_translucency}}{{^use_translucency}} class MainFlutterWindow: NSWindow { From 7cef41a09f4f999abfb99619042d6e64516ae050 Mon Sep 17 00:00:00 2001 From: Minas Giannekas Date: Sat, 14 May 2022 00:03:16 +0300 Subject: [PATCH 4/5] chore: update pubspec and changelog --- CHANGELOG.md | 3 +++ example/pubspec.lock | 2 +- pubspec.yaml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d00d87b6..46494cd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [1.4.1] +* Fixes an issue where if the app was displayed in full screen mode, an opaque empty toolbar would appear at the top [#249](https://github.com/GroovinChip/macos_ui/issues/249) + ## [1.4.0] * Migration to Flutter 3.0 * Minimum dart sdk version is now 2.17.0 diff --git a/example/pubspec.lock b/example/pubspec.lock index dab11833..f9562d4a 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -87,7 +87,7 @@ packages: path: ".." relative: true source: path - version: "1.4.0" + version: "1.4.1" matcher: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 7bde3238..bc42f9fc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: macos_ui description: Flutter widgets and themes implementing the current macOS design language. -version: 1.4.0 +version: 1.4.1 homepage: "https://github.com/GroovinChip/macos_ui" environment: From 01530e42b88922eb915ea6f268a99dcf7eba083b Mon Sep 17 00:00:00 2001 From: Reuben Turner Date: Sun, 15 May 2022 23:34:07 -0400 Subject: [PATCH 5/5] chore: update actions --- .github/workflows/dart_code_metrics.yaml | 20 ++++++++++ .github/workflows/pana_analysis.yml | 51 ++++++++---------------- 2 files changed, 37 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/dart_code_metrics.yaml diff --git a/.github/workflows/dart_code_metrics.yaml b/.github/workflows/dart_code_metrics.yaml new file mode 100644 index 00000000..b01bb1a1 --- /dev/null +++ b/.github/workflows/dart_code_metrics.yaml @@ -0,0 +1,20 @@ +name: Dart Code Metrics +on: [pull_request, workflow_dispatch] + +jobs: + dart-code-metrics: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Install Flutter + uses: subosito/flutter-action@master + with: + channel: stable + + - name: Check directory + run: ls + - name: Install Code Metrics + run: flutter pub global activate dart_code_metrics + - name: Run Code Metrics + run: flutter pub global run dart_code_metrics:metrics --reporter=github lib \ No newline at end of file diff --git a/.github/workflows/pana_analysis.yml b/.github/workflows/pana_analysis.yml index 002b902b..b430f9a6 100644 --- a/.github/workflows/pana_analysis.yml +++ b/.github/workflows/pana_analysis.yml @@ -2,8 +2,8 @@ name: Pana Analysis on: [pull_request, workflow_dispatch] jobs: - package-analysis: - runs-on: ubuntu-latest + pana-analysis: + runs-on: macos-latest steps: - uses: actions/checkout@v2 @@ -12,40 +12,23 @@ jobs: with: channel: stable - #- name: Install dependencies - # run: flutter pub get + - name: Analyze package with Pana + run: | + flutter pub global activate pana 0.21.5 - - name: Check directory - run: ls - - name: Install Code Metrics - run: flutter pub global activate dart_code_metrics - - name: Run Code Metrics - run: flutter pub global run dart_code_metrics:metrics --reporter=github lib + REQUIRED_RATIO=1.0 + TEMP_FILE=/tmp/pana_results.txt - - uses: axel-op/dart-package-analyzer@v3 - # set an id for the current step - id: analysis - with: - githubToken: ${{ secrets.GITHUB_TOKEN }} + # Run pana, piping the output to both stderr and into a grep to find the result in the last line. + pana --no-warning | tee /dev/stderr | tail -1 | grep -o -E '[0-9]+' > $TEMP_FILE - # You can then use this id to retrieve the outputs in the next steps. - # The following step shows how to exit the workflow with an error if the total score in percentage is below 50: - - name: Check scores - env: - # NB: "analysis" is the id set above. Replace it with the one you used if different. - TOTAL: ${{ steps.analysis.outputs.total }} - TOTAL_MAX: ${{ steps.analysis.outputs.total_max }} - run: | - PERCENTAGE=$(( $TOTAL * 100 / $TOTAL_MAX )) - if (( $PERCENTAGE < 80 )) - then - echo Score too low! + # Extract score and calculate ratio. + SCORE=$(cat $TEMP_FILE | head -1) + TOTAL=$(cat $TEMP_FILE | tail -1) + RATIO=$(echo "scale=2; $SCORE / $TOTAL" | bc -l) + MEETS_REQUIRED_RATIO=$(echo "$RATIO >= $REQUIRED_RATIO" | bc -l) + + if [[ "$MEETS_REQUIRED_RATIO" != "1" ]]; then + echo "Score of $SCORE out of $TOTAL is a ratio of $RATIO, which is not sufficient to meet the required ratio of $REQUIRED_RATIO" exit 1 fi - - # This step is useful for PR's coming from forks. It takes the raw JSON and formats a report from it. - - name: Format scores json - env: - JSON_OUTPUT: ${{ steps.analysis.outputs.json_output }} - run: | - TOTAL_SCORE=$(jq -r '.scores.grantedPoints' <<< "$JSON_OUTPUT")