Skip to content

Commit

Permalink
Merge pull request #521 from ErBWs/mod-plugin-view
Browse files Browse the repository at this point in the history
modify plugin view page
  • Loading branch information
Predidit authored Dec 27, 2024
2 parents bcf3ae7 + 6d17c3a commit e7e78fa
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion lib/pages/plugin_editor/plugin_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ class PluginViewPage extends StatefulWidget {

class _PluginViewPageState extends State<PluginViewPage> {
final PluginsController pluginsController = Modular.get<PluginsController>();

// 是否处于多选模式
bool isMultiSelectMode = false;

// 已选中的规则名称集合
final Set<String> selectedNames = {};

// 排序方式状态:false=按安装时间排序,true=按名称排序
bool sortByName = false;

Expand Down Expand Up @@ -265,6 +268,8 @@ class _PluginViewPageState extends State<PluginViewPage> {
return Card(
margin: const EdgeInsets.fromLTRB(8, 0, 8, 8),
child: ListTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)),
onLongPress: () {
if (!isMultiSelectMode) {
setState(() {
Expand Down Expand Up @@ -300,9 +305,31 @@ class _PluginViewPageState extends State<PluginViewPage> {
Row(
children: [
Text(
'Version: ${plugin.version}${canUpdate ? ' (可更新)' : ''}',
'Version: ${plugin.version}',
style: const TextStyle(color: Colors.grey),
),
if (canUpdate) ...[
const SizedBox(width: 8),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 6, vertical: 2),
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.errorContainer,
borderRadius: BorderRadius.circular(4),
),
child: Text(
'可更新',
style: TextStyle(
fontSize: 12,
color: Theme.of(context)
.colorScheme
.onErrorContainer,
),
),
),
],
if (pluginsController.validityTracker
.isSearchValid(plugin.name)) ...[
const SizedBox(width: 8),
Expand Down

0 comments on commit e7e78fa

Please sign in to comment.