2023-12-17 23:00:31 +01:00
|
|
|
import 'package:flutter/material.dart';
|
2024-01-01 18:31:10 +01:00
|
|
|
import 'package:go_router/go_router.dart';
|
2023-12-17 23:00:31 +01:00
|
|
|
|
2024-01-01 19:52:42 +01:00
|
|
|
import '../../utils/logic/PreferencesService.dart';
|
2023-12-17 23:00:31 +01:00
|
|
|
import '../../utils/widgets/BottomNavigationWidget.dart';
|
2024-01-01 18:31:10 +01:00
|
|
|
import 'widgets/CustomDivider.dart';
|
|
|
|
import 'widgets/SetPinPopup.dart';
|
|
|
|
import 'widgets/TextSwitchContainer.dart';
|
2023-12-17 23:00:31 +01:00
|
|
|
|
2024-01-01 19:52:42 +01:00
|
|
|
class SettingsPage extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
_SettingsPageState createState() => _SettingsPageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _SettingsPageState extends State<SettingsPage> {
|
|
|
|
bool isPinEnabled = false; // Default to false
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
_loadPinEnabledState();
|
|
|
|
}
|
|
|
|
|
|
|
|
void _loadPinEnabledState() async {
|
|
|
|
isPinEnabled = await PreferencesService().isPinEnabled();
|
|
|
|
print("isPinenabled2");
|
|
|
|
print(isPinEnabled);
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
2023-12-17 23:00:31 +01:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-12-20 17:24:18 +01:00
|
|
|
return Scaffold(
|
2024-01-01 18:31:10 +01:00
|
|
|
backgroundColor: Color(0xffeeeeee),
|
|
|
|
body: Container(
|
|
|
|
padding: EdgeInsets.only(bottom: 0),
|
|
|
|
margin: const EdgeInsets.fromLTRB(30, 30, 30, 0),
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
const SizedBox(
|
|
|
|
height: 100,
|
|
|
|
),
|
|
|
|
|
|
|
|
// Settings section
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
alignment: Alignment.topLeft,
|
|
|
|
child: Text('settings',
|
|
|
|
style:
|
|
|
|
TextStyle(fontWeight: FontWeight.w500, fontSize: 24)),
|
|
|
|
),
|
|
|
|
TextSwitchContainer(
|
|
|
|
leftText: "change color",
|
|
|
|
onTap: () => context.go("/color"),
|
|
|
|
),
|
|
|
|
CustomDivider(),
|
2024-01-01 19:52:42 +01:00
|
|
|
FutureBuilder<bool>(
|
|
|
|
future: PreferencesService().isPinEnabled(),
|
|
|
|
builder: (context, snapshot) {
|
|
|
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
|
|
|
return CircularProgressIndicator(); // or some other placeholder
|
|
|
|
}
|
|
|
|
bool pinEnabled =
|
|
|
|
snapshot.data ?? false; // Default to false if null
|
|
|
|
return TextSwitchContainer(
|
|
|
|
leftText: "pin",
|
|
|
|
hasSwitch: true,
|
|
|
|
onTap: () => {showSetPinPopup(context)},
|
|
|
|
onSwitchToggle: (value) {
|
|
|
|
if (value) {
|
|
|
|
PreferencesService().enablePin();
|
|
|
|
} else {
|
|
|
|
PreferencesService().disablePin();
|
|
|
|
}
|
|
|
|
// Consider updating the state here or using other state management
|
|
|
|
},
|
|
|
|
switchDefaultValue: pinEnabled,
|
|
|
|
);
|
|
|
|
},
|
2024-01-01 18:31:10 +01:00
|
|
|
),
|
|
|
|
CustomDivider(),
|
|
|
|
TextSwitchContainer(
|
|
|
|
leftText: "your data",
|
|
|
|
onTap: () => print('Container tapped'),
|
|
|
|
),
|
|
|
|
// Community section
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(0, 50, 0, 10),
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.topLeft,
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
child: Text('community',
|
|
|
|
style:
|
|
|
|
TextStyle(fontWeight: FontWeight.w500, fontSize: 24)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSwitchContainer(
|
|
|
|
leftText: "join our discord",
|
|
|
|
rightText: "fullfilled",
|
|
|
|
onTap: () => print('Container tapped'),
|
|
|
|
),
|
|
|
|
CustomDivider(),
|
|
|
|
TextSwitchContainer(
|
|
|
|
leftText: "our instagram",
|
|
|
|
rightText: "@get.fullfilled",
|
|
|
|
onTap: () => print('Container tapped'),
|
|
|
|
),
|
|
|
|
CustomDivider(),
|
|
|
|
TextSwitchContainer(
|
|
|
|
leftText: "share fullfilled with your loved ones",
|
|
|
|
onTap: () => print('Container tapped'),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.fromLTRB(0, 50, 0, 10),
|
|
|
|
child: Container(
|
|
|
|
alignment: Alignment.topLeft,
|
|
|
|
child: Text('humans behind fullfilled',
|
|
|
|
style:
|
|
|
|
TextStyle(fontWeight: FontWeight.w500, fontSize: 24)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSwitchContainer(
|
|
|
|
leftText: "about us",
|
|
|
|
onTap: () => print('Container tapped'),
|
|
|
|
),
|
|
|
|
CustomDivider(),
|
|
|
|
TextSwitchContainer(
|
|
|
|
leftText: "support us",
|
|
|
|
onTap: () => print('Container tapped'),
|
|
|
|
),
|
|
|
|
CustomDivider(),
|
|
|
|
TextSwitchContainer(
|
|
|
|
leftText: "give feedback",
|
|
|
|
onTap: () => print('Container tapped'),
|
|
|
|
),
|
|
|
|
//
|
|
|
|
ListTile(
|
|
|
|
title: Text('imprint & privacy policy',
|
|
|
|
style: TextStyle(color: Colors.grey, fontSize: 15)),
|
|
|
|
onTap: () => {}, // Implement your logic
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 150,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
2023-12-17 23:00:31 +01:00
|
|
|
),
|
2023-12-20 17:24:18 +01:00
|
|
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
2024-01-01 18:31:10 +01:00
|
|
|
floatingActionButton: CustomBottomNavigationBar(initialSelectedIndex: 2),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
void showSetPinPopup(BuildContext context) {
|
|
|
|
showDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return SetPinPopup();
|
|
|
|
},
|
2023-12-17 23:00:31 +01:00
|
|
|
);
|
|
|
|
}
|
2023-12-25 14:10:31 +01:00
|
|
|
}
|