refactor
This commit is contained in:
parent
00b2e5fa31
commit
6e886a6276
1 changed files with 7 additions and 9 deletions
|
|
@ -1,5 +1,3 @@
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:mangayomi/modules/more/settings/appearance/appearance_screen.dart';
|
import 'package:mangayomi/modules/more/settings/appearance/appearance_screen.dart';
|
||||||
|
|
@ -21,15 +19,15 @@ class _CustomNavigationSettingsState
|
||||||
final l10n = context.l10n;
|
final l10n = context.l10n;
|
||||||
final navigationOrder = ref.watch(navigationOrderStateProvider);
|
final navigationOrder = ref.watch(navigationOrderStateProvider);
|
||||||
final hideItems = ref.watch(hideItemsStateProvider);
|
final hideItems = ref.watch(hideItemsStateProvider);
|
||||||
final isMobile = Platform.isAndroid || Platform.isIOS;
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(l10n.reorder_navigation),
|
title: Text(l10n.reorder_navigation),
|
||||||
),
|
),
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||||
child: ReorderableListView.builder(
|
child: ReorderableListView.builder(
|
||||||
|
buildDefaultDragHandles: false,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: navigationOrder.length,
|
itemCount: navigationOrder.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
|
|
@ -37,14 +35,14 @@ class _CustomNavigationSettingsState
|
||||||
return Row(
|
return Row(
|
||||||
key: Key('navigation_$navigation'),
|
key: Key('navigation_$navigation'),
|
||||||
children: [
|
children: [
|
||||||
if (isMobile) Icon(Icons.drag_handle),
|
ReorderableDragStartListener(
|
||||||
|
index: index,
|
||||||
|
child: const Icon(Icons.drag_handle),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SwitchListTile.adaptive(
|
child: SwitchListTile(
|
||||||
key: Key(navigation),
|
key: Key(navigation),
|
||||||
dense: true,
|
dense: true,
|
||||||
contentPadding: isMobile
|
|
||||||
? null
|
|
||||||
: const EdgeInsets.only(left: 0, right: 40),
|
|
||||||
value: !hideItems.contains(navigation),
|
value: !hideItems.contains(navigation),
|
||||||
onChanged: ["/more", "/browse", "/history"]
|
onChanged: ["/more", "/browse", "/history"]
|
||||||
.any((element) => element == navigation)
|
.any((element) => element == navigation)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue