|
| 1 | +import 'package:flutter/material.dart'; |
| 2 | +import 'package:flutter_responsive_web/widgets/custom_button.dart'; |
| 3 | +import 'package:flutter_responsive_web/widgets/custom_text_field.dart'; |
| 4 | +import 'package:responsive_framework/responsive_framework.dart'; |
| 5 | + |
| 6 | +class ContactViewSection extends StatelessWidget { |
| 7 | + final Key? divKey; |
| 8 | + |
| 9 | + const ContactViewSection({ |
| 10 | + super.key, |
| 11 | + required this.divKey, |
| 12 | + }); |
| 13 | + |
| 14 | + @override |
| 15 | + Widget build(BuildContext context) { |
| 16 | + final isResponsive = ResponsiveBreakpoints.of(context).largerThan(TABLET); |
| 17 | + |
| 18 | + return Container( |
| 19 | + key: divKey, |
| 20 | + padding: EdgeInsets.symmetric( |
| 21 | + vertical: 50, horizontal: isResponsive ? 40 : 20), |
| 22 | + decoration: BoxDecoration( |
| 23 | + gradient: LinearGradient( |
| 24 | + colors: [ |
| 25 | + Colors.blue.shade300, |
| 26 | + Colors.blue.shade600, |
| 27 | + Colors.blue.shade800, |
| 28 | + ], |
| 29 | + begin: Alignment.topCenter, |
| 30 | + end: Alignment.bottomCenter, |
| 31 | + ), |
| 32 | + ), |
| 33 | + child: Column( |
| 34 | + crossAxisAlignment: CrossAxisAlignment.center, |
| 35 | + children: [ |
| 36 | + Text( |
| 37 | + 'Get In Touch', |
| 38 | + style: TextStyle( |
| 39 | + fontSize: isResponsive ? 40 : 36, |
| 40 | + fontWeight: FontWeight.bold, |
| 41 | + color: Colors.white, |
| 42 | + ), |
| 43 | + textAlign: TextAlign.center, |
| 44 | + ), |
| 45 | + const SizedBox(height: 20), |
| 46 | + Text( |
| 47 | + 'We would love to hear from you! Feel free to reach out using the form below.', |
| 48 | + style: TextStyle( |
| 49 | + fontSize: isResponsive ? 20 : 18, color: Colors.white70), |
| 50 | + textAlign: TextAlign.center, |
| 51 | + ), |
| 52 | + const SizedBox(height: 40), |
| 53 | + isResponsive |
| 54 | + ? Row( |
| 55 | + mainAxisAlignment: MainAxisAlignment.center, |
| 56 | + children: [ |
| 57 | + Expanded(child: _buildContactForm(isResponsive)), |
| 58 | + const SizedBox(width: 40), |
| 59 | + Expanded(child: _buildContactInfo(isResponsive)), |
| 60 | + ], |
| 61 | + ) |
| 62 | + : Column( |
| 63 | + children: [ |
| 64 | + _buildContactForm(isResponsive), |
| 65 | + const SizedBox(height: 30), |
| 66 | + _buildContactInfo(isResponsive), |
| 67 | + ], |
| 68 | + ), |
| 69 | + ], |
| 70 | + ), |
| 71 | + ); |
| 72 | + } |
| 73 | + |
| 74 | + Widget _buildContactForm(bool isResponsive) { |
| 75 | + return Container( |
| 76 | + width: isResponsive ? 500 : double.infinity, |
| 77 | + padding: const EdgeInsets.all(20), |
| 78 | + decoration: BoxDecoration( |
| 79 | + color: Colors.white, |
| 80 | + borderRadius: BorderRadius.circular(12), |
| 81 | + boxShadow: [ |
| 82 | + BoxShadow( |
| 83 | + color: Colors.black.withOpacity(0.1), |
| 84 | + blurRadius: 10, |
| 85 | + offset: const Offset(0, 4), |
| 86 | + ), |
| 87 | + ], |
| 88 | + ), |
| 89 | + child: Column( |
| 90 | + crossAxisAlignment: CrossAxisAlignment.start, |
| 91 | + children: [ |
| 92 | + CustomTextField( |
| 93 | + hintText: 'Your Name', |
| 94 | + prefixIcon: Icons.person_outline, |
| 95 | + ), |
| 96 | + const SizedBox(height: 20), |
| 97 | + CustomTextField( |
| 98 | + hintText: 'Your Email', |
| 99 | + prefixIcon: Icons.email_outlined, |
| 100 | + ), |
| 101 | + const SizedBox(height: 20), |
| 102 | + CustomTextField( |
| 103 | + hintText: 'Your Message', |
| 104 | + prefixIcon: Icons.message_outlined, |
| 105 | + ), |
| 106 | + const SizedBox(height: 20), |
| 107 | + SizedBox( |
| 108 | + width: double.infinity, |
| 109 | + child: CustomButton(title: 'Send Message', onPressed: () {})), |
| 110 | + ], |
| 111 | + ), |
| 112 | + ); |
| 113 | + } |
| 114 | + |
| 115 | + Widget _buildContactInfo(bool isResponsive) { |
| 116 | + return Container( |
| 117 | + width: isResponsive ? 300 : double.infinity, |
| 118 | + padding: const EdgeInsets.all(20), |
| 119 | + decoration: BoxDecoration( |
| 120 | + color: Colors.white, |
| 121 | + borderRadius: BorderRadius.circular(12), |
| 122 | + boxShadow: [ |
| 123 | + BoxShadow( |
| 124 | + color: Colors.black.withOpacity(0.1), |
| 125 | + blurRadius: 10, |
| 126 | + offset: const Offset(0, 4), |
| 127 | + ), |
| 128 | + ], |
| 129 | + ), |
| 130 | + child: Column( |
| 131 | + crossAxisAlignment: CrossAxisAlignment.start, |
| 132 | + children: [ |
| 133 | + Text( |
| 134 | + 'You can also reach us at:', |
| 135 | + style: |
| 136 | + TextStyle(fontSize: isResponsive ? 20 : 18, color: Colors.teal), |
| 137 | + ), |
| 138 | + const SizedBox(height: 10), |
| 139 | + Text( |
| 140 | + 'Email: contact@example.com | Phone: +123 456 7890', |
| 141 | + style: TextStyle( |
| 142 | + fontSize: isResponsive ? 16 : 14, color: Colors.black), |
| 143 | + ), |
| 144 | + ], |
| 145 | + ), |
| 146 | + ); |
| 147 | + } |
| 148 | +} |
0 commit comments