Skip to content

Commit

Permalink
Improve Cursor Style and Other Fixes
Browse files Browse the repository at this point in the history
On some items the cursor style wasn't adjusted on dekstop, so that there
was no indication that the item is clickable. We also had the problem
that the clickable area was to large for some items (e.g app actions).
These issues should be fixed now.

We also removed the dismiss option from the snackbar, because sometimes
this could break the app, when the context isn't available anymore.

In some places we still had used "Theme.of", which is now replaced with
our new theme() function.
  • Loading branch information
ricoberger committed Jan 7, 2023
1 parent f48a0a4 commit fcbcfed
Show file tree
Hide file tree
Showing 20 changed files with 662 additions and 644 deletions.
7 changes: 0 additions & 7 deletions lib/utils/showmodal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@ void showSnackbar(BuildContext context, String title, String message) {
),
],
),
action: SnackBarAction(
label: 'Dissmiss',
textColor: theme(context).colorMessageForeground,
onPressed: () {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
},
),
),
);
}
67 changes: 35 additions & 32 deletions lib/widgets/home/overview/overview_metrics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,41 +30,44 @@ class OverviewMetrics extends StatelessWidget {
IconData icon, [
void Function()? onTap,
]) {
return InkWell(
onTap: onTap,
child: Container(
padding: const EdgeInsets.all(
Constants.spacingMiddle,
),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: theme(context).colorShadow,
blurRadius: Constants.sizeBorderBlurRadius,
spreadRadius: Constants.sizeBorderSpreadRadius,
offset: const Offset(0.0, 0.0),
),
],
color: theme(context).colorCard,
borderRadius: const BorderRadius.all(
Radius.circular(Constants.sizeBorderRadius),
return MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: onTap,
child: Container(
padding: const EdgeInsets.all(
Constants.spacingMiddle,
),
),
child: Column(
children: [
Icon(
icon,
color: theme(context).colorPrimary,
size: 64,
),
const SizedBox(height: Constants.spacingSmall),
Text(
title,
style: primaryTextStyle(
context,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: theme(context).colorShadow,
blurRadius: Constants.sizeBorderBlurRadius,
spreadRadius: Constants.sizeBorderSpreadRadius,
offset: const Offset(0.0, 0.0),
),
],
color: theme(context).colorCard,
borderRadius: const BorderRadius.all(
Radius.circular(Constants.sizeBorderRadius),
),
],
),
child: Column(
children: [
Icon(
icon,
color: theme(context).colorPrimary,
size: 64,
),
const SizedBox(height: Constants.spacingSmall),
Text(
title,
style: primaryTextStyle(
context,
),
),
],
),
),
),
);
Expand Down
10 changes: 2 additions & 8 deletions lib/widgets/resources/details/details_get_logs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,7 @@ class _DetailsGetLogsState extends State<DetailsGetLogs> {
child: Text(
value,
style: TextStyle(
color: Theme.of(context)
.textTheme
.displayMedium!
.color,
color: theme(context).colorTextPrimary,
),
),
);
Expand Down Expand Up @@ -262,10 +259,7 @@ class _DetailsGetLogsState extends State<DetailsGetLogs> {
child: Text(
value,
style: TextStyle(
color: Theme.of(context)
.textTheme
.displayMedium!
.color,
color: theme(context).colorTextPrimary,
),
),
);
Expand Down
63 changes: 34 additions & 29 deletions lib/widgets/resources/details/details_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,44 +58,49 @@ class DetailsItemWidget extends StatelessWidget {
child: Wrap(
children: List.generate(
values.length,
(index) => InkWell(
onTap: () {
if (onTap != null) {
onTap(index);
} else {
showSnackbar(context, name, values[index]);
}
},
child: Container(
margin: const EdgeInsets.all(Constants.spacingExtraSmall),
child: Chip(
label: Text(values[index]),
),
(index) => Container(
margin: const EdgeInsets.all(Constants.spacingExtraSmall),
child: ActionChip(
onPressed: () {
if (onTap != null) {
onTap(index);
} else {
showSnackbar(context, name, values[index]);
}
},
label: Text(values[index]),
),
),
),
),
);
}

return Flexible(
child: InkWell(
onTap: () {
if (onTap != null) {
onTap(-1);
}
},
child: Text(
values.toString(),
softWrap: true,
style: onTap != null
? TextStyle(
if (onTap != null) {
return Flexible(
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
onTap(-1);
},
child: Text(values.toString(),
softWrap: true,
style: TextStyle(
color: theme(context).colorTextPrimary,
decoration: TextDecoration.underline,
)
: TextStyle(
color: theme(context).colorTextPrimary,
),
)),
),
),
);
}

return Flexible(
child: Text(
values.toString(),
softWrap: true,
style: TextStyle(
color: theme(context).colorTextPrimary,
),
),
);
Expand Down
74 changes: 39 additions & 35 deletions lib/widgets/resources/details/details_item_conditions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,44 +80,48 @@ class DetailsItemConditions extends StatelessWidget {
Radius.circular(Constants.sizeBorderRadius),
),
),
child: InkWell(
onTap: () {
final age = item['status']['conditions'][index]
['lastTransitionTime'] !=
null
? getAge(DateTime.parse(item['status']
['conditions'][index]
['lastTransitionTime']))
: '-';
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
final age = item['status']['conditions'][index]
['lastTransitionTime'] !=
null
? getAge(DateTime.parse(item['status']
['conditions'][index]
['lastTransitionTime']))
: '-';

showSnackbar(
context,
item['status']['conditions'][index]['type'],
'Status: ${item['status']['conditions'][index]['status']}\nAge: $age\nReason: ${item['status']['conditions'][index]['reason'] ?? '-'}\nMessage: ${item['status']['conditions'][index]['message'] ?? '-'}',
);
},
child: Row(
children: [
Icon(
item['status']['conditions'][index]['status'] ==
'True'
? Icons.radio_button_checked
: Icons.radio_button_unchecked,
size: 24,
color: theme(context).colorPrimary,
),
const SizedBox(width: Constants.spacingSmall),
Expanded(
flex: 1,
child: Text(
item['status']['conditions'][index]['type'],
style: noramlTextStyle(
context,
showSnackbar(
context,
item['status']['conditions'][index]['type'],
'Status: ${item['status']['conditions'][index]['status']}\nAge: $age\nReason: ${item['status']['conditions'][index]['reason'] ?? '-'}\nMessage: ${item['status']['conditions'][index]['message'] ?? '-'}',
);
},
child: Row(
children: [
Icon(
item['status']['conditions'][index]
['status'] ==
'True'
? Icons.radio_button_checked
: Icons.radio_button_unchecked,
size: 24,
color: theme(context).colorPrimary,
),
const SizedBox(width: Constants.spacingSmall),
Expanded(
flex: 1,
child: Text(
item['status']['conditions'][index]['type'],
style: noramlTextStyle(
context,
),
overflow: TextOverflow.ellipsis,
),
overflow: TextOverflow.ellipsis,
),
),
],
],
),
),
),
);
Expand Down
10 changes: 2 additions & 8 deletions lib/widgets/resources/details/details_terminal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,7 @@ class _DetailsTerminalState extends State<DetailsTerminal> {
child: Text(
value,
style: TextStyle(
color: Theme.of(context)
.textTheme
.displayMedium!
.color,
color: theme(context).colorTextPrimary,
),
),
);
Expand Down Expand Up @@ -248,10 +245,7 @@ class _DetailsTerminalState extends State<DetailsTerminal> {
child: Text(
value,
style: TextStyle(
color: Theme.of(context)
.textTheme
.displayMedium!
.color,
color: theme(context).colorTextPrimary,
),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,7 @@ class _SettingsAWSProviderState extends State<SettingsAWSProvider> {
child: Text(
value,
style: TextStyle(
color: Theme.of(context)
.textTheme
.displayMedium!
.color,
color: theme(context).colorTextPrimary,
),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,7 @@ class _SettingsAWSSSOProviderState extends State<SettingsAWSSSOProvider> {
child: Text(
value,
style: TextStyle(
color: Theme.of(context)
.textTheme
.displayMedium!
.color,
color: theme(context).colorTextPrimary,
),
),
);
Expand Down Expand Up @@ -439,10 +436,7 @@ class _SettingsAWSSSOProviderState extends State<SettingsAWSSSOProvider> {
child: Text(
value,
style: TextStyle(
color: Theme.of(context)
.textTheme
.displayMedium!
.color,
color: theme(context).colorTextPrimary,
),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,7 @@ class _SettingsOIDCProviderState extends State<SettingsOIDCProvider> {
child: Text(
value,
style: TextStyle(
color: Theme.of(context)
.textTheme
.displayMedium!
.color,
color: theme(context).colorTextPrimary,
),
),
);
Expand Down
Loading

0 comments on commit fcbcfed

Please sign in to comment.