opt.
- add help for ssh virt keys - rm unused lib
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:nil/nil.dart';
|
||||
import 'package:toolbox/core/extension/order.dart';
|
||||
import 'package:toolbox/core/utils/platform.dart';
|
||||
import 'package:toolbox/core/utils/ui.dart';
|
||||
import 'package:toolbox/data/model/ssh/virtual_key.dart';
|
||||
import 'package:toolbox/data/res/ui.dart';
|
||||
import 'package:toolbox/data/store/setting.dart';
|
||||
import 'package:toolbox/locator.dart';
|
||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||
|
||||
class SSHVirtKeySettingPage extends StatefulWidget {
|
||||
const SSHVirtKeySettingPage({Key? key}) : super(key: key);
|
||||
@@ -44,17 +45,18 @@ class _SSHVirtKeySettingPageState extends State<SSHVirtKeySettingPage> {
|
||||
final disabled = VirtKey.values.where((e) => !keys.contains(e)).toList();
|
||||
final allKeys = [...keys, ...disabled];
|
||||
return ReorderableListView.builder(
|
||||
padding: const EdgeInsets.fromLTRB(11, 3, 0, 3),
|
||||
padding: const EdgeInsets.all(7),
|
||||
itemBuilder: (_, idx) {
|
||||
final key = allKeys[idx];
|
||||
return ListTile(
|
||||
key: ValueKey(idx),
|
||||
title: _buildTitle(key),
|
||||
leading: _buildCheckBox(keys, key, idx, idx < keys.length),
|
||||
trailing: isDesktop
|
||||
? nil
|
||||
: const Icon(Icons.drag_handle, color: Colors.grey),
|
||||
);
|
||||
final help = key.help(_s);
|
||||
return RoundRectCard(
|
||||
key: ValueKey(idx),
|
||||
ListTile(
|
||||
title: _buildTitle(key),
|
||||
subtitle: help == null ? null : Text(help, style: grey),
|
||||
leading: _buildCheckBox(keys, key, idx, idx < keys.length),
|
||||
trailing: isDesktop ? null : const Icon(Icons.drag_handle),
|
||||
));
|
||||
},
|
||||
itemCount: allKeys.length,
|
||||
onReorder: (o, n) {
|
||||
@@ -70,12 +72,8 @@ class _SSHVirtKeySettingPageState extends State<SSHVirtKeySettingPage> {
|
||||
|
||||
Widget _buildTitle(VirtKey key) {
|
||||
return key.icon == null
|
||||
? Text(
|
||||
key.text,
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
? Text(key.text)
|
||||
: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(key.text),
|
||||
const SizedBox(width: 10),
|
||||
|
||||
Reference in New Issue
Block a user