Skip to content

Commit

Permalink
Version 1.4.1 (#255)
Browse files Browse the repository at this point in the history
* Sidebar top (#244)

* chore: refactor dir structure

* feat: Sidebar top & updated default control color

* feat(example): search results in top

* chore: bump version, changelog

* chore: run flutter pub upgrade

* Update CHANGELOG.md

* Update lib/src/layout/sidebar/sidebar.dart

Co-authored-by: Minas Giannekas <[email protected]>

* chore: update issue templates

* chore: update pr_prelaunch script

* Flutter 3 upgrade & MacosColor update (#248)

* chore: Update pubspec.yaml files to support Flutter 3

* chore: run dart fix --apply

* chore: migrate Scrollbar to Flutter 3

* chore: update flutter_lints & subsequent fixes

* feat: add missing functions to MacosColor

the Color class has a number of functions that MacosColor had not implemented

* chore: use super parameters

* chore: update changelog

* chore: tweak example app

Uses the new PlatformMenuBar. Also update product name.

* chore: small changelog tweak

* chore: run flutter format .

* chore: run dart fix --apply

* chore: run flutter format .

* chore: remove unused code in example

* chore: remove unused import

* chore: remove unused code

* Starter app (#251)

* chore: Update pubspec.yaml files to support Flutter 3

* chore: run dart fix --apply

* chore: migrate Scrollbar to Flutter 3

* chore: update flutter_lints & subsequent fixes

* feat: add missing functions to MacosColor

the Color class has a number of functions that MacosColor had not implemented

* chore: use super parameters

* chore: update changelog

* chore: tweak example app

Uses the new PlatformMenuBar. Also update product name.

* chore: small changelog tweak

* chore: run flutter format .

* chore: run dart fix --apply

* chore: run flutter format .

* chore: remove unused code in example

* chore: remove unused import

* feat: first pass at starter app brick

* chore: improve starter app brick

* chore: fix widget test in starter app

* feat: conditional prompts & running pub get

* chore: finalize brick

* chore: run flutter format

* chore: exclude starter app from analyzer

* Full screen opaque toolbar issue (closes #249) (#252)

* fix: don't show app window toolbar when in full screen

* chore: update README

* chore: update brick app window code

* chore: update pubspec and changelog

* chore: update actions

Co-authored-by: Reuben Turner <[email protected]>

Co-authored-by: Minas Giannekas <[email protected]>
  • Loading branch information
GroovinChip and whiplashoo authored May 16, 2022
1 parent 71ed99b commit 9c9cb60
Show file tree
Hide file tree
Showing 53 changed files with 2,285 additions and 40 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/dart_code_metrics.yaml
Original file line number Diff line number Diff line change
@@ -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
51 changes: 17 additions & 34 deletions .github/workflows/pana_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}

```
Expand Down
2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ linter:
analyzer:
plugins:
- dart_code_metrics
exclude:
- starter_app/**

dart_code_metrics:
metrics:
Expand Down
14 changes: 12 additions & 2 deletions example/macos/Runner/MainFlutterWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.4.0"
version: "1.4.1"
matcher:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
6 changes: 6 additions & 0 deletions starter_app/bricks/macosui_starter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# 1.0.0

* Initial release 🎉
* Generate a new Flutter application that uses `macos_ui`
* Optionally use window translucency
* Optionally hide the native titlebar
21 changes: 21 additions & 0 deletions starter_app/bricks/macosui_starter/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) [2021] [Reuben Turner]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
42 changes: 42 additions & 0 deletions starter_app/bricks/macosui_starter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# macosui_starter

![Powered by Mason](https://img.shields.io/endpoint?url=https%3A%2F%2Ftinyurl.com%2Fmason-badge)

A starter Flutter application for macOS that uses [`macos_ui`](https://pub.dev/packages/macos_ui).

<img src='https://imgur.com/rG4uDKs.png' />

## 🚧 Prerequisites
* Your Flutter version should be at least 3.0
* You should have `mason_cli` installed

## Usage 🚀
```sh
mason make macosui_starter
```

You'll be prompted for the following information:
* The name of your app
* Your app's description
* The name of your organization
* Whether to use window transclucency
* Whether to show or hide the native titlebar

⚠️ **Please note**: if you opt to use window transclucency you will not be asked if you want to show or hide the native
titlebar, as it will be hidden by default.

## Variables ✨

| Variable | Description | Default | Type |
|-------------------|-------------------------------------|---------------------------------------------------------|-----------|
| `app_name` | The name of your app | `macosui_starter` | `string` |
| `app_description` | The description of your application | `A starter Flutter application for macOS with macos_ui` | `string` |
| `org_name` | The name of your organization | `com.example` | `string` |
| `use_translucency`| Whether to use window transclucency | `false` | `boolean` |

## Output 📦

A Flutter application that:
* Targets macOS (support for other platforms can be added manually)
* Has `macos_ui` pre-installed
* Builds basic UI based on the latest version of `macos_ui`
47 changes: 47 additions & 0 deletions starter_app/bricks/macosui_starter/__brick__/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
30 changes: 30 additions & 0 deletions starter_app/bricks/macosui_starter/__brick__/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.

version:
revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
channel: stable

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
- platform: macos
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
17 changes: 17 additions & 0 deletions starter_app/bricks/macosui_starter/__brick__/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# {{ app_name }}

A starter Flutter app for macOS with `macos_ui`.

## Getting Started

This project is a starting point for a Flutter application specifically targeting macOS and uses the `macos_ui` plugin
to achieve UI and UX that match their native AppKit counterparts as closely as possible.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)

For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
30 changes: 30 additions & 0 deletions starter_app/bricks/macosui_starter/__brick__/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
- use_super_parameters

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
Loading

0 comments on commit 9c9cb60

Please sign in to comment.