25-9-1-1
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import 'package:Intaleq/controller/home/home_page_controller.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:Intaleq/views/lang/languages.dart';
|
||||
@@ -8,109 +7,207 @@ import 'HomePage/about_page.dart';
|
||||
import 'HomePage/frequentlyQuestionsPage.dart';
|
||||
import 'HomePage/share_app_page.dart';
|
||||
import 'HomePage/trip_record_page.dart';
|
||||
import 'profile/passenger_profile_page.dart';
|
||||
|
||||
// NOTE: This is a placeholder for your actual CountryPickerFromSetting widget.
|
||||
// You should remove this and import your own widget.
|
||||
class CountryPickerFromSetting extends StatelessWidget {
|
||||
const CountryPickerFromSetting({super.key});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text('Change Country'.tr)),
|
||||
body: Center(
|
||||
child: Text('Country Picker Page Placeholder'.tr),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SettingPage extends StatelessWidget {
|
||||
const SettingPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(HomePageController());
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: Text('Setting'.tr),
|
||||
leading: CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
child: const Icon(CupertinoIcons.back),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
// Using lazyPut to ensure the controller is available when needed.
|
||||
Get.lazyPut(() => HomePageController());
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor:
|
||||
const Color(0xFFF5F5F7), // A slightly off-white background
|
||||
appBar: AppBar(
|
||||
title: Text('Setting'.tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.black87, fontWeight: FontWeight.bold)),
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 0.5,
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black87),
|
||||
onPressed: () => Get.back(),
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
body: SafeArea(
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 20.0),
|
||||
children: [
|
||||
CupertinoListTile(
|
||||
onTap: () {
|
||||
Get.to(() => const Language());
|
||||
},
|
||||
leading: const Icon(CupertinoIcons.globe,
|
||||
color: CupertinoColors.activeBlue),
|
||||
title: Text('Language'.tr),
|
||||
subtitle: Text('To change Language the App'.tr),
|
||||
trailing: const CupertinoListTileChevron(),
|
||||
_buildSectionHeader('General'.tr),
|
||||
_buildSettingsCard(
|
||||
children: [
|
||||
_buildSettingsTile(
|
||||
icon: Icons.language,
|
||||
color: Colors.blue,
|
||||
title: 'Language'.tr,
|
||||
subtitle: 'To change Language the App'.tr,
|
||||
onTap: () => Get.to(() => const Language()),
|
||||
),
|
||||
// const Divider(height: 1, indent: 68, endIndent: 16),
|
||||
// _buildSettingsTile(
|
||||
// icon: Icons.map_outlined,
|
||||
// color: Colors.green,
|
||||
// title: 'Change Country'.tr,
|
||||
// subtitle: 'You can change the Country to get all features'.tr,
|
||||
// onTap: () => Get.to(() => const CountryPickerFromSetting()),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
CupertinoListTile(
|
||||
onTap: () {
|
||||
Get.to(() => CountryPickerFromSetting());
|
||||
},
|
||||
leading: const Icon(CupertinoIcons.location,
|
||||
color: CupertinoColors.activeBlue),
|
||||
title: Text('Change Country'.tr),
|
||||
subtitle:
|
||||
Text('You can change the Country to get all features'.tr),
|
||||
trailing: const CupertinoListTileChevron(),
|
||||
const SizedBox(height: 24),
|
||||
_buildSectionHeader('Preferences'.tr),
|
||||
_buildSettingsCard(
|
||||
children: [
|
||||
GetBuilder<HomePageController>(
|
||||
builder: (controller) {
|
||||
return _buildSettingsSwitchTile(
|
||||
icon: Icons.vibration,
|
||||
color: Colors.purple,
|
||||
title: 'Vibration'.tr,
|
||||
subtitle: 'Vibration feedback for all buttons'.tr,
|
||||
value: controller.isVibrate,
|
||||
onChanged: controller.changeVibrateOption,
|
||||
);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1, indent: 68, endIndent: 16),
|
||||
_buildSettingsTile(
|
||||
icon: Icons.mic_none,
|
||||
color: Colors.orange,
|
||||
title: 'Trips recorded'.tr,
|
||||
subtitle: 'Here recorded trips audio'.tr,
|
||||
onTap: () => Get.to(() => const TripsRecordedPage()),
|
||||
),
|
||||
],
|
||||
),
|
||||
CupertinoListTile(
|
||||
onTap: () {
|
||||
Get.to(() => const FrequentlyQuestionsPage());
|
||||
},
|
||||
leading: const Icon(CupertinoIcons.question,
|
||||
color: CupertinoColors.activeBlue),
|
||||
title: Text('Frequently Questions'.tr),
|
||||
subtitle: Text('Find answers to common questions'.tr),
|
||||
trailing: const CupertinoListTileChevron(),
|
||||
),
|
||||
CupertinoListTile(
|
||||
leading: const Icon(Icons.vibration,
|
||||
color: CupertinoColors.activeBlue),
|
||||
title: Text('Vibration'.tr),
|
||||
trailing: GetBuilder<HomePageController>(
|
||||
builder: (controller) {
|
||||
return CupertinoSwitch(
|
||||
value: controller.isVibrate,
|
||||
onChanged: controller.changeVibrateOption,
|
||||
);
|
||||
},
|
||||
),
|
||||
subtitle: Text(
|
||||
'You can change the vibration feedback for all buttons'.tr),
|
||||
),
|
||||
CupertinoListTile(
|
||||
onTap: () {
|
||||
Get.to(() => const TripsRecordedPage());
|
||||
},
|
||||
leading: const Icon(CupertinoIcons.mic_circle,
|
||||
color: CupertinoColors.activeBlue),
|
||||
title: Text('Trips recorded'.tr),
|
||||
subtitle: Text('Here recorded trips audio'.tr),
|
||||
trailing: const CupertinoListTileChevron(),
|
||||
),
|
||||
CupertinoListTile(
|
||||
onTap: () {
|
||||
Get.to(() => const AboutPage());
|
||||
},
|
||||
leading: const Icon(CupertinoIcons.info_circle,
|
||||
color: CupertinoColors.activeBlue),
|
||||
title: Text('About Us'.tr),
|
||||
subtitle: Text('Learn more about our app and mission'.tr),
|
||||
trailing: const CupertinoListTileChevron(),
|
||||
),
|
||||
CupertinoListTile(
|
||||
onTap: () {
|
||||
Get.to(() => ShareAppPage());
|
||||
},
|
||||
leading: const Icon(CupertinoIcons.share,
|
||||
color: CupertinoColors.activeBlue),
|
||||
title: Text('Share App'.tr),
|
||||
subtitle: Text(
|
||||
'You can share the Intaleq App with your friends and earn rewards for rides they take using your code'
|
||||
.tr),
|
||||
trailing: const CupertinoListTileChevron(),
|
||||
const SizedBox(height: 24),
|
||||
_buildSectionHeader('Support & Info'.tr),
|
||||
_buildSettingsCard(
|
||||
children: [
|
||||
_buildSettingsTile(
|
||||
icon: Icons.help_outline,
|
||||
color: Colors.cyan,
|
||||
title: 'Frequently Questions'.tr,
|
||||
subtitle: 'Find answers to common questions'.tr,
|
||||
onTap: () => Get.to(() => const FrequentlyQuestionsPage()),
|
||||
),
|
||||
const Divider(height: 1, indent: 68, endIndent: 16),
|
||||
_buildSettingsTile(
|
||||
icon: Icons.info_outline,
|
||||
color: Colors.indigo,
|
||||
title: 'About Us'.tr,
|
||||
subtitle: 'Learn more about our app and mission'.tr,
|
||||
onTap: () => Get.to(() => const AboutPage()),
|
||||
),
|
||||
const Divider(height: 1, indent: 68, endIndent: 16),
|
||||
_buildSettingsTile(
|
||||
icon: Icons.share_outlined,
|
||||
color: Colors.redAccent,
|
||||
title: 'Share App'.tr,
|
||||
subtitle: 'Share with friends and earn rewards'.tr,
|
||||
onTap: () => Get.to(() => ShareAppPage()),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSectionHeader(String title) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12.0, left: 8.0),
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: Colors.grey[700],
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSettingsCard({required List<Widget> children}) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Column(
|
||||
children: children,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSettingsTile({
|
||||
required IconData icon,
|
||||
required Color color,
|
||||
required String title,
|
||||
required String subtitle,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return ListTile(
|
||||
onTap: onTap,
|
||||
leading: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Icon(icon, color: color, size: 22),
|
||||
),
|
||||
title: Text(title,
|
||||
style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 16)),
|
||||
subtitle: Text(subtitle,
|
||||
style: TextStyle(color: Colors.grey[600], fontSize: 13)),
|
||||
trailing: Icon(Icons.chevron_right, color: Colors.grey[400]),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSettingsSwitchTile({
|
||||
required IconData icon,
|
||||
required Color color,
|
||||
required String title,
|
||||
required String subtitle,
|
||||
required bool value,
|
||||
required ValueChanged<bool> onChanged,
|
||||
}) {
|
||||
return SwitchListTile(
|
||||
secondary: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Icon(icon, color: color, size: 22),
|
||||
),
|
||||
title: Text(title,
|
||||
style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 16)),
|
||||
subtitle: Text(subtitle,
|
||||
style: TextStyle(color: Colors.grey[600], fontSize: 13)),
|
||||
value: value,
|
||||
onChanged: onChanged,
|
||||
activeColor: const Color(0xFF007AFF), // iOS-like blue
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user