Prioritize larger mods

This commit is contained in:
2025-03-15 23:17:21 +01:00
parent 7e4bee3482
commit 74eec3f3cc
2 changed files with 140 additions and 49 deletions

View File

@@ -292,7 +292,7 @@ class _LoadOrderPageState extends State<LoadOrderPage> {
),
const SizedBox(height: 16),
Text(
'Automatically sort mods based on dependencies.',
'Automatically sort mods based on dependencies, prioritizing larger mods.',
style: Theme.of(context).textTheme.bodyLarge,
),
const SizedBox(height: 24),
@@ -302,6 +302,14 @@ class _LoadOrderPageState extends State<LoadOrderPage> {
onPressed: _isLoading ? null : _sortMods,
child: const Text('Auto-sort Mods'),
),
const SizedBox(width: 8),
Chip(
backgroundColor: Colors.amber.withOpacity(0.2),
label: const Text(
'Larger mods prioritized',
style: TextStyle(fontSize: 12),
),
),
const SizedBox(width: 16),
ElevatedButton(
onPressed: _isLoading || _sortedMods.isEmpty ? null : _saveModOrder,
@@ -355,6 +363,45 @@ class _LoadOrderPageState extends State<LoadOrderPage> {
),
),
const SizedBox(height: 16),
if (_sortedMods.isNotEmpty)
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.grey.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text('Legend:', style: TextStyle(fontWeight: FontWeight.bold)),
const SizedBox(height: 4),
Row(
children: [
Icon(Icons.link, color: Colors.orange, size: 16),
const SizedBox(width: 4),
Text('Hard dependencies', style: TextStyle(fontSize: 12)),
const SizedBox(width: 12),
Icon(Icons.link_off, color: Colors.blue, size: 16),
const SizedBox(width: 4),
Text('Soft dependencies', style: TextStyle(fontSize: 12)),
],
),
const SizedBox(height: 4),
Row(
children: [
Container(width: 12, height: 12, color: Colors.amber),
const SizedBox(width: 4),
Text('Very large mod (>1000 files)', style: TextStyle(fontSize: 12)),
const SizedBox(width: 12),
Container(width: 12, height: 12, color: Colors.yellow.shade600),
const SizedBox(width: 4),
Text('Large mod (>500 files)', style: TextStyle(fontSize: 12)),
],
),
],
),
),
Expanded(
child: _sortedMods.isEmpty
? Center(
@@ -370,23 +417,53 @@ class _LoadOrderPageState extends State<LoadOrderPage> {
return Card(
margin: const EdgeInsets.symmetric(vertical: 4),
child: ListTile(
leading: Text('${index + 1}'),
leading: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('${index + 1}'),
const SizedBox(height: 2),
if (mod.size > 0) Text('${mod.size}', style: TextStyle(fontSize: 10, color: Colors.grey)),
],
),
title: Text(mod.name),
subtitle: Text(mod.id),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(mod.id, style: TextStyle(fontSize: 10)),
if (mod.hardDependencies.isNotEmpty)
Text(
'Hard dependencies: ${mod.hardDependencies.length}',
style: TextStyle(fontSize: 10, color: Colors.orange),
),
if (mod.softDependencies.isNotEmpty)
Text(
'Soft dependencies: ${mod.softDependencies.length}',
style: TextStyle(fontSize: 10, color: Colors.blue),
),
],
),
isThreeLine: mod.hardDependencies.isNotEmpty || mod.softDependencies.isNotEmpty,
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (mod.hardDependencies.isNotEmpty)
Tooltip(
message: 'Hard dependencies: ${mod.hardDependencies.length}',
child: Icon(Icons.link, color: Colors.orange, size: 16),
),
Icon(Icons.link, color: Colors.orange, size: 16),
const SizedBox(width: 4),
if (mod.softDependencies.isNotEmpty)
Tooltip(
message: 'Soft dependencies: ${mod.softDependencies.length}',
child: Icon(Icons.link_off, color: Colors.blue, size: 16),
Icon(Icons.link_off, color: Colors.blue, size: 16),
const SizedBox(width: 4),
Text(
'${mod.size} files',
style: TextStyle(
fontSize: 12,
fontWeight: mod.size > 1000 ? FontWeight.bold : FontWeight.normal,
color: mod.size > 1000
? Colors.amber
: mod.size > 500
? Colors.yellow.shade600
: Colors.grey,
),
),
],
),
),