fApp/lib/screens/settings_screen.dart
Flummi 14081489cc
All checks were successful
Flutter Schmutter / build (push) Successful in 3m54s
v1.3.0+56
2025-06-16 15:05:39 +02:00

127 lines
4.5 KiB
Dart

import 'package:f0ckapp/utils/animatedtransition.dart';
import 'package:flutter/material.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:get/get.dart';
import 'package:f0ckapp/controller/media_controller.dart';
class SettingsPage extends StatefulWidget {
const SettingsPage({super.key});
@override
State<StatefulWidget> createState() => _SettingsPageState();
}
class _SettingsPageState extends State<SettingsPage> {
final MediaController controller = Get.find<MediaController>();
@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
slivers: [
SliverAppBar(
floating: false,
pinned: true,
title: const Text('Settings'),
),
SliverList(
delegate: SliverChildListDelegate([
ListTile(
title: const Text("Spaltenanzahl"),
trailing: Obx(
() => DropdownButton<int>(
value: controller.crossAxisCount.value,
dropdownColor: const Color.fromARGB(255, 43, 43, 43),
iconEnabledColor: Colors.white,
items: [0, 3, 4, 5].map((int value) {
return DropdownMenuItem<int>(
value: value,
child: Text(value == 0 ? 'auto' : '$value Spalten'),
);
}).toList(),
onChanged: (int? newValue) async {
if (newValue != null) {
await controller.setCrossAxisCount(newValue);
setState(() {});
}
},
),
),
),
const Divider(),
ListTile(
title: const Text("Seitenwechselanimation"),
trailing: Obx(
() => DropdownButton<PageTransition>(
value: controller.transitionType.value,
dropdownColor: const Color.fromARGB(255, 43, 43, 43),
iconEnabledColor: Colors.white,
items: PageTransition.values.map((PageTransition type) {
String label;
switch (type) {
case PageTransition.opacity:
label = 'Opacity';
break;
case PageTransition.scale:
label = 'Scale';
break;
case PageTransition.slide:
label = 'Slide';
break;
case PageTransition.rotate:
label = 'Rotate';
break;
case PageTransition.flip:
label = 'Flip';
break;
}
return DropdownMenuItem<PageTransition>(
value: type,
child: Text(label),
);
}).toList(),
onChanged: (PageTransition? newValue) async {
if (newValue != null) {
await controller.setTransitionType(newValue);
setState(() {});
}
},
),
),
),
const Divider(),
SwitchListTile(
title: const Text("Drawer per Geste öffnen"),
subtitle: const Text(
"Wähle, ob der Drawer mit einer Wischgeste geschlossen/ geöffnet werden kann.",
),
value: controller.drawerSwipeEnabled.value,
onChanged: (bool value) async {
await controller.setDrawerSwipeEnabled(value);
setState(() {});
},
),
const Divider(),
ListTile(
title: Text("Cache löschen"),
trailing: ElevatedButton(
onPressed: () async {
await DefaultCacheManager().emptyCache();
if (!mounted) return;
Get.snackbar('', 'der Cache wurde geleert.');
},
child: const Text("Löschen"),
),
),
const SizedBox(height: 20),
]),
),
],
),
);
}
}