mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
#54 fix order
This commit is contained in:
@@ -120,7 +120,9 @@ class _SnippetEditPageState extends State<SnippetEditPage>
|
||||
}),
|
||||
s: _s,
|
||||
tagSuggestions: [..._provider.tags],
|
||||
onRenameTag: _provider.renameTag,
|
||||
onRenameTag: (old, n) => setState(() {
|
||||
_provider.renameTag(old, n);
|
||||
}),
|
||||
)
|
||||
],
|
||||
);
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:provider/provider.dart';
|
||||
import 'package:toolbox/core/extension/order.dart';
|
||||
import 'package:toolbox/data/model/server/server.dart';
|
||||
import 'package:toolbox/data/provider/server.dart';
|
||||
import 'package:toolbox/data/res/ui.dart';
|
||||
import 'package:toolbox/view/widget/tag/switcher.dart';
|
||||
|
||||
import '../../../core/utils/misc.dart';
|
||||
@@ -71,9 +72,10 @@ class _SnippetListPageState extends State<SnippetListPage> {
|
||||
padding: const EdgeInsets.all(13),
|
||||
itemCount: filtered.length,
|
||||
onReorder: (oldIdx, newIdx) => setState(() {
|
||||
provider.snippets.moveById(
|
||||
filtered[oldIdx],
|
||||
filtered[newIdx],
|
||||
provider.snippets.moveByItem(
|
||||
filtered,
|
||||
oldIdx,
|
||||
newIdx,
|
||||
onMove: (p0) {
|
||||
_settingStore.snippetOrder.put(p0.map((e) => e.name).toList());
|
||||
},
|
||||
@@ -87,7 +89,7 @@ class _SnippetListPageState extends State<SnippetListPage> {
|
||||
width: _media.size.width,
|
||||
),
|
||||
itemBuilder: (context, idx) {
|
||||
final snippet = filtered[idx];
|
||||
final snippet = filtered.elementAt(idx);
|
||||
return RoundRectCard(
|
||||
ListTile(
|
||||
contentPadding: const EdgeInsets.only(left: 23, right: 17),
|
||||
@@ -96,6 +98,12 @@ class _SnippetListPageState extends State<SnippetListPage> {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
),
|
||||
subtitle: Text(
|
||||
snippet.script,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
style: grey,
|
||||
),
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
|
||||
Reference in New Issue
Block a user