220 lines
6.9 KiB
Dart
220 lines
6.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:inou_app/design/inou_theme.dart';
|
|
import 'package:inou_app/design/inou_text.dart';
|
|
import 'package:inou_app/design/widgets/widgets.dart';
|
|
|
|
/// Connect/Contact page
|
|
class ConnectPage extends StatefulWidget {
|
|
const ConnectPage({super.key});
|
|
|
|
@override
|
|
State<ConnectPage> createState() => _ConnectPageState();
|
|
}
|
|
|
|
class _ConnectPageState extends State<ConnectPage> {
|
|
final _formKey = GlobalKey<FormState>();
|
|
final _nameController = TextEditingController();
|
|
final _emailController = TextEditingController();
|
|
final _messageController = TextEditingController();
|
|
String _selectedTopic = 'General inquiry';
|
|
bool _isSubmitting = false;
|
|
|
|
@override
|
|
void dispose() {
|
|
_nameController.dispose();
|
|
_emailController.dispose();
|
|
_messageController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return InouPage(
|
|
currentRoute: '/connect',
|
|
maxWidth: 600,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
const SizedBox(height: 48),
|
|
|
|
Text(
|
|
'Get in touch',
|
|
style: InouText.pageTitle,
|
|
),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
'Have a question, feedback, or just want to say hello? We\'d love to hear from you.',
|
|
style: InouText.body.copyWith(
|
|
color: InouTheme.textMuted,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
|
|
const SizedBox(height: 48),
|
|
|
|
Form(
|
|
key: _formKey,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
InouTextField(
|
|
label: 'Name',
|
|
controller: _nameController,
|
|
placeholder: 'Your name',
|
|
validator: (value) {
|
|
if (value == null || value.isEmpty) {
|
|
return 'Please enter your name';
|
|
}
|
|
return null;
|
|
},
|
|
),
|
|
const SizedBox(height: 20),
|
|
|
|
InouTextField(
|
|
label: 'Email',
|
|
controller: _emailController,
|
|
placeholder: 'you@example.com',
|
|
keyboardType: TextInputType.emailAddress,
|
|
validator: (value) {
|
|
if (value == null || value.isEmpty) {
|
|
return 'Please enter your email';
|
|
}
|
|
if (!value.contains('@')) {
|
|
return 'Please enter a valid email';
|
|
}
|
|
return null;
|
|
},
|
|
),
|
|
const SizedBox(height: 20),
|
|
|
|
InouSelect<String>(
|
|
label: 'Topic',
|
|
value: _selectedTopic,
|
|
options: const [
|
|
InouSelectOption(value: 'General inquiry', label: 'General inquiry'),
|
|
InouSelectOption(value: 'Technical support', label: 'Technical support'),
|
|
InouSelectOption(value: 'Privacy question', label: 'Privacy question'),
|
|
InouSelectOption(value: 'Partnership', label: 'Partnership'),
|
|
InouSelectOption(value: 'Press', label: 'Press'),
|
|
InouSelectOption(value: 'Other', label: 'Other'),
|
|
],
|
|
onChanged: (value) {
|
|
if (value != null) {
|
|
setState(() => _selectedTopic = value);
|
|
}
|
|
},
|
|
),
|
|
const SizedBox(height: 20),
|
|
|
|
InouTextField(
|
|
label: 'Message',
|
|
controller: _messageController,
|
|
placeholder: 'How can we help?',
|
|
maxLines: 5,
|
|
validator: (value) {
|
|
if (value == null || value.isEmpty) {
|
|
return 'Please enter a message';
|
|
}
|
|
return null;
|
|
},
|
|
),
|
|
const SizedBox(height: 32),
|
|
|
|
InouButton(
|
|
text: _isSubmitting ? 'Sending...' : 'Send message',
|
|
onPressed: _isSubmitting ? null : _handleSubmit,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
|
|
const SizedBox(height: 64),
|
|
|
|
// Direct contact info
|
|
Container(
|
|
padding: const EdgeInsets.all(24),
|
|
decoration: BoxDecoration(
|
|
color: InouTheme.bgCard,
|
|
borderRadius: InouTheme.borderRadiusLg,
|
|
border: Border.all(color: InouTheme.border),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'Prefer email?',
|
|
style: InouText.h3,
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'Reach us directly at:',
|
|
style: InouText.body.copyWith(
|
|
color: InouTheme.textMuted,
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
_buildEmailLink('hello@inou.com', 'General inquiries'),
|
|
const SizedBox(height: 8),
|
|
_buildEmailLink('support@inou.com', 'Technical support'),
|
|
const SizedBox(height: 8),
|
|
_buildEmailLink('privacy@inou.com', 'Privacy questions'),
|
|
],
|
|
),
|
|
),
|
|
|
|
const SizedBox(height: 48),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildEmailLink(String email, String label) {
|
|
return Row(
|
|
children: [
|
|
Text(
|
|
email,
|
|
style: InouText.body.copyWith(
|
|
color: InouTheme.accent,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
const SizedBox(width: 8),
|
|
Text(
|
|
'— $label',
|
|
style: InouText.bodySmall.copyWith(
|
|
color: InouTheme.textMuted,
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Future<void> _handleSubmit() async {
|
|
if (!_formKey.currentState!.validate()) return;
|
|
|
|
setState(() => _isSubmitting = true);
|
|
|
|
// TODO: Implement actual form submission
|
|
await Future.delayed(const Duration(seconds: 1));
|
|
|
|
if (mounted) {
|
|
setState(() => _isSubmitting = false);
|
|
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
SnackBar(
|
|
content: const Text('Message sent! We\'ll get back to you soon.'),
|
|
backgroundColor: InouTheme.success,
|
|
behavior: SnackBarBehavior.floating,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
);
|
|
|
|
_nameController.clear();
|
|
_emailController.clear();
|
|
_messageController.clear();
|
|
}
|
|
}
|
|
}
|