Browse Source

neon: better utilize theme

pull/461/head
Nikolas Rimikis 1 year ago
parent
commit
adfd198be7
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 1
      packages/neon/neon/lib/src/pages/login.dart
  2. 1
      packages/neon/neon/lib/src/settings/widgets/settings_list.dart
  3. 13
      packages/neon/neon/lib/src/theme/colors.dart
  4. 5
      packages/neon/neon/lib/src/theme/theme.dart
  5. 1
      packages/neon/neon/lib/src/widgets/list_view.dart
  6. 10
      packages/neon/neon/lib/src/widgets/user_avatar.dart
  7. 1
      packages/neon/neon_files/lib/pages/details.dart

1
packages/neon/neon/lib/src/pages/login.dart

@ -61,7 +61,6 @@ class _LoginPageState extends State<LoginPage> {
child: ConstrainedBox(
constraints: NeonDialogTheme.of(context).constraints,
child: Scrollbar(
interactive: true,
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(vertical: 40, horizontal: 20),
primary: true,

1
packages/neon/neon/lib/src/settings/widgets/settings_list.dart

@ -14,7 +14,6 @@ class SettingsList extends StatelessWidget {
@override
Widget build(final BuildContext context) => Scrollbar(
interactive: true,
child: ListView(
primary: true,
padding: const EdgeInsets.all(20),

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

@ -1,5 +1,8 @@
import 'package:flutter/material.dart';
import 'package:meta/meta.dart';
import 'package:nextcloud/nextcloud.dart';
/// [Color] constants which represent Nextcloud's
/// [color palette](https://docs.nextcloud.com/server/latest/developer_manual/design/foundations.html#color).
abstract final class NcColors {
@ -14,3 +17,13 @@ abstract final class NcColors {
/// This color is only used at the users discretion.
static const Color oledBackground = Colors.black;
}
@internal
extension UserStatusTypeColors on UserStatusType {
Color? get color => switch (this) {
UserStatusType.online => const Color(0xFF49B382),
UserStatusType.away => const Color(0xFFF4A331),
UserStatusType.dnd => const Color(0xFFED484C),
_ => null,
};
}

5
packages/neon/neon/lib/src/theme/theme.dart

@ -47,6 +47,7 @@ class AppTheme {
cardColor: colorScheme.background, // For LicensePage
snackBarTheme: _snackBarTheme,
dividerTheme: _dividerTheme,
scrollbarTheme: _scrollbarTheme,
extensions: [
neonTheme,
...?appThemes,
@ -65,4 +66,8 @@ class AppTheme {
thickness: 1.5,
space: 30,
);
static const _scrollbarTheme = ScrollbarThemeData(
interactive: true,
);
}

1
packages/neon/neon/lib/src/widgets/list_view.dart

@ -41,7 +41,6 @@ class NeonListView<T> extends StatelessWidget {
),
Expanded(
child: Scrollbar(
interactive: true,
child: ListView(
primary: true,
key: scrollKey != null ? PageStorageKey<String>(scrollKey!) : null,

10
packages/neon/neon/lib/src/widgets/user_avatar.dart

@ -8,6 +8,7 @@ import 'package:neon/src/bloc/result.dart';
import 'package:neon/src/bloc/result_builder.dart';
import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/theme/colors.dart';
import 'package:neon/src/widgets/cached_image.dart';
import 'package:nextcloud/nextcloud.dart';
import 'package:provider/provider.dart';
@ -119,7 +120,7 @@ class _UserAvatarState extends State<NeonUserAvatar> {
} else if (result.hasData) {
decoration = BoxDecoration(
shape: BoxShape.circle,
color: _userStatusToColor(result.data!.status),
color: result.data!.status.color,
);
}
@ -136,11 +137,4 @@ class _UserAvatarState extends State<NeonUserAvatar> {
),
);
}
Color? _userStatusToColor(final UserStatusType userStatusType) => switch (userStatusType) {
UserStatusType.online => const Color(0xFF49B382),
UserStatusType.away => const Color(0xFFF4A331),
UserStatusType.dnd => const Color(0xFFED484C),
_ => null,
};
}

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

@ -17,7 +17,6 @@ class FilesDetailsPage extends StatelessWidget {
title: Text(details.name),
),
body: Scrollbar(
interactive: true,
child: ListView(
primary: true,
children: [

Loading…
Cancel
Save