mirror of
https://codeberg.org/shroff/phylum.git
synced 2026-05-12 15:18:38 -05:00
[client] Pending change indicators on list items
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:phylum/libphylum/actions/action_resource.dart';
|
||||
import 'package:phylum/libphylum/db/db.dart';
|
||||
import 'package:phylum/libphylum/phylum_api_types.dart';
|
||||
import 'package:phylum/ui/explorer/resource_icon_extension.dart';
|
||||
import 'package:phylum/util/file_size.dart';
|
||||
import 'package:phylum/util/time.dart';
|
||||
@@ -8,16 +10,18 @@ import 'package:provider/provider.dart';
|
||||
import '../../libphylum/explorer/explorer_controller.dart';
|
||||
|
||||
class ResourceDetailsRow extends StatelessWidget {
|
||||
final Resource r;
|
||||
final Resource resource;
|
||||
final bool dropTargetActive;
|
||||
|
||||
ResourceDetailsRow({required this.r, required this.dropTargetActive}) : super(key: ValueKey(r.id));
|
||||
ResourceDetailsRow({required this.resource, required this.dropTargetActive}) : super(key: ValueKey(resource.id));
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final showBorder = context.select<ExplorerState, bool>((state) => state.focusId == r.id && state.showFocus);
|
||||
final highlight = context.select<ExplorerState, bool>((state) => state.isSelected(r.id));
|
||||
final dim = context.select<ExplorerState, bool>((state) => state.isSelected(r.id) && state.dragging);
|
||||
final showBorder = context.select<ExplorerState, bool>((state) => state.focusId == resource.id && state.showFocus);
|
||||
final highlight = context.select<ExplorerState, bool>((state) => state.isSelected(resource.id));
|
||||
final dim = context.select<ExplorerState, bool>((state) => state.isSelected(resource.id) && state.dragging);
|
||||
final hasChanges = context.select<PhylumActionQueueState, bool>(
|
||||
(state) => state.actions.any((action) => action is ResourceAction && action.resourceId == resource.id));
|
||||
final theme = Theme.of(context);
|
||||
final colorScheme = theme.colorScheme;
|
||||
final border = dropTargetActive
|
||||
@@ -26,14 +30,14 @@ class ResourceDetailsRow extends StatelessWidget {
|
||||
? BorderSide(color: colorScheme.primary, width: 2.0)
|
||||
: const BorderSide(color: Colors.transparent, width: 2.0);
|
||||
String subtitle = "";
|
||||
if (r.modified != null) {
|
||||
subtitle = r.modified!.formatForDisplay();
|
||||
if (resource.modified != null) {
|
||||
subtitle = resource.modified!.formatForDisplay();
|
||||
}
|
||||
if (!r.dir) {
|
||||
if (!resource.dir) {
|
||||
if (subtitle.isNotEmpty) {
|
||||
subtitle += " \u2022 ";
|
||||
}
|
||||
subtitle += r.contentLength.formatForDisplay();
|
||||
subtitle += resource.contentLength.formatForDisplay();
|
||||
}
|
||||
final color = highlight
|
||||
? dim
|
||||
@@ -58,13 +62,13 @@ class ResourceDetailsRow extends StatelessWidget {
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 9.0, horizontal: 16),
|
||||
child: r.getIcon(),
|
||||
child: resource.getIcon(),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
r.name,
|
||||
resource.name,
|
||||
maxLines: 1,
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.fade,
|
||||
@@ -76,35 +80,39 @@ class ResourceDetailsRow extends StatelessWidget {
|
||||
: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
if (subtitle.isNotEmpty)
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
if (r.permissions != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 6.0),
|
||||
child: Icon(Icons.people_alt, size: 14),
|
||||
),
|
||||
if (r.publinks != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 6.0),
|
||||
child: Icon(Icons.public, size: 14),
|
||||
),
|
||||
Text(
|
||||
subtitle,
|
||||
maxLines: 1,
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.fade,
|
||||
style: theme.textTheme.bodyMedium!.copyWith(
|
||||
color: highlight
|
||||
? dim
|
||||
? colorScheme.primary.withAlpha(192)
|
||||
: colorScheme.primary
|
||||
: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
if (hasChanges)
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(right: 6.0),
|
||||
child: Icon(Icons.sync, size: 14),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (resource.permissions != null)
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(right: 6.0),
|
||||
child: Icon(Icons.people_alt, size: 14),
|
||||
),
|
||||
if (resource.publinks != null)
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(right: 6.0),
|
||||
child: Icon(Icons.public, size: 14),
|
||||
),
|
||||
Text(
|
||||
subtitle,
|
||||
maxLines: 1,
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.fade,
|
||||
style: theme.textTheme.bodyMedium!.copyWith(
|
||||
color: highlight
|
||||
? dim
|
||||
? colorScheme.primary.withAlpha(192)
|
||||
: colorScheme.primary
|
||||
: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -202,7 +202,7 @@ class ResourceDraggable extends StatelessWidget {
|
||||
);
|
||||
}),
|
||||
child: ResourceDetailsRow(
|
||||
r: resource,
|
||||
resource: resource,
|
||||
dropTargetActive: dropTargetActive,
|
||||
),
|
||||
);
|
||||
|
||||
+5
-3
@@ -616,9 +616,11 @@ packages:
|
||||
offtheline:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "../../offtheline"
|
||||
relative: true
|
||||
source: path
|
||||
path: "."
|
||||
ref: b25d6ded81b50e72cb24df9ab2d288f2c41f969b
|
||||
resolved-ref: b25d6ded81b50e72cb24df9ab2d288f2c41f969b
|
||||
url: "https://codeberg.org/shroff/offtheline.git"
|
||||
source: git
|
||||
version: "0.16.0"
|
||||
open_file:
|
||||
dependency: "direct main"
|
||||
|
||||
+1
-5
@@ -24,7 +24,7 @@ dependencies:
|
||||
offtheline:
|
||||
git:
|
||||
url: https://codeberg.org/shroff/offtheline.git
|
||||
ref: b26c970813893fef5de721b9e140cfaeec2a6cb1
|
||||
ref: b25d6ded81b50e72cb24df9ab2d288f2c41f969b
|
||||
open_file:
|
||||
path:
|
||||
path_provider:
|
||||
@@ -44,9 +44,5 @@ dev_dependencies:
|
||||
drift_dev: ^2.19.1
|
||||
build_runner: ^2.4.12
|
||||
|
||||
dependency_overrides:
|
||||
offtheline:
|
||||
path: ../../offtheline
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
Reference in New Issue
Block a user