Browse Source

neon, neon_files, neon_notes: use NcColors

pull/461/head
Nikolas Rimikis 1 year ago
parent
commit
b995818a0d
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 18
      packages/neon/neon/lib/src/theme/colors.dart
  2. 5
      packages/neon/neon/lib/src/utils/confirmation_dialog.dart
  3. 4
      packages/neon/neon/lib/src/widgets/image_wrapper.dart
  4. 1
      packages/neon/neon/lib/theme.dart
  5. 1
      packages/neon/neon_files/lib/neon_files.dart
  6. 2
      packages/neon/neon_files/lib/widgets/browser_view.dart
  7. 1
      packages/neon/neon_files/lib/widgets/file_preview.dart
  8. 1
      packages/neon/neon_news/lib/widgets/feed_icon.dart

18
packages/neon/neon/lib/src/theme/colors.dart

@ -1,6 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:meta/meta.dart';
import 'package:nextcloud/nextcloud.dart'; import 'package:nextcloud/nextcloud.dart';
/// [Color] constants which represent Nextcloud's /// [Color] constants which represent Nextcloud's
@ -16,10 +14,24 @@ abstract final class NcColors {
/// ///
/// This color is only used at the users discretion. /// This color is only used at the users discretion.
static const Color oledBackground = Colors.black; static const Color oledBackground = Colors.black;
/// Color of a starred item.
static const Color starredColor = Colors.yellow;
/// Color used to emphasise declining actions.
///
/// Usually used in conjunction with [NcColors.accept].
static const Color decline = Colors.red;
/// Color used to emphasise accepting actions.
///
/// Usually used in conjunction with [NcColors.decline].
static const Color accept = Colors.green;
} }
@internal /// [UserStatusType] color mapping.
extension UserStatusTypeColors on UserStatusType { extension UserStatusTypeColors on UserStatusType {
/// The color for the user status.
Color? get color => switch (this) { Color? get color => switch (this) {
UserStatusType.online => const Color(0xFF49B382), UserStatusType.online => const Color(0xFF49B382),
UserStatusType.away => const Color(0xFFF4A331), UserStatusType.away => const Color(0xFFF4A331),

5
packages/neon/neon/lib/src/utils/confirmation_dialog.dart

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:neon/l10n/localizations.dart'; import 'package:neon/l10n/localizations.dart';
import 'package:neon/theme.dart';
Future<bool> showConfirmationDialog(final BuildContext context, final String title) async => Future<bool> showConfirmationDialog(final BuildContext context, final String title) async =>
await showDialog<bool>( await showDialog<bool>(
@ -10,7 +11,7 @@ Future<bool> showConfirmationDialog(final BuildContext context, final String tit
actions: [ actions: [
ElevatedButton( ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: Colors.red, backgroundColor: NcColors.decline,
foregroundColor: Theme.of(context).colorScheme.onPrimary, foregroundColor: Theme.of(context).colorScheme.onPrimary,
), ),
onPressed: () { onPressed: () {
@ -20,7 +21,7 @@ Future<bool> showConfirmationDialog(final BuildContext context, final String tit
), ),
ElevatedButton( ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: Colors.green, backgroundColor: NcColors.accept,
foregroundColor: Theme.of(context).colorScheme.onPrimary, foregroundColor: Theme.of(context).colorScheme.onPrimary,
), ),
onPressed: () { onPressed: () {

4
packages/neon/neon/lib/src/widgets/image_wrapper.dart

@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
class NeonImageWrapper extends StatelessWidget { class NeonImageWrapper extends StatelessWidget {
const NeonImageWrapper({ const NeonImageWrapper({
required this.child, required this.child,
required this.color, this.color = Colors.white,
this.size, this.size,
this.borderRadius, this.borderRadius,
super.key, super.key,
@ -16,7 +16,7 @@ class NeonImageWrapper extends StatelessWidget {
@override @override
Widget build(final BuildContext context) => ClipRRect( Widget build(final BuildContext context) => ClipRRect(
borderRadius: borderRadius ?? BorderRadius.zero, borderRadius: borderRadius,
child: ColorFiltered( child: ColorFiltered(
colorFilter: ColorFilter.mode(color, BlendMode.dstATop), colorFilter: ColorFilter.mode(color, BlendMode.dstATop),
child: SizedBox.fromSize( child: SizedBox.fromSize(

1
packages/neon/neon/lib/theme.dart

@ -1,4 +1,5 @@
export 'src/theme/branding.dart'; export 'src/theme/branding.dart';
export 'src/theme/color_scheme.dart'; export 'src/theme/color_scheme.dart';
export 'src/theme/colors.dart';
export 'src/theme/dialog.dart'; export 'src/theme/dialog.dart';
export 'src/theme/neon.dart'; export 'src/theme/neon.dart';

1
packages/neon/neon_files/lib/neon_files.dart

@ -17,6 +17,7 @@ import 'package:neon/models.dart';
import 'package:neon/platform.dart'; import 'package:neon/platform.dart';
import 'package:neon/settings.dart'; import 'package:neon/settings.dart';
import 'package:neon/sort_box.dart'; import 'package:neon/sort_box.dart';
import 'package:neon/theme.dart';
import 'package:neon/utils.dart'; import 'package:neon/utils.dart';
import 'package:neon/widgets.dart'; import 'package:neon/widgets.dart';
import 'package:neon_files/l10n/localizations.dart'; import 'package:neon_files/l10n/localizations.dart';

2
packages/neon/neon_files/lib/widgets/browser_view.dart

@ -283,7 +283,7 @@ class _FilesBrowserViewState extends State<FilesBrowserView> {
child: Icon( child: Icon(
Icons.star, Icons.star,
size: 14, size: 14,
color: Colors.yellow, color: NcColors.starredColor,
), ),
), ),
], ],

1
packages/neon/neon_files/lib/widgets/file_preview.dart

@ -49,7 +49,6 @@ class FilePreview extends StatelessWidget {
); );
if (withBackground) { if (withBackground) {
return NeonImageWrapper( return NeonImageWrapper(
color: Colors.white,
borderRadius: borderRadius, borderRadius: borderRadius,
child: child, child: child,
); );

1
packages/neon/neon_news/lib/widgets/feed_icon.dart

@ -17,7 +17,6 @@ class NewsFeedIcon extends StatelessWidget {
final faviconLink = feed.faviconLink; final faviconLink = feed.faviconLink;
return NeonImageWrapper( return NeonImageWrapper(
color: Colors.white,
size: Size.square(size), size: Size.square(size),
borderRadius: borderRadius, borderRadius: borderRadius,
child: faviconLink != null && faviconLink.isNotEmpty child: faviconLink != null && faviconLink.isNotEmpty

Loading…
Cancel
Save