nesward_flutter_app/lib/widgets/footer.dart

280 lines
8.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class Footer extends StatefulWidget {
const Footer({Key? key}) : super(key: key);
@override
State<Footer> createState() => _FooterState();
}
class _FooterState extends State<Footer> {
String _activeLink = ''; // Track the active link
void _onLinkTap(String linkName, String route) {
setState(() {
_activeLink = linkName;
});
// Navigation (replace routes with your actual pages)
Navigator.pushNamed(context, route);
}
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 40),
child: Column(
children: [
// Top Section with Store Info and Company Links
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Left Column - Store Info
Expanded(
flex: 2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// ✅ Fixed Row - added brackets correctly
Row(
children: [
SvgPicture.asset(
'assets/logo.svg',
height: 40,
width: 40,
),
const SizedBox(width: 10),
const Text(
'Nest',
style: TextStyle(
fontSize: 32,
fontWeight: FontWeight.bold,
color: Color(0xFF3BB77E),
),
),
],
),
const SizedBox(height: 5),
const Text(
'MART & GROCERY',
style: TextStyle(
fontSize: 10,
color: Colors.grey,
letterSpacing: 1.5,
),
),
const SizedBox(height: 20),
const Text(
'Awesome grocery store\nwebsite template',
style: TextStyle(
fontSize: 16,
color: Color(0xFF253D4E),
height: 1.5,
),
),
const SizedBox(height: 25),
_buildInfoRow(
Icons.location_on_outlined,
'5171 W Campbell Ave\nundefined Kent, Utah 53127\nUnited States',
),
const SizedBox(height: 15),
_buildInfoRow(
Icons.phone_outlined,
'(+91) - 540-025-124553',
),
const SizedBox(height: 15),
_buildInfoRow(
Icons.email_outlined,
'sale@Nest.com',
),
const SizedBox(height: 15),
_buildInfoRow(
Icons.access_time_outlined,
'10:00 - 18:00, Mon - Sat',
),
],
),
),
const SizedBox(width: 40),
// Right Column - Company Links
Expanded(
flex: 1,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Company',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Color(0xFF253D4E),
),
),
const SizedBox(height: 20),
_buildLink('About Us', '/about'),
_buildLink('Delivery Information', '/delivery'),
_buildLink('Privacy Policy', '/privacy'),
_buildLink('Terms & Conditions', '/terms'),
_buildLink('Contact Us', '/contact'),
_buildLink('Support Center', '/support'),
_buildLink('Careers', '/careers'),
],
),
),
],
),
const SizedBox(height: 40),
const Divider(color: Color(0xFFECECEC)),
const SizedBox(height: 30),
// Bottom Section (Account, Corporate, etc.)
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildSection(
'Account',
{
'Sign In': '/signin',
'View Cart': '/cart',
'My Wishlist': '/wishlist',
'Track My Order': '/orders',
'Help Ticket': '/help',
'Shipping Details': '/shipping',
'Compare products': '/compare',
},
),
_buildSection(
'Corporate',
{
'Become a Vendor': '/vendor',
'Affiliate Program': '/affiliate',
'Farm Business': '/farm-business',
'Farm Careers': '/farm-careers',
'Our Suppliers': '/suppliers',
'Accessibility': '/accessibility',
'Promotions': '/promotions',
},
),
],
),
const SizedBox(height: 40),
const Divider(color: Color(0xFFECECEC)),
const SizedBox(height: 20),
// Copyright Section
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
RichText(
text: const TextSpan(
style: TextStyle(
fontSize: 13,
color: Color(0xFF7E7E7E),
),
children: [
TextSpan(text: '© 2024, '),
TextSpan(
text: 'Nest',
style: TextStyle(
color: Color(0xFF3BB77E),
fontWeight: FontWeight.w600,
),
),
TextSpan(text: ' - Flutter Grocery App\n'),
TextSpan(text: 'All rights reserved'),
],
),
),
InkWell(
onTap: () {
// Add scroll-to-top functionality
},
child: Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
border: Border.all(color: const Color(0xFFECECEC)),
borderRadius: BorderRadius.circular(5),
),
child: const Icon(
Icons.arrow_upward,
size: 20,
color: Color(0xFF7E7E7E),
),
),
),
],
),
],
),
);
}
Widget _buildInfoRow(IconData icon, String text) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(icon, size: 18, color: const Color(0xFF3BB77E)),
const SizedBox(width: 10),
Expanded(
child: Text(
text,
style: const TextStyle(
fontSize: 14,
color: Color(0xFF7E7E7E),
height: 1.6,
),
),
),
],
);
}
Widget _buildLink(String text, String route) {
final bool isActive = _activeLink == text;
return Padding(
padding: const EdgeInsets.only(bottom: 12),
child: InkWell(
onTap: () => _onLinkTap(text, route),
child: Text(
text,
style: TextStyle(
fontSize: 14,
color: isActive ? const Color(0xFF3BB77E) : const Color(0xFF7E7E7E),
fontWeight: isActive ? FontWeight.bold : FontWeight.normal,
height: 1.5,
),
),
),
);
}
Widget _buildSection(String title, Map<String, String> links) {
return Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Color(0xFF253D4E),
),
),
const SizedBox(height: 20),
...links.entries.map(
(entry) => _buildLink(entry.key, entry.value),
),
],
),
);
}
}