Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
f4203fc
Update CONTRIBUTING.md
GroovinChip Mar 30, 2021
70e2254
Theming and styles (#8)
GroovinChip Mar 31, 2021
6486252
Update README.md with Content section
GroovinChip Mar 31, 2021
2bc2391
Add animationCurve and mediumAnimationDuration to Style class (#10)
GroovinChip Mar 31, 2021
af3f146
Version 0.0.2 (#11)
GroovinChip Apr 3, 2021
5a4d827
Update license (#12)
GroovinChip Apr 3, 2021
807aac1
Use null-safe split-view from git. Tweak Scaffold accordingly . (#13)
GroovinChip Apr 3, 2021
6c3257b
Add dart_code_metrics package
GroovinChip Apr 3, 2021
9c15c71
Merge pull request #16 from GroovinChip/code_metrics
GroovinChip Apr 3, 2021
3035886
Improve code_metrics and address warnings (#17)
GroovinChip Apr 3, 2021
1794c47
Update to latest code_metrics
GroovinChip Apr 9, 2021
8e7edce
Rework on MacosApp (#18)
bdlukaa Apr 12, 2021
6a2f55b
Update to latest code_metrics and stop requiring alphabetically-sorte…
GroovinChip Apr 12, 2021
dc36748
Add primaryColor to Style (#19)
GroovinChip Apr 13, 2021
e00a229
Implemented Switch (#21)
bdlukaa Apr 15, 2021
fee890d
Implement Progress Indicators
bdlukaa Apr 15, 2021
0edecd9
Sort constructors first, run optimize imports
GroovinChip Apr 15, 2021
b383b63
t push origin dev Merge branch 'bdlukaa-progress_indicators' into dev
GroovinChip Apr 15, 2021
5058669
Update progress_indicators.dart docs
GroovinChip Apr 15, 2021
a034beb
Update readme (#23)
GroovinChip Apr 15, 2021
b89a7ab
Theme refactor (#29)
GroovinChip Apr 17, 2021
8a6ad91
Update README.md and CONTRIBUTING.md (#33)
GroovinChip Apr 17, 2021
8ecaebb
Add pull request template (#34)
GroovinChip Apr 17, 2021
edefee2
Add workflows/pana_analysis.yml (#35)
GroovinChip Apr 17, 2021
015ee96
Push button (#40)
GroovinChip Apr 17, 2021
6634ffc
Improve Typography (#41)
GroovinChip Apr 17, 2021
3a36cc8
Add `brightnessOf` and `maybeBrightness of` to `MacosTheme` (#43)
GroovinChip Apr 18, 2021
4cffae2
Add extensions on CupertinoDynamicColor to try and solve what's block…
GroovinChip Apr 18, 2021
19b9750
Implemented Level indicator (#30)
bdlukaa Apr 19, 2021
039174d
Add workflow_dispatch to enable manual runs via gh cli (#46)
GroovinChip Apr 19, 2021
968aa7b
Implement RadioButton and Checkbox (#47)
bdlukaa Apr 19, 2021
4274c42
Fixed #49
bdlukaa Apr 23, 2021
b056a35
Merge branch 'level-indicator-fix' into dev
GroovinChip Apr 24, 2021
f23cfed
Implemented Help Button (#51)
harshvsb1105 May 1, 2021
620778b
Update CI with "Format scores json" step (#54)
GroovinChip May 1, 2021
df70270
Readme update (#55)
bdlukaa May 2, 2021
bb8e8ba
Squashed commit of the following:
GroovinChip May 2, 2021
dd77e06
change base href
GroovinChip May 2, 2021
742cce0
Squashed commit of the following:
GroovinChip May 2, 2021
10d1d5b
Code Improvements (#58)
bdlukaa May 2, 2021
472607e
update base href
GroovinChip May 2, 2021
a79ae19
Update PR template
GroovinChip May 2, 2021
9dcc71a
Merge branch 'update_pr_template' into dev
GroovinChip May 2, 2021
e0dbdf7
Update issue templates
GroovinChip May 2, 2021
ded185c
Update package description
GroovinChip May 3, 2021
ad55291
Scaffold (#52)
lesliearkorful May 9, 2021
40a7c8a
Text field (#62)
bdlukaa May 9, 2021
6673be2
Implement mouse cursors (#67)
bdlukaa May 10, 2021
4b29012
Implement Tooltip (#68)
bdlukaa May 10, 2021
62feb6d
Update Scaffold images (#72)
GroovinChip May 11, 2021
9e42f00
Adjust failing score (#75)
GroovinChip May 11, 2021
8873f44
Adjust spacing between elements in demo (#76)
GroovinChip May 11, 2021
189dc32
Update documentation (#77)
lesliearkorful May 12, 2021
cbd4c78
Move to v 0.1.0
GroovinChip May 13, 2021
6126e90
Run optimize imports and dartfmt on all files
GroovinChip May 13, 2021
c635d94
Fix
bdlukaa May 14, 2021
bd93d82
Bump version
bdlukaa May 14, 2021
63a390d
Clear Button is aligned to text in TextField (#91)
bdlukaa May 14, 2021
ec920d7
Fix discrete capacity indicators
bdlukaa May 14, 2021
0f3b24c
Fix continuous capacity indicator
bdlukaa May 14, 2021
2f40ba5
Update CHANGELOG.md
bdlukaa May 14, 2021
935f940
Capacity Indicator now works as expected (#92)
bdlukaa May 14, 2021
260c2fa
Implement Label (#93)
bdlukaa May 15, 2021
cc3c131
Run optimize imports
GroovinChip May 17, 2021
ecc3ac2
Merge branch 'stable' into dev
GroovinChip May 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [0.1.1]
* Implemented `Label` ([#61](https://github.com/GroovinChip/macos_ui/issues/61))
* Capacity Indicator now works as expected ([#49](https://github.com/GroovinChip/macos_ui/issues/49))
* Clear button is now aligned to text ([#82](https://github.com/GroovinChip/macos_ui/issues/82))

## [0.1.0]
* pub.dev release

Expand All @@ -12,7 +17,7 @@
* Implement `TextField`

## [0.0.10]
* Revamp `Scaffold` [#26] (https://github.com/GroovinChip/macos_ui/issues/26)
* Revamp `Scaffold` [#26](https://github.com/GroovinChip/macos_ui/issues/26)

## [0.0.9+1]
* `CapacityIndicator` colors can now be set on its constructor
Expand Down
41 changes: 27 additions & 14 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ class _DemoState extends State<Demo> {
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: TextField(
prefix: Padding(
padding: const EdgeInsets.symmetric(horizontal: 4.0),
padding: const EdgeInsets.symmetric(
horizontal: 4.0,
vertical: 2.0,
),
child: Icon(CupertinoIcons.search),
),
placeholder: 'Type some text here',
Expand All @@ -113,20 +116,30 @@ class _DemoState extends State<Demo> {
),
),
const SizedBox(height: 20),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: TextField.borderless(
prefix: Padding(
padding: const EdgeInsets.symmetric(horizontal: 4.0),
child: Icon(CupertinoIcons.search),
),
placeholder: 'Type some text here',
Label(
icon: Icon(
CupertinoIcons.tag,
color: CupertinoColors.activeBlue,
),
text: SelectableText('A borderless textfield: '),
child: Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: TextField.borderless(
prefix: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 4.0),
child: Icon(CupertinoIcons.search),
),
placeholder: 'Type some text here',

/// If both suffix and clear button mode is provided,
/// suffix will override the clear button.
suffix: Text('SUFFIX'),
// clearButtonMode: OverlayVisibilityMode.always,
maxLines: null,
/// If both suffix and clear button mode is provided,
/// suffix will override the clear button.
suffix: Text('SUFFIX'),
// clearButtonMode: OverlayVisibilityMode.always,
maxLines: null,
),
),
),
),
],
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.0"
version: "0.1.1"
matcher:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions lib/macos_ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export 'src/indicators/capacity_indicators.dart';
export 'src/indicators/progress_indicators.dart';
export 'src/indicators/rating_indicator.dart';
export 'src/indicators/relevance_indicator.dart';
export 'src/labels/label.dart';
export 'src/labels/tooltip.dart';
export 'src/layout/content_area.dart';
export 'src/layout/resizable_pane.dart';
Expand Down
7 changes: 5 additions & 2 deletions lib/src/fields/text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ class _TextFieldState extends State<TextField>
valueListenable: _effectiveController,
child: editableText,
builder: (BuildContext context, TextEditingValue? text, Widget? child) {
return Row(children: <Widget>[
return Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
// Insert a prefix at the front if the prefix visibility mode matches
// the current text state.
if (_showPrefixWidget(text!)) widget.prefix!,
Expand Down Expand Up @@ -1137,7 +1137,10 @@ class _TextFieldState extends State<TextField>
}
: null,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 6.0),
padding: const EdgeInsets.symmetric(
horizontal: 6.0,
vertical: 4.0,
),
child: Icon(
CupertinoIcons.clear_thick_circled,
size: 18.0,
Expand Down
91 changes: 51 additions & 40 deletions lib/src/indicators/capacity_indicators.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,9 @@ class CapacityIndicator extends StatelessWidget {
properties.add(StringProperty('semanticLabel', semanticLabel));
}

void _handleUpdate(Offset lp) {
double value = discrete ? lp.dx / splits : lp.dx;
if (value.isNegative)
value = 0;
else if (value > 100) value = 100;
onChanged?.call(value);
void _handleUpdate(Offset lp, double width) {
double value = (lp.dx / width) * splits;
onChanged?.call(value.clamp(0.0, 100.0));
}

@override
Expand All @@ -106,45 +103,59 @@ class CapacityIndicator extends StatelessWidget {
value: value.toStringAsFixed(2),
child: Container(
constraints: BoxConstraints(minWidth: _kCapacityIndicatorMinWidth),
child: GestureDetector(
onPanStart: (event) => _handleUpdate(event.localPosition),
onPanUpdate: (event) => _handleUpdate(event.localPosition),
onPanDown: (event) => _handleUpdate(event.localPosition),
child: discrete
? LayoutBuilder(builder: (context, consts) {
double width = consts.biggest.width;
if (width.isInfinite) width = 100;
final splitWidth = width / splits;
final fillToIndex = (100 - -(value - 100)) * (splits / 10);
return SizedBox(
width: width,
child: Row(
children: List.generate(splits, (index) {
return Container(
padding: EdgeInsets.only(
right: index == splits - 1 ? 0 : 2.0,
),
width: splitWidth,
child: CapacityIndicatorCell(
value: value > 0 && fillToIndex / 10 >= index
? 100
: 0,
backgroundColor: backgroundColor,
borderColor: borderColor,
color: color,
),
);
}),
),
);
})
: CapacityIndicatorCell(
child: LayoutBuilder(builder: (context, consts) {
double width = consts.maxWidth;
if (width.isInfinite) width = 100;
final splitWidth = width / splits;
if (discrete) {
final fillToIndex = value / splits - 1;
return SizedBox(
width: width,
child: GestureDetector(
onPanStart: (event) =>
_handleUpdate(event.localPosition, splitWidth),
onPanUpdate: (event) =>
_handleUpdate(event.localPosition, splitWidth),
onPanDown: (event) =>
_handleUpdate(event.localPosition, splitWidth),
child: Row(
children: List.generate(splits, (index) {
return Container(
padding: EdgeInsets.only(
right: index == splits - 1 ? 0 : 2.0,
),
width: splitWidth,
child: CapacityIndicatorCell(
value: value > 0 && fillToIndex >= index ? 100 : 0,
backgroundColor: backgroundColor,
borderColor: borderColor,
color: color,
),
);
}),
),
),
);
} else {
return SizedBox(
width: width,
child: GestureDetector(
onPanStart: (event) =>
_handleUpdate(event.localPosition, splitWidth),
onPanUpdate: (event) =>
_handleUpdate(event.localPosition, splitWidth),
onPanDown: (event) =>
_handleUpdate(event.localPosition, splitWidth),
child: CapacityIndicatorCell(
value: value,
backgroundColor: backgroundColor,
borderColor: borderColor,
color: color,
),
),
),
);
}
}),
),
);
}
Expand Down
55 changes: 55 additions & 0 deletions lib/src/labels/label.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import 'package:macos_ui/macos_ui.dart';
import 'package:macos_ui/src/library.dart';

/// A label is a static text field that describes an onscreen interface
/// element or provides a short message. Although people can’t edit labels,
/// they can sometimes copy label contents.
///
/// ![Label Example](https://developer.apple.com/design/human-interface-guidelines/macos/images/labels.png)
class Label extends StatelessWidget {
/// Creates a label.
const Label({
Key? key,
this.icon,
required this.text,
this.child,
}) : super(key: key);

/// The icon used by the label. If non-null, it's rendered horizontally
/// before [text].
///
/// Usually an [Icon].
final Widget? icon;

/// The text of the label. Usually a [Text]. To make it selectable, use
/// [SelectableText] instead
final Widget text;

/// The widget at the right of [text].
final Widget? child;

@override
Widget build(BuildContext context) {
assert(debugCheckHasMacosTheme(context));
final theme = MacosTheme.of(context);
final text = DefaultTextStyle(
style: (theme.typography?.body ?? TextStyle()).copyWith(
color: DynamicColorX.macosResolve(CupertinoColors.label, context),
fontWeight: FontWeight.w500,
),
child: this.text,
);
return Row(mainAxisSize: MainAxisSize.min, children: [
if (icon != null)
Padding(
padding: EdgeInsets.only(right: 6),
child: IconTheme(
data: IconThemeData(size: theme.typography?.body?.fontSize ?? 24),
child: icon!,
),
),
text,
if (child != null) child!,
]);
}
}
1 change: 1 addition & 0 deletions lib/src/library.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ export 'package:flutter/material.dart'
Scrollbar,
VerticalDivider,
Divider,
SelectableText,
kElevationToShadow;
export 'package:flutter/widgets.dart';
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: 0.1.0
version: 0.1.1
homepage: 'https://github.com/GroovinChip/macos_ui'

environment:
Expand Down