fApp/lib/widgets/end_drawer.dart
Flummi 089fe1f8df
All checks were successful
Flutter Schmutter / build (push) Successful in 3m50s
v1.3.2+58
2025-06-16 19:10:00 +02:00

132 lines
4.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:f0ckapp/screens/settings_screen.dart';
import 'package:f0ckapp/controller/theme_controller.dart';
import 'package:f0ckapp/utils/appversion.dart';
class EndDrawer extends StatelessWidget {
const EndDrawer({super.key});
void _showMsg(String message, BuildContext context) {
ScaffoldMessenger.of(context)
..removeCurrentSnackBar()
..showSnackBar(SnackBar(content: Text(message)));
}
@override
Widget build(BuildContext context) {
final ThemeController themeController = Get.find();
return Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
DrawerHeader(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/menu.webp'),
fit: BoxFit.cover,
alignment: Alignment.topCenter,
),
),
child: null,
),
/*ExpansionTile(
title: const Text('Login'),
children: [
Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
TextField(
readOnly: true,
controller: _usernameController,
decoration: const InputDecoration(
labelText: 'Benutzername',
),
),
const SizedBox(height: 10),
TextField(
readOnly: true,
controller: _passwordController,
obscureText: true,
decoration: const InputDecoration(
labelText: 'Passwort',
),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () async {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text("noch nicht implementiert lol"),
),
final success = await login(
_usernameController.text,
_passwordController.text,
);
if (success) {
Navigator.pop(context);
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Login fehlgeschlagen!")),
);
}
);
},
child: const Text('Login'),
),
],
),
),
],
),*/
ExpansionTile(
title: const Text('Theme'),
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Obx(() {
return Column(
children: themeController.themeMap.entries.map((entry) {
final String themeName = entry.key;
final ThemeData themeData = entry.value;
final bool isSelected =
themeController.currentTheme.value == themeData;
return ListTile(
title: Text(themeName),
selected: isSelected,
selectedTileColor: Colors.blue.withValues(alpha: 0.2),
onTap: () async {
await themeController.updateTheme(themeName);
},
);
}).toList(),
);
}),
),
],
),
ListTile(
title: const Text('Settings'),
onTap: () {
Navigator.pop(context);
Get.bottomSheet(SettingsPage());
},
),
ListTile(
title: Text('v${AppVersion.version}'),
onTap: () {
Navigator.pop(context);
_showMsg('jooong lass das, hier ist nichts', context);
},
),
],
),
);
}
}