Skip to content

Commit 75707a4

Browse files
GroovinChipwhiplashoojonsaw
authored
latest from dev (#269)
* 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 <whiplashoo@users.noreply.github.com> * 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 <groovinchip@gmail.com> * Version 1.4.1 (#255) * 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 <whiplashoo@users.noreply.github.com> * 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 <groovinchip@gmail.com> Co-authored-by: Minas Giannekas <whiplashoo@users.noreply.github.com> * chore: repository, homepage fields * chore: update readme * feat(starter_app): Version 1.1.0 * feat(starter_app): multi-window support * feat: starter_app 1.2.1 * chore: move brick to its own repo & go back to old pana action * Expand remaining part of row in MacosListTile (#265) * Expand remaining part of row #264 * Increment to version 1.4.2 * End sidebar (#267) * chore: add missing trailing comma * chore: improve MacosIconButton animation curve * chore: remove false_secrets from pubspec.yaml * feat: end sidebar Also fixes the tests portion of the pr_prelaunch_tasks script * feat: add "isEndSidebarShown" to MacosWindowScope Co-authored-by: Minas Giannekas <whiplashoo@users.noreply.github.com> Co-authored-by: Jon Saw <jon.saw@gmail.com>
1 parent aae8268 commit 75707a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+308
-2286
lines changed

.github/workflows/pana_analysis.yml

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,35 @@ name: Pana Analysis
22
on: [pull_request, workflow_dispatch]
33

44
jobs:
5-
pana-analysis:
6-
runs-on: macos-latest
5+
package-analysis:
6+
runs-on: ubuntu-latest
77

88
steps:
99
- uses: actions/checkout@v2
10-
- name: Install Flutter
11-
uses: subosito/flutter-action@master
10+
11+
- uses: axel-op/dart-package-analyzer@v3
12+
# set an id for the current step
13+
id: analysis
1214
with:
13-
channel: stable
15+
githubToken: ${{ secrets.GITHUB_TOKEN }}
1416

15-
- name: Analyze package with Pana
17+
# You can then use this id to retrieve the outputs in the next steps.
18+
# The following step shows how to exit the workflow with an error if the total score in percentage is below 50:
19+
- name: Check scores
20+
env:
21+
# NB: "analysis" is the id set above. Replace it with the one you used if different.
22+
TOTAL: ${{ steps.analysis.outputs.total }}
23+
TOTAL_MAX: ${{ steps.analysis.outputs.total_max }}
1624
run: |
17-
flutter pub global activate pana 0.21.5
18-
19-
REQUIRED_RATIO=1.0
20-
TEMP_FILE=/tmp/pana_results.txt
21-
22-
# Run pana, piping the output to both stderr and into a grep to find the result in the last line.
23-
pana --no-warning | tee /dev/stderr | tail -1 | grep -o -E '[0-9]+' > $TEMP_FILE
24-
25-
# Extract score and calculate ratio.
26-
SCORE=$(cat $TEMP_FILE | head -1)
27-
TOTAL=$(cat $TEMP_FILE | tail -1)
28-
RATIO=$(echo "scale=2; $SCORE / $TOTAL" | bc -l)
29-
MEETS_REQUIRED_RATIO=$(echo "$RATIO >= $REQUIRED_RATIO" | bc -l)
30-
31-
if [[ "$MEETS_REQUIRED_RATIO" != "1" ]]; then
32-
echo "Score of $SCORE out of $TOTAL is a ratio of $RATIO, which is not sufficient to meet the required ratio of $REQUIRED_RATIO"
25+
PERCENTAGE=$(( $TOTAL * 100 / $TOTAL_MAX ))
26+
if (( $PERCENTAGE < 80 ))
27+
then
28+
echo Score too low!
3329
exit 1
3430
fi
31+
# This step is useful for PR's coming from forks. It takes the raw JSON and formats a report from it.
32+
- name: Format scores json
33+
env:
34+
JSON_OUTPUT: ${{ steps.analysis.outputs.json_output }}
35+
run: |
36+
TOTAL_SCORE=$(jq -r '.scores.grantedPoints' <<< "$JSON_OUTPUT")

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [1.5.0]
2+
* Adds `endSidebar` to `MacosWindow`
3+
4+
## [1.4.2]
5+
* Fixes RenderFlex overflowed in `MacosListTile` [#264](https://github.com/GroovinChip/macos_ui/issues/264)
6+
17
## [1.4.1+1]
28
* Update `pubspec.yaml` with `repository` and new `homepage` field.
39

example/lib/main.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,17 @@ class _WidgetGalleryState extends State<WidgetGallery> {
221221
subtitle: Text('tim@apple.com'),
222222
),
223223
),
224+
endSidebar: Sidebar(
225+
startWidth: 200,
226+
minWidth: 200,
227+
maxWidth: 300,
228+
shownByDefault: false,
229+
builder: (context, scrollController) {
230+
return const Center(
231+
child: Text('End Sidebar'),
232+
);
233+
},
234+
),
224235
child: IndexedStack(
225236
index: pageIndex,
226237
children: pages,

example/lib/pages/buttons_page.dart

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,35 @@ class _ButtonsPageState extends State<ButtonsPage> {
2323
toolBar: ToolBar(
2424
title: const Text('Buttons'),
2525
titleWidth: 150.0,
26+
leading: MacosTooltip(
27+
message: 'Toggle Sidebar',
28+
useMousePosition: false,
29+
child: MacosIconButton(
30+
icon: MacosIcon(
31+
CupertinoIcons.sidebar_left,
32+
color: MacosTheme.brightnessOf(context).resolve(
33+
const Color.fromRGBO(0, 0, 0, 0.5),
34+
const Color.fromRGBO(255, 255, 255, 0.5),
35+
),
36+
size: 20.0,
37+
),
38+
boxConstraints: const BoxConstraints(
39+
minHeight: 20,
40+
minWidth: 20,
41+
maxWidth: 48,
42+
maxHeight: 38,
43+
),
44+
onPressed: () => MacosWindowScope.of(context).toggleSidebar(),
45+
),
46+
),
2647
actions: [
2748
ToolBarIconButton(
28-
label: 'Toggle Sidebar',
49+
label: 'Toggle End Sidebar',
50+
tooltipMessage: 'Toggle End Sidebar',
2951
icon: const MacosIcon(
30-
CupertinoIcons.sidebar_left,
52+
CupertinoIcons.sidebar_right,
3153
),
32-
onPressed: () => MacosWindowScope.of(context).toggleSidebar(),
54+
onPressed: () => MacosWindowScope.of(context).toggleEndSidebar(),
3355
showLabel: false,
3456
),
3557
],

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ packages:
8787
path: ".."
8888
relative: true
8989
source: path
90-
version: "1.4.1+1"
90+
version: "1.5.0"
9191
matcher:
9292
dependency: transitive
9393
description:

lib/src/buttons/icon_button.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class MacosIconButtonState extends State<MacosIconButton>
146146
vsync: this,
147147
);
148148
_opacityAnimation = _animationController
149-
.drive(CurveTween(curve: Curves.decelerate))
149+
.drive(CurveTween(curve: const Interval(0.0, 0.25)))
150150
.drive(_opacityTween);
151151
_setTween();
152152
}

lib/src/layout/macos_list_tile.dart

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,30 @@ class MacosListTile extends StatelessWidget {
5151
children: [
5252
if (leading != null) leading!,
5353
SizedBox(width: leadingWhitespace),
54-
Column(
55-
crossAxisAlignment: CrossAxisAlignment.start,
56-
children: [
57-
DefaultTextStyle(
58-
style: MacosTheme.of(context).typography.headline.copyWith(
59-
fontWeight: FontWeight.bold,
60-
),
61-
child: title,
62-
),
63-
if (subtitle != null)
54+
Expanded(
55+
child: Column(
56+
crossAxisAlignment: CrossAxisAlignment.start,
57+
children: [
6458
DefaultTextStyle(
65-
style:
66-
MacosTheme.of(context).typography.subheadline.copyWith(
67-
color: MacosTheme.brightnessOf(context).isDark
68-
? MacosColors.systemGrayColor
69-
: const MacosColor(0xff88888C),
70-
),
71-
child: subtitle!,
59+
style: MacosTheme.of(context).typography.headline.copyWith(
60+
fontWeight: FontWeight.bold,
61+
),
62+
child: title,
7263
),
73-
],
64+
if (subtitle != null)
65+
DefaultTextStyle(
66+
style: MacosTheme.of(context)
67+
.typography
68+
.subheadline
69+
.copyWith(
70+
color: MacosTheme.brightnessOf(context).isDark
71+
? MacosColors.systemGrayColor
72+
: const MacosColor(0xff88888C),
73+
),
74+
child: subtitle!,
75+
),
76+
],
77+
),
7478
),
7579
],
7680
),

lib/src/layout/sidebar/sidebar.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class Sidebar {
2323
this.top,
2424
this.bottom,
2525
this.topOffset = 51.0,
26+
this.shownByDefault = true,
2627
}) : dragClosedBuffer = dragClosedBuffer ?? minWidth / 2;
2728

2829
/// The builder that creates a child to display in this widget, which will
@@ -111,4 +112,11 @@ class Sidebar {
111112
///
112113
/// Defaults to `51.0` which levels it up with the default height of the [TitleBar]
113114
final double topOffset;
115+
116+
/// Whether the sidebar should be open by default or not.
117+
///
118+
/// Most useful for end sidebars.
119+
///
120+
/// Defaults to `true`.
121+
final bool shownByDefault;
114122
}

0 commit comments

Comments
 (0)