fix
This commit is contained in:
@@ -27,6 +27,7 @@ class ApiConstants {
|
|||||||
|
|
||||||
// CMS
|
// CMS
|
||||||
static const String cmsPageLanding = '/cms/page/landing';
|
static const String cmsPageLanding = '/cms/page/landing';
|
||||||
|
static const String cmsPageContact = '/cms/page/contact';
|
||||||
|
|
||||||
// Messages
|
// Messages
|
||||||
static const String conversations = '/messages/conversations';
|
static const String conversations = '/messages/conversations';
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:real_estate_mobile/core/constants/api_constants.dart';
|
||||||
import 'package:real_estate_mobile/core/constants/app_colors.dart';
|
import 'package:real_estate_mobile/core/constants/app_colors.dart';
|
||||||
|
import 'package:real_estate_mobile/core/network/api_client.dart';
|
||||||
|
|
||||||
class ContactScreen extends StatefulWidget {
|
class ContactScreen extends StatefulWidget {
|
||||||
const ContactScreen({super.key});
|
const ContactScreen({super.key});
|
||||||
@@ -17,6 +19,48 @@ class _ContactScreenState extends State<ContactScreen> {
|
|||||||
final _messageController = TextEditingController();
|
final _messageController = TextEditingController();
|
||||||
bool _isSending = false;
|
bool _isSending = false;
|
||||||
|
|
||||||
|
// CMS data with defaults
|
||||||
|
String _contactEmail = '123support@gmail.com';
|
||||||
|
String _contactPhone = '1234567890';
|
||||||
|
String _contactPhoneHours = 'Mon-Fri 9am-6pm';
|
||||||
|
String _contactOfficeAddress = '123 Market Street';
|
||||||
|
String _contactOfficeCity = 'New York CA 234737';
|
||||||
|
String _pageTitle = 'Get In Touch';
|
||||||
|
String _pageDescription = 'Have a question about a property or need assistance? Fill out the form below and our team will get back to you shortly.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_loadContactCms();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _loadContactCms() async {
|
||||||
|
try {
|
||||||
|
final dio = ApiClient.instance.dio;
|
||||||
|
final response = await dio.get(ApiConstants.cmsPageContact);
|
||||||
|
final data = response.data['data'] as List<dynamic>?;
|
||||||
|
if (data == null) return;
|
||||||
|
|
||||||
|
for (final section in data) {
|
||||||
|
final sectionKey = section['sectionKey'] as String?;
|
||||||
|
final content = section['content'] as Map<String, dynamic>?;
|
||||||
|
if (sectionKey == 'contactDetails' && content != null) {
|
||||||
|
setState(() {
|
||||||
|
_contactEmail = content['email'] as String? ?? _contactEmail;
|
||||||
|
_contactPhone = content['phone'] as String? ?? _contactPhone;
|
||||||
|
_contactPhoneHours = content['phoneHours'] as String? ?? _contactPhoneHours;
|
||||||
|
_contactOfficeAddress = content['officeAddress'] as String? ?? _contactOfficeAddress;
|
||||||
|
_contactOfficeCity = content['officeCity'] as String? ?? _contactOfficeCity;
|
||||||
|
_pageTitle = content['title'] as String? ?? _pageTitle;
|
||||||
|
_pageDescription = content['description'] as String? ?? _pageDescription;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (_) {
|
||||||
|
// Use defaults on error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_nameController.dispose();
|
_nameController.dispose();
|
||||||
@@ -77,10 +121,10 @@ class _ContactScreenState extends State<ContactScreen> {
|
|||||||
|
|
||||||
// -- Title --
|
// -- Title --
|
||||||
Widget _buildTitle() {
|
Widget _buildTitle() {
|
||||||
return const Center(
|
return Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'Get In Touch',
|
_pageTitle,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
fontFamily: 'Fractul',
|
fontFamily: 'Fractul',
|
||||||
fontSize: 25,
|
fontSize: 25,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
@@ -92,12 +136,12 @@ class _ContactScreenState extends State<ContactScreen> {
|
|||||||
|
|
||||||
// -- Description --
|
// -- Description --
|
||||||
Widget _buildDescription() {
|
Widget _buildDescription() {
|
||||||
return const Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 20),
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||||
child: Text(
|
child: Text(
|
||||||
'Have a question about a property or need assistance? Fill out the form below and our team will get back to you shortly.',
|
_pageDescription,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
fontFamily: 'SourceSerif4',
|
fontFamily: 'SourceSerif4',
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
@@ -365,22 +409,22 @@ class _ContactScreenState extends State<ContactScreen> {
|
|||||||
_buildContactDetailRow(
|
_buildContactDetailRow(
|
||||||
svgIcon: 'assets/icons/email_orange_icon.svg',
|
svgIcon: 'assets/icons/email_orange_icon.svg',
|
||||||
label: 'Email Support',
|
label: 'Email Support',
|
||||||
value: '123support@gmail.com',
|
value: _contactEmail,
|
||||||
),
|
),
|
||||||
_buildDetailDivider(),
|
_buildDetailDivider(),
|
||||||
// Phone
|
// Phone
|
||||||
_buildContactDetailRow(
|
_buildContactDetailRow(
|
||||||
svgIcon: 'assets/icons/phone_orange_icon.svg',
|
svgIcon: 'assets/icons/phone_orange_icon.svg',
|
||||||
label: 'Phone',
|
label: 'Phone',
|
||||||
value: '1234567890',
|
value: _contactPhone,
|
||||||
subtitle: 'Mon-Fri 9am-6pm',
|
subtitle: _contactPhoneHours,
|
||||||
),
|
),
|
||||||
_buildDetailDivider(),
|
_buildDetailDivider(),
|
||||||
// Office
|
// Office
|
||||||
_buildContactDetailRow(
|
_buildContactDetailRow(
|
||||||
svgIcon: 'assets/icons/location_orange_icon.svg',
|
svgIcon: 'assets/icons/location_orange_icon.svg',
|
||||||
label: 'Office',
|
label: 'Office',
|
||||||
value: '123 Market Street\nNew York CA 234737',
|
value: '$_contactOfficeAddress\n$_contactOfficeCity',
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
// Map image
|
// Map image
|
||||||
|
|||||||
Reference in New Issue
Block a user