Skip to content

Commit ba62085

Browse files
authored
Create general_settings.dart
1 parent 8dede07 commit ba62085

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:shared_preferences/shared_preferences.dart';
3+
4+
class GeneralSettings extends StatefulWidget {
5+
const GeneralSettings({super.key});
6+
7+
@override
8+
State<GeneralSettings> createState() => _GeneralSettingsState();
9+
}
10+
11+
class _GeneralSettingsState extends State<GeneralSettings> {
12+
String _currentTheme = 'System';
13+
14+
@override
15+
Widget build(BuildContext context) {
16+
return Scaffold(
17+
appBar: AppBar(
18+
title: const Text('General', style: TextStyle(fontWeight: FontWeight.w300)),
19+
),
20+
body: ListView(
21+
children: [
22+
ListTile(
23+
title: const Text('Accent color'),
24+
subtitle: const Text('Change app\'s accent color.'),
25+
onTap: () {}, // Kasnije dodajemo popup
26+
),
27+
ListTile(
28+
title: const Text('Theme'),
29+
subtitle: Text(_currentTheme),
30+
onTap: () => _showThemePicker(),
31+
),
32+
const ListTile(
33+
title: Text('Language'),
34+
subtitle: Text('Serbian (Placeholder)'),
35+
),
36+
],
37+
),
38+
);
39+
}
40+
41+
void _showThemePicker() {
42+
showDialog(
43+
context: context,
44+
builder: (context) => SimpleDialog(
45+
title: const Text('Choose theme'),
46+
children: ['System', 'Light', 'Dark', 'AMOLED'].map((t) {
47+
return SimpleDialogOption(
48+
onPressed: () {
49+
setState(() => _currentTheme = t);
50+
Navigator.pop(context);
51+
},
52+
child: Padding(
53+
padding: const EdgeInsets.symmetric(vertical: 8.0),
54+
child: Text(t),
55+
),
56+
);
57+
}).toList(),
58+
),
59+
);
60+
}
61+
}

0 commit comments

Comments
 (0)