Skip to content

Commit

Permalink
fix: A variety of small bug fixes (#168)
Browse files Browse the repository at this point in the history
ci: Update passing score to 90%
chore: Update third party licenses
fix: Add PlatformIs to not use dart:io
fix: Border sizes
fix: Spacings in example app
  • Loading branch information
thelukewalton authored Sep 2, 2024
1 parent 361b1c7 commit cb37705
Show file tree
Hide file tree
Showing 31 changed files with 318 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: ZebraDevs/flutter-code-quality@main
with:
token: ${{secrets.GITHUB_TOKEN}}
coverage-pass-score: '1'
coverage-pass-score: '90'


check-secret:
Expand Down
42 changes: 38 additions & 4 deletions LICENSE-3RD-PARTY
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

---

### Flutter
## Flutter

Applies to:

Expand Down Expand Up @@ -37,7 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

---

### tinycolor
## tinycolor

Applies to:

Expand All @@ -53,7 +53,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

---

### IBM Plex Sans
## IBM Plex Sans

Applies to:

Expand All @@ -67,7 +67,7 @@ This Font Software is licensed under the SIL Open Font License, Version 1.1.

This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL

## SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
### SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
Expand Down Expand Up @@ -151,3 +151,37 @@ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.



## Mike Rydstrom

Applies to:

* platform_is.dart
* universal_platform_vm.dart
* universal_platform_web.dart

https://gist.github.com/rydmike/1771fe24c050ebfe792fa309371154d8

MIT License

Copyright (c) 2021 Mike Rydstrom

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.
52 changes: 31 additions & 21 deletions example/lib/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,30 +161,40 @@ class _HomeState extends State<Home> {
child: SingleChildScrollView(
child: Column(
children: [
ExpansionTile(
title: Text('Widgets'),
backgroundColor: Zeta.of(context).colors.warm.shade30,
children: _components
.map((item) => ListTile(title: Text(item.name), onTap: () => context.go('/${item.name}')))
.toList(),
),
ExpansionTile(
title: Text('Theme'),
backgroundColor: Zeta.of(context).colors.warm.shade30,
children: _theme
.map((item) => ListTile(title: Text(item.name), onTap: () => context.go('/${item.name}')))
.toList(),
),
ExpansionTile(
title: Text('Assets'),
backgroundColor: Zeta.of(context).colors.warm.shade30,
children: _assets
.map((item) => ListTile(title: Text(item.name), onTap: () => context.go('/${item.name}')))
.toList(),
),
ExampleListTile(name: 'Components', children: _components),
ExampleListTile(name: 'Theme', children: _theme),
ExampleListTile(name: 'Assets', children: _assets),
],
),
),
);
}
}

class ExampleListTile extends StatelessWidget {
const ExampleListTile({
super.key,
required this.children,
required this.name,
});

final List<Component> children;
final String name;

@override
Widget build(BuildContext context) {
return ExpansionTile(
title: Text(name),
children: children
.map(
(item) => ListTile(
title: Text(item.name),
onTap: () => context.go('/${item.name}'),
hoverColor: Zeta.of(context).colors.surfaceHover,
tileColor: Zeta.of(context).colors.surfaceDefault,
),
)
.toList(),
);
}
}
56 changes: 28 additions & 28 deletions example/lib/pages/theme/spacing_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@ class SpacingExample extends StatelessWidget {
'medium': Zeta.of(context).spacing.medium,
'large': Zeta.of(context).spacing.large,
'xl': Zeta.of(context).spacing.xl,
'2xl': Zeta.of(context).spacing.xl_2,
'3xl': Zeta.of(context).spacing.xl_3,
'4xl': Zeta.of(context).spacing.xl_4,
'5xl': Zeta.of(context).spacing.xl_5,
'6xl': Zeta.of(context).spacing.xl_6,
'7xl': Zeta.of(context).spacing.xl_7,
'8xl': Zeta.of(context).spacing.xl_8,
'9xl': Zeta.of(context).spacing.xl_9,
'10xl': Zeta.of(context).spacing.xl_10,
'11xl': Zeta.of(context).spacing.xl_11,
'xl_2': Zeta.of(context).spacing.xl_2,
'xl_3': Zeta.of(context).spacing.xl_3,
'xl_4': Zeta.of(context).spacing.xl_4,
'xl_5': Zeta.of(context).spacing.xl_5,
'xl_6': Zeta.of(context).spacing.xl_6,
'xl_7': Zeta.of(context).spacing.xl_7,
'xl_8': Zeta.of(context).spacing.xl_8,
'xl_9': Zeta.of(context).spacing.xl_9,
'xl_10': Zeta.of(context).spacing.xl_10,
'xl_11': Zeta.of(context).spacing.xl_11,
};
Map<String, double> baseSpacings = {
'x1': Zeta.of(context).spacing.primitives.x1,
'x2': Zeta.of(context).spacing.primitives.x2,
'x3': Zeta.of(context).spacing.primitives.x3,
'x4': Zeta.of(context).spacing.primitives.x4,
'x5': Zeta.of(context).spacing.primitives.x5,
'x6': Zeta.of(context).spacing.primitives.x6,
'x7': Zeta.of(context).spacing.primitives.x7,
'x8': Zeta.of(context).spacing.primitives.x8,
'x9': Zeta.of(context).spacing.primitives.x9,
'x10': Zeta.of(context).spacing.primitives.x10,
'x11': Zeta.of(context).spacing.primitives.x11,
'x12': Zeta.of(context).spacing.primitives.x12,
'x13': Zeta.of(context).spacing.primitives.x13,
'x14': Zeta.of(context).spacing.primitives.x14,
'x15': Zeta.of(context).spacing.primitives.x15,
'primitives.x1': Zeta.of(context).spacing.primitives.x1,
'primitives.x2': Zeta.of(context).spacing.primitives.x2,
'primitives.x3': Zeta.of(context).spacing.primitives.x3,
'primitives.x4': Zeta.of(context).spacing.primitives.x4,
'primitives.x5': Zeta.of(context).spacing.primitives.x5,
'primitives.x6': Zeta.of(context).spacing.primitives.x6,
'primitives.x7': Zeta.of(context).spacing.primitives.x7,
'primitives.x8': Zeta.of(context).spacing.primitives.x8,
'primitives.x9': Zeta.of(context).spacing.primitives.x9,
'primitives.x10': Zeta.of(context).spacing.primitives.x10,
'primitives.x11': Zeta.of(context).spacing.primitives.x11,
'primitives.x12': Zeta.of(context).spacing.primitives.x12,
'primitives.x13': Zeta.of(context).spacing.primitives.x13,
'primitives.x14': Zeta.of(context).spacing.primitives.x14,
'primitives.x15': Zeta.of(context).spacing.primitives.x15,
};

return ExampleScaffold(
Expand All @@ -55,12 +55,12 @@ class SpacingExample extends StatelessWidget {
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: baseSpacings.entries.map((obj) => _SpacingDemo(obj)).toList(),
children: semanticSpacings.entries.map((obj) => _SpacingDemo(obj)).toList(),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: semanticSpacings.entries.map((obj) => _SpacingDemo(obj)).toList(),
)
children: baseSpacings.entries.map((obj) => _SpacingDemo(obj)).toList(),
),
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion example/widgetbook/pages/assets/icon_widgetbook.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Widget iconsUseCase(BuildContext context) {
nameArr,
textAlign: TextAlign.center,
maxLines: 2,
)
),
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion example/widgetbook/pages/introduction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class _IntroductionWidgetbookState extends State<IntroductionWidgetbook> {
return LayoutBuilder(builder: (context, constraints) {
final bool largeScreen = constraints.maxWidth > 480;
return Scaffold(
backgroundColor: colors.black,
backgroundColor: Colors.black,
body: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.symmetric(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/avatars/avatar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ extension on ZetaAvatarSize {
case ZetaAvatarSize.xs:
case ZetaAvatarSize.xxs:
case ZetaAvatarSize.xxxs:
return ZetaBorders.borderWidth;
return ZetaBorders.medium;
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/badges/indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class ZetaIndicator extends ZetaStatelessWidget {
height: sizePixels + Zeta.of(context).spacing.minimum,
decoration: BoxDecoration(
border: Border.all(
width: ZetaBorders.borderWidth,
width: ZetaBorders.medium,
color: Zeta.of(context).colors.borderSubtle,
),
color: (inverse ? foregroundColor : Colors.transparent),
Expand Down
4 changes: 1 addition & 3 deletions lib/src/components/banner/banner.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Expand Down Expand Up @@ -65,7 +63,7 @@ class ZetaBanner extends MaterialBanner {
builder: (context) {
final backgroundColor = _backgroundColorFromType(context, type);
final foregroundColor = backgroundColor.onColor;
if (!kIsWeb && Platform.isAndroid && context.mounted) {
if (!kIsWeb && PlatformIs.android && context.mounted) {
// ignore: invalid_use_of_visible_for_testing_member
final statusBarColor = SystemChrome.latestStyle?.statusBarColor;
if (statusBarColor != backgroundColor) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/breadcrumbs/breadcrumbs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class _BreadCrumbsTruncatedState extends State<_BreadCrumbsTruncated> {
side: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.focused)) {
return BorderSide(
width: ZetaBorders.borderWidth,
width: ZetaBorders.medium,
color: colors.primary.shade100,
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/button_group/button_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class _ZetaGroupButtonState extends State<ZetaGroupButton> {
bool finalButton,
) {
if (_controller.value.contains(WidgetState.focused)) {
return BorderSide(color: colors.blue.shade50, width: ZetaBorders.borderWidth);
return BorderSide(color: colors.blue.shade50, width: ZetaBorders.medium);
}
if (_controller.value.contains(WidgetState.disabled)) {
return BorderSide(color: colors.cool.shade40);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/buttons/button_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ ButtonStyle buttonStyle(
}
// TODO(UX-1134): This removes a defualt border when focused, rather than adding a second border when focused.
if (states.contains(WidgetState.focused)) {
return BorderSide(color: colors.blue, width: ZetaBorders.borderWidth);
return BorderSide(color: colors.blue, width: ZetaBorders.medium);
}
if (type.border) {
return BorderSide(
Expand Down
15 changes: 4 additions & 11 deletions lib/src/components/chat_item/chat_item.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// ignore_for_file: deprecated_member_use_from_same_package

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
Expand Down Expand Up @@ -134,22 +133,16 @@ class ZetaChatItem extends ZetaStatelessWidget {

// coverage:ignore-start
if (onMenuMoreTap != null) {
actions.add(
ZetaSlidableAction(onPressed: onMenuMoreTap, color: colors.purple, icon: ZetaIcons.more_vertical),
);
actions.add(ZetaSlidableAction.menuMore(onPressed: onMenuMoreTap));
}
if (onCallTap != null) {
actions.add(
ZetaSlidableAction(onPressed: onCallTap, color: colors.green, icon: ZetaIcons.phone),
);
actions.add(ZetaSlidableAction.call(onPressed: onCallTap));
}
if (onPttTap != null) {
actions.add(
ZetaSlidableAction(onPressed: onPttTap, color: colors.blue, icon: ZetaIcons.ptt),
);
actions.add(ZetaSlidableAction.ptt(onPressed: onPttTap));
}
if (onDeleteTap != null) {
actions.add(ZetaSlidableAction(onPressed: onDeleteTap, color: colors.red, icon: ZetaIcons.delete));
actions.add(ZetaSlidableAction.delete(onPressed: onDeleteTap));
}
// coverage:ignore-end

Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/chips/chip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class _ZetaChipState extends State<ZetaChip> {
BorderSide(
color: _controller.value.contains(WidgetState.focused) ? colors.blue.shade50 : colors.borderDefault,
width: _controller.value.contains(WidgetState.focused)
? ZetaBorders.borderWidth
? ZetaBorders.medium
: !selected
? 1
: 0,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/dial_pad/dial_pad.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class ZetaDialPadButton extends StatelessWidget {
decoration: ShapeDecoration(
shape: const CircleBorder(),
color: colors.warm.shade10,
shadows: [BoxShadow(color: colors.black.withOpacity(0.15), blurRadius: 4, offset: const Offset(0, 2))],
shadows: [BoxShadow(color: Colors.black.withOpacity(0.15), blurRadius: 4, offset: const Offset(0, 2))],
),
child: Material(
color: Colors.transparent,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/fabs/fab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class _ZetaFABState extends State<ZetaFAB> {
(Set<WidgetState> states) {
if (states.contains(WidgetState.focused)) {
// TODO(UX-1134): This removes a defualt border when focused, rather than adding a second border when focused.
return BorderSide(color: Zeta.of(context).colors.blue.shade50, width: ZetaBorders.borderWidth);
return BorderSide(color: Zeta.of(context).colors.blue.shade50, width: ZetaBorders.medium);
}
return null;
},
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/global_header/global_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class _GlobalHeaderState extends State<ZetaGlobalHeader> {
setState(() {
_selectedIndex = index;
});
child.handlePress!.call();
child.handlePress?.call();
},
),
);
Expand Down
7 changes: 1 addition & 6 deletions lib/src/components/list_item/notification_list_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,8 @@ class ZetaNotificationBadge extends StatelessWidget {

@override
Widget build(BuildContext context) {
final colors = Zeta.of(context).colors;
return avatar != null
? avatar!.copyWith(
size: ZetaAvatarSize.m,
lowerBadge: ZetaAvatarBadge.icon(icon: ZetaIcons.check_mark, color: colors.green),
backgroundColor: colors.purple.shade80,
)
? avatar!.copyWith(size: ZetaAvatarSize.m)
: icon != null
? ZetaIcon(
icon,
Expand Down
Loading

0 comments on commit cb37705

Please sign in to comment.