2024-04-30 19:25:16 +02:00
|
|
|
import 'package:cofounderella/themes/theme_provider.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
2024-04-29 17:11:35 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2024-04-30 19:25:16 +02:00
|
|
|
import 'package:provider/provider.dart';
|
2024-04-29 17:11:35 +02:00
|
|
|
|
2024-08-16 13:55:11 +02:00
|
|
|
import '../settings/settings_provider.dart';
|
|
|
|
|
2024-04-29 17:11:35 +02:00
|
|
|
class SettingsPage extends StatelessWidget {
|
|
|
|
const SettingsPage({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
2024-06-03 23:22:43 +02:00
|
|
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
2024-04-29 17:11:35 +02:00
|
|
|
appBar: AppBar(
|
|
|
|
title: const Text("Settings"),
|
|
|
|
),
|
2024-08-16 13:55:11 +02:00
|
|
|
body: SingleChildScrollView(
|
|
|
|
child: Column(
|
2024-04-30 19:25:16 +02:00
|
|
|
children: [
|
2024-08-16 13:55:11 +02:00
|
|
|
Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Theme.of(context).colorScheme.secondaryContainer,
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
),
|
|
|
|
margin: const EdgeInsets.all(16),
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
// dark mode switch
|
|
|
|
const Text("Dark Mode"),
|
|
|
|
Consumer<ThemeProvider>(
|
|
|
|
builder: (context, themeProvider, child) {
|
|
|
|
return CupertinoSwitch(
|
|
|
|
value: themeProvider.isDarkMode,
|
|
|
|
onChanged: (value) {
|
|
|
|
themeProvider.toggleTheme();
|
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Theme.of(context).colorScheme.secondaryContainer,
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
),
|
|
|
|
margin: const EdgeInsets.all(16),
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
child: Consumer<SettingsProvider>(
|
|
|
|
builder: (context, settingsProvider, child) {
|
|
|
|
return Padding(
|
|
|
|
padding: const EdgeInsets.all(0.0),
|
|
|
|
child: Column(
|
|
|
|
children: settingsProvider.settingsOptions.map((option) {
|
|
|
|
return SwitchListTile(
|
|
|
|
title: Text(option.title),
|
|
|
|
subtitle: (option.subtitle.isNotEmpty
|
|
|
|
? Text(option.subtitle)
|
|
|
|
: null),
|
|
|
|
value: option.getValue(),
|
|
|
|
onChanged: option.onChanged,
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
);
|
|
|
|
}).toList(),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
2024-04-30 19:25:16 +02:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
2024-04-29 17:11:35 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|