Skip to content

Commit df70270

Browse files
authored
Readme update (#55)
* Documentation about checkbox * Documentation about radio button * Documentation about push button * Documentation about toggle switch * Documentation about indicators * Documentation about help buttons
1 parent 620778b commit df70270

File tree

1 file changed

+214
-29
lines changed

1 file changed

+214
-29
lines changed

README.md

Lines changed: 214 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Implements Apple's macOS Design System in Flutter. Based on the official documentation.
44

55
## Content
6+
67
- [macos_ui](#macos_ui)
78
- [Content](#content)
89
- [Contributing](#contributing)
@@ -11,28 +12,36 @@ Implements Apple's macOS Design System in Flutter. Based on the official documen
1112
- [Scaffold](#scaffold)
1213
- [Buttons](#buttons)
1314
- [Checkbox](#checkbox)
15+
- [HelpButton](#helpbutton)
1416
- [RadioButton](#radiobutton)
1517
- [PushButton](#pushbutton)
1618
- [Switch](#switch)
1719
- [Indicators](#indicators)
18-
- [ProgressCircle](#progresscircle)
19-
- [ProgressBar](#progressbar)
20-
20+
- [Progress Indicators](#progress-indicators)
21+
- [ProgressCircle](#progresscircle)
22+
- [ProgressBar](#progressbar)
23+
- [Level Indicators](#level-indicators)
24+
- [CapacityIndicator](#capacityindicator)
25+
- [RatingIndicator](#ratingindicator)
26+
- [RelevanceIndicator](#relevanceindicator)
27+
2128
## Contributing
2229

2330
macOS welcomes contributions. Please see CONTRIBUTING.md for more information.
2431

2532
## Resources
2633

27-
* [macOS Design Resources](https://developer.apple.com/design/resources/)
28-
* [macOS Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/macos)
29-
* [macOS Big Sur Figma kit](https://www.figma.com/file/M6K5L3GK0WJh6pnsASyVeE/macOS-Big-Sur-UI-Kit?node-id=1%3A2)
34+
- [macOS Design Resources](https://developer.apple.com/design/resources/)
35+
- [macOS Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/macos)
36+
- [macOS Big Sur Figma kit](https://www.figma.com/file/M6K5L3GK0WJh6pnsASyVeE/macOS-Big-Sur-UI-Kit?node-id=1%3A2)
3037

3138
# Layout
39+
3240
## Scaffold
33-
`Scaffold` provides a basic structure for laying out widgets in a way you would expect on macOS.
34-
You must specify a `body` as the main content area, and you can optionally provide a `sidebar`
35-
that will show to the left of `body`. The `sidebar` can be resized by grabbing the split and
41+
42+
`Scaffold` provides a basic structure for laying out widgets in a way you would expect on macOS.
43+
You must specify a `body` as the main content area, and you can optionally provide a `sidebar`
44+
that will show to the left of `body`. The `sidebar` can be resized by grabbing the split and
3645
dragging left or right. See the documentation for all customization options.
3746

3847
<img src="https://imgur.com/e41j2aT.jpg" width="75%"/>
@@ -43,41 +52,217 @@ dragging left or right. See the documentation for all customization options.
4352

4453
## Checkbox
4554

46-
| off | on | mixed |
47-
| --- | -- | ----- |
48-
| ![](https://developer.apple.com/design/human-interface-guidelines/macos/images/CheckBoxes_Deselected.svg) | ![](https://developer.apple.com/design/human-interface-guidelines/macos/images/CheckBoxes_Selected.svg) | ![](https://developer.apple.com/design/human-interface-guidelines/macos/images/CheckBoxes_Mixed.svg) |
55+
A checkbox is a type of button that lets the user choose between two opposite states, actions, or values. A selected checkbox is considered on when it contains a checkmark and off when it's empty. A checkbox is almost always followed by a title unless it appears in a checklist. [Learn more](https://developer.apple.com/design/human-interface-guidelines/macos/buttons/checkboxes/)
56+
57+
| Off | On | Mixed |
58+
| --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
59+
| ![Off Checkbox](https://developer.apple.com/design/human-interface-guidelines/macos/images/CheckBoxes_Deselected.svg) | ![On Checkbox](https://developer.apple.com/design/human-interface-guidelines/macos/images/CheckBoxes_Selected.svg) | ![Mixed Checkbox](https://developer.apple.com/design/human-interface-guidelines/macos/images/CheckBoxes_Mixed.svg) |
60+
61+
Here's an example of how to create a basic checkbox:
62+
63+
```dart
64+
bool selected = false;
65+
66+
Checkbox(
67+
value: selected,
68+
onChanged: (value) {
69+
setState(() => selected = value);
70+
},
71+
)
72+
```
73+
74+
To make a checkbox in the `mixed` state, set `value` to `null`.
75+
76+
## HelpButton
77+
78+
A help button appears within a view and opens app-specific help documentation when clicked. All help buttons are circular, consistently sized buttons that contain a question mark icon. [Learn more](https://developer.apple.com/design/human-interface-guidelines/macos/buttons/help-buttons/)
79+
80+
![HelpButton Example](https://developer.apple.com/design/human-interface-guidelines/macos/images/buttonsHelp.png)
81+
82+
Here's an example of how to create a help button:
83+
84+
```dart
85+
HelpButton(
86+
onPressed: () {
87+
print('pressed help button'),
88+
},
89+
)
90+
```
91+
92+
You can customize the help button appearance and behaviour using the `HelpButtonTheme`, but it's not recommended by apple to change help button's appearance.
4993

5094
## RadioButton
5195

52-
![](https://developer.apple.com/design/human-interface-guidelines/macos/images/radioButtons.png)
96+
A radio button is a small, circular button followed by a title. Typically presented in groups of two to five, radio buttons provide the user a set of related but mutually exclusive choices. A radio button’s state is either on (a filled circle) or off (an empty circle). [Learn more](https://developer.apple.com/design/human-interface-guidelines/macos/buttons/radio-buttons/)
97+
98+
![RadioButton Preview](https://developer.apple.com/design/human-interface-guidelines/macos/images/radioButtons.png)
99+
100+
Here's an example of how to create a basic radio button:
101+
102+
```dart
103+
bool selected = false;
104+
105+
RadioButton(
106+
value: selected,
107+
onChanged: (value) {
108+
setState(() => selected = value);
109+
},
110+
),
111+
```
53112

54113
## PushButton
55114

56-
<img src="https://imgur.com/v99ekWA.jpg"/>
57-
<img src="https://imgur.com/GsShoF6.jpg"/>
58-
<img src="https://imgur.com/TgfjJdQ.jpg"/>
59-
<img src="https://imgur.com/wt0K6u4.jpg"/>
60-
<img src="https://imgur.com/hj6uGhI.jpg"/>
61-
<img src="https://imgur.com/klWHTAX.jpg"/>
62-
<img src="https://imgur.com/83cEMeP.jpg"/>
63-
<img src="https://imgur.com/7khWnwt.jpg"/>
115+
A push button appears within a view and initiates an instantaneous app-specific action, such as printing a document or deleting a file. Push buttons contain text—not icons—and often open a separate window, dialog, or app so the user can complete a task. [Learn more](https://developer.apple.com/design/human-interface-guidelines/macos/buttons/push-buttons/)
116+
117+
| Dark Theme | Light Theme |
118+
| ------------------------------------------ | ------------------------------------------ |
119+
| <img src="https://imgur.com/GsShoF6.jpg"/> | <img src="https://imgur.com/klWHTAX.jpg"/> |
120+
| <img src="https://imgur.com/v99ekWA.jpg"/> | <img src="https://imgur.com/hj6uGhI.jpg"/> |
121+
| <img src="https://imgur.com/wt0K6u4.jpg"/> | <img src="https://imgur.com/7khWnwt.jpg"/> |
122+
| <img src="https://imgur.com/TgfjJdQ.jpg"/> | <img src="https://imgur.com/83cEMeP.jpg"/> |
123+
124+
Here's an example of how to create a basic push button:
125+
126+
```dart
127+
PushButton(
128+
child: Text('button'),
129+
buttonSize: ButtonSize.large,
130+
onPressed: () {
131+
print('button pressed');
132+
},
133+
),
134+
```
64135

65136
## Switch
66-
<img src="https://imgur.com/IBh5jkz.jpg" width="50%" height="50%"/>
67137

68-
<img src="https://imgur.com/qK1VCVr.jpg" width="50%" height="50%"/>
138+
A switch is a visual toggle between two mutually exclusive states — on and off. A switch shows that it's on when the accent color is visible and off when the switch appears colorless. [Learn more](https://developer.apple.com/design/human-interface-guidelines/macos/buttons/switches/)
139+
140+
| On | Off |
141+
| ------------------------------------------ | ------------------------------------------ |
142+
| <img src="https://imgur.com/qK1VCVr.jpg"/> | <img src="https://imgur.com/IBh5jkz.jpg"/> |
143+
144+
Here's an example of how to create a basic toggle switch:
145+
146+
```dart
147+
bool selected = false;
148+
149+
Switch(
150+
value: selected,
151+
onChanged: (value) {
152+
setState(() => selected = value);
153+
},
154+
),
155+
```
69156

70157
# Indicators
71158

72-
## ProgressCircle
159+
## Progress Indicators
160+
161+
Don’t make people sit around staring at a static screen waiting for your app to load content or perform lengthy data processing operations. Use progress indicators to let people know your app hasn't stalled and to give them some idea of how long they’ll be waiting.
162+
163+
Progress indicators have two distinct styles:
164+
165+
- **Bar indicators**, more commonly known as progress bars, show progress in a horizontal bar.
166+
- **Spinning indicators** show progress in a circular form, either as a spinner or as a circle that fills in as progress continues.
73167

74-
A `ProgressCircle` can be either determinate or indeterminate. If indeterminate, Flutter's
75-
`CupertinoActivityIndicator` will be shown.
168+
People don't interact with progress indicators; however, they are often accompanied by a button for canceling the corresponding operation. [Learn more](https://developer.apple.com/design/human-interface-guidelines/macos/indicators/progress-indicators/)
76169

77-
<img src="https://imgur.com/hr3dHn9.jpg" width="50%" height="50%"/>
170+
![Progress Indicator Example](https://developer.apple.com/design/human-interface-guidelines/macos/images/ProgressIndicators_Lead.png)
78171

79-
<img src="https://imgur.com/NSbKqLK.gif" width="50%" height="50%"/>
172+
### ProgressCircle
80173

81-
## ProgressBar
174+
A `ProgressCircle` can be either determinate or indeterminate.
175+
176+
| Determinate Progress Circle | Indeterminate Progress Circle |
177+
| ------------------------------------------ | ------------------------------------------ |
178+
| <img src="https://imgur.com/hr3dHn9.jpg"/> | <img src="https://imgur.com/NSbKqLK.gif"/> |
179+
180+
Here's an example of how to create an indeterminate progress circle:
181+
182+
```dart
183+
ProgressCircle(
184+
value: null,
185+
),
186+
```
187+
188+
You can provide a non-null value to `value` to make the progress circle determinate.
189+
190+
### ProgressBar
191+
192+
A `ProgressBar` can only be determinate.
82193

83194
<img src="https://imgur.com/tdYgJmB.jpg" width="50%" height="50%"/>
195+
196+
Here's an example of how to create a determinate progress bar:
197+
198+
```dart
199+
ProgressBar(
200+
value: 30,
201+
)
202+
```
203+
204+
## Level Indicators
205+
206+
A level indicator graphically represents of a specific value within a range of numeric values. It’s similar to a [slider](#slider) in purpose, but more visual and doesn’t contain a distinct control for selecting a value—clicking and dragging across the level indicator itself to select a value is supported, however. A level indicator can also include tick marks, making it easy for the user to pinpoint a specific value in the range. There are three different level indicator styles, each with a different appearance, for communicating capacity, rating, and relevance.
207+
208+
### CapacityIndicator
209+
210+
A capacity indicator illustrates the current level in relation to a finite capacity. Capacity indicators are often used when communicating factors like disk and battery usage. [Learn more](https://developer.apple.com/design/human-interface-guidelines/macos/indicators/level-indicators#capacity-indicators)
211+
212+
| Continuous | Discrete |
213+
| ---------- | -------- |
214+
| ![Continuous CapacityIndicator Example](https://developer.apple.com/design/human-interface-guidelines/macos/images/indicators-continous.png) | ![Discrete CapacityIndicator Example](https://developer.apple.com/design/human-interface-guidelines/macos/images/indicators-discrete.png) |
215+
| A horizontal translucent track that fills with a colored bar to indicate the current value. Tick marks are often displayed to provide context. | A horizontal row of separate, equally sized, rectangular segments. The number of segments matches the total capacity, and the segments fill completely—never partially—with color to indicate the current value. |
216+
217+
Here's an example of how to create an interactive continuous capacity indicator:
218+
219+
```dart
220+
double value = 30;
221+
222+
CapacityIndicator(
223+
value: value,
224+
discrete: false,
225+
onChanged: (v) {
226+
setState(() => value = v);
227+
},
228+
),
229+
```
230+
231+
You can set `discrete` to `true` to make it a discrete capacity indicator.
232+
233+
### RatingIndicator
234+
235+
A rating indicator uses a series of horizontally arranged graphical symbols to communicate a ranking level. The default symbol is a star.
236+
237+
![RatingIndicator Example](https://developer.apple.com/design/human-interface-guidelines/macos/images/indicator-rating.png)
238+
239+
A rating indicator doesn’t display partial symbols—its value is rounded in order to display complete symbols only. Within a rating indicator, symbols are always the same distance apart and don't expand or shrink to fit the control. [Learn more](https://developer.apple.com/design/human-interface-guidelines/macos/indicators/level-indicators#rating-indicators)
240+
241+
Here's an example of how to create an interactive rating indicator:
242+
243+
```dart
244+
double value = 3;
245+
246+
RatingIndicator(
247+
amount: 5,
248+
value: value,
249+
onChanged: (v) {
250+
setState(() => value = v);
251+
}
252+
)
253+
```
254+
255+
### RelevanceIndicator
256+
257+
A relevance indicator communicates relevancy using a series of vertical bars. It often appears in a list of search results for reference when sorting and comparing multiple items. [Learn more](https://developer.apple.com/design/human-interface-guidelines/macos/indicators/level-indicators#relevance-indicators)
258+
259+
![RelevanceIndicator Example](https://developer.apple.com/design/human-interface-guidelines/macos/images/indicator-relevance.png)
260+
261+
Here's an example of how to create a relevance indicator:
262+
263+
```dart
264+
RelevanceIndicator(
265+
value: 15,
266+
amount: 20,
267+
)
268+
```

0 commit comments

Comments
 (0)