Release RuleGel 1.0.1 with Realbooru

This commit is contained in:
2026-05-25 14:33:59 +03:00
parent 16e86fb9d5
commit ea39cf8567
28 changed files with 1217 additions and 263 deletions
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import '../../../backend/models/collection.dart';
import '../../../shared/widgets/adaptive_scaffold.dart';
import '../../../shared/widgets/confirm_dialog.dart';
import '../../../shared/widgets/empty_view.dart';
@@ -40,55 +41,26 @@ class CollectionsScreen extends ConsumerWidget {
itemCount: items.length,
itemBuilder: (context, index) {
final item = items[index];
return Card(
clipBehavior: Clip.antiAlias,
child: InkWell(
onTap: () => context.go('/collections/${item.id}'),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Icon(Icons.collections_bookmark_rounded,
size: 32),
const Spacer(),
Text(item.name,
style: Theme.of(context).textTheme.titleLarge),
Text(item.description ?? ''),
Row(
children: [
IconButton(
tooltip: 'Edit',
onPressed: () => showCollectionFormDialog(
context,
ref,
collection: item,
),
icon: const Icon(Icons.edit_rounded),
),
IconButton(
tooltip: 'Delete',
onPressed: () async {
final ok = await showConfirmDialog(
context,
title: 'Delete collection',
message: 'Remove ${item.name}?',
);
if (ok) {
await ref
.read(collectionsControllerProvider
.notifier)
.delete(item.id);
}
},
icon: const Icon(Icons.delete_rounded),
),
],
),
],
),
),
return _CollectionCard(
collection: item,
onOpen: () => context.go('/collections/${item.id}'),
onEdit: () => showCollectionFormDialog(
context,
ref,
collection: item,
),
onDelete: () async {
final ok = await showConfirmDialog(
context,
title: 'Delete collection',
message: 'Remove ${item.name}?',
);
if (ok) {
await ref
.read(collectionsControllerProvider.notifier)
.delete(item.id);
}
},
);
},
),
@@ -96,3 +68,108 @@ class CollectionsScreen extends ConsumerWidget {
);
}
}
class _CollectionCard extends StatelessWidget {
const _CollectionCard({
required this.collection,
required this.onOpen,
required this.onEdit,
required this.onDelete,
});
final Collection collection;
final VoidCallback onOpen;
final VoidCallback onEdit;
final VoidCallback onDelete;
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
return Card(
clipBehavior: Clip.antiAlias,
child: InkWell(
onTap: onOpen,
child: Stack(
children: [
Positioned.fill(
child: Padding(
padding: const EdgeInsets.fromLTRB(16, 16, 16, 14),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 54,
child: Align(
alignment: Alignment.centerLeft,
child: DecoratedBox(
decoration: BoxDecoration(
color:
scheme.primaryContainer.withValues(alpha: 0.56),
borderRadius: BorderRadius.circular(12),
),
child: const Padding(
padding: EdgeInsets.all(12),
child: Icon(
Icons.collections_bookmark_rounded,
size: 28,
),
),
),
),
),
const Spacer(),
Text(
collection.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 4),
Text(
collection.description ?? 'No description',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: scheme.onSurfaceVariant,
),
),
],
),
),
),
Positioned(
top: 6,
right: 6,
child: PopupMenuButton<String>(
tooltip: 'Collection actions',
icon: const Icon(Icons.more_horiz_rounded),
onSelected: (value) {
if (value == 'edit') onEdit();
if (value == 'delete') onDelete();
},
itemBuilder: (context) => const [
PopupMenuItem(
value: 'edit',
child: ListTile(
dense: true,
leading: Icon(Icons.edit_rounded),
title: Text('Edit'),
),
),
PopupMenuItem(
value: 'delete',
child: ListTile(
dense: true,
leading: Icon(Icons.delete_rounded),
title: Text('Delete'),
),
),
],
),
),
],
),
),
);
}
}