Created
April 4, 2025 08:23
-
-
Save prakhart111/c7733c620d198e5484b7082d3522d818 to your computer and use it in GitHub Desktop.
Snippet created via Remix API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'dart:math'; | |
void main() { | |
runApp(LandingPageApp()); | |
} | |
class LandingPageApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Innovative Landing Page', | |
theme: ThemeData( | |
primarySwatch: Colors.deepPurple, | |
visualDensity: VisualDensity.adaptivePlatformDensity, | |
), | |
home: LandingPage(), | |
); | |
} | |
} | |
class LandingPage extends StatefulWidget { | |
@override | |
_LandingPageState createState() => _LandingPageState(); | |
} | |
class _LandingPageState extends State<LandingPage> with SingleTickerProviderStateMixin { | |
late AnimationController _animationController; | |
late Animation<double> _scaleAnimation; | |
late Animation<double> _rotationAnimation; | |
@override | |
void initState() { | |
super.initState(); | |
_animationController = AnimationController( | |
duration: Duration(seconds: 2), | |
vsync: this, | |
)..repeat(reverse: true); | |
_scaleAnimation = Tween<double>(begin: 1.0, end: 1.1).animate( | |
CurvedAnimation( | |
parent: _animationController, | |
curve: Curves.easeInOut, | |
), | |
); | |
_rotationAnimation = Tween<double>(begin: 0, end: 0.05).animate( | |
CurvedAnimation( | |
parent: _animationController, | |
curve: Curves.easeInOut, | |
), | |
); | |
} | |
@override | |
void dispose() { | |
_animationController.dispose(); | |
super.dispose(); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: LayoutBuilder( | |
builder: (context, constraints) { | |
return SingleChildScrollView( | |
child: Column( | |
children: [ | |
// Navigation Bar | |
_buildNavigationBar(constraints), | |
// Hero Section | |
_buildHeroSection(constraints), | |
// Features Section | |
_buildFeaturesSection(constraints), | |
// Footer | |
_buildFooter(constraints), | |
], | |
), | |
); | |
}, | |
), | |
); | |
} | |
Widget _buildNavigationBar(BoxConstraints constraints) { | |
return Container( | |
width: double.infinity, | |
padding: EdgeInsets.symmetric( | |
horizontal: constraints.maxWidth > 600 ? 50 : 20, | |
vertical: 20, | |
), | |
color: Colors.white, | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: [ | |
Text( | |
'InnovateTech', | |
style: TextStyle( | |
fontSize: 24, | |
fontWeight: FontWeight.bold, | |
color: Colors.deepPurple, | |
), | |
), | |
if (constraints.maxWidth > 600) | |
Row( | |
children: [ | |
_navItem('Home'), | |
_navItem('Features'), | |
_navItem('About'), | |
_navItem('Contact'), | |
], | |
) | |
else | |
IconButton( | |
icon: Icon(Icons.menu, color: Colors.deepPurple), | |
onPressed: () { | |
// TODO: Implement mobile menu | |
}, | |
), | |
], | |
), | |
); | |
} | |
Widget _navItem(String title) { | |
return Padding( | |
padding: EdgeInsets.symmetric(horizontal: 15), | |
child: Text( | |
title, | |
style: TextStyle( | |
color: Colors.deepPurple, | |
fontWeight: FontWeight.w500, | |
), | |
), | |
); | |
} | |
Widget _buildHeroSection(BoxConstraints constraints) { | |
bool isWide = constraints.maxWidth > 900; | |
return Container( | |
width: double.infinity, | |
padding: EdgeInsets.symmetric( | |
horizontal: isWide ? 100 : 20, | |
vertical: 100, | |
), | |
color: Colors.deepPurple[50], | |
child: isWide | |
? Row( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: [ | |
Expanded( | |
child: _buildHeroContent(), | |
), | |
Expanded( | |
child: _buildAnimatedHeroImage(), | |
), | |
], | |
) | |
: Column( | |
children: [ | |
_buildHeroContent(), | |
SizedBox(height: 30), | |
_buildAnimatedHeroImage(), | |
], | |
), | |
); | |
} | |
Widget _buildHeroContent() { | |
return Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Text( | |
'Transform Your Ideas', | |
style: TextStyle( | |
fontSize: 48, | |
fontWeight: FontWeight.bold, | |
color: Colors.deepPurple, | |
), | |
), | |
SizedBox(height: 20), | |
Text( | |
'Innovative solutions for modern challenges. We turn your vision into reality with cutting-edge technology.', | |
style: TextStyle( | |
fontSize: 18, | |
color: Colors.black87, | |
), | |
), | |
SizedBox(height: 30), | |
ElevatedButton( | |
onPressed: () {}, | |
style: ElevatedButton.styleFrom( | |
primary: Colors.deepPurple, | |
padding: EdgeInsets.symmetric(horizontal: 40, vertical: 15), | |
), | |
child: Text( | |
'Get Started', | |
style: TextStyle(fontSize: 18), | |
), | |
), | |
], | |
); | |
} | |
Widget _buildAnimatedHeroImage() { | |
return AnimatedBuilder( | |
animation: _animationController, | |
builder: (context, child) { | |
return Transform.scale( | |
scale: _scaleAnimation.value, | |
child: Transform.rotate( | |
angle: _rotationAnimation.value, | |
child: Container( | |
width: 400, | |
height: 400, | |
decoration: BoxDecoration( | |
color: Colors.deepPurple[100], | |
borderRadius: BorderRadius.circular(20), | |
), | |
child: Center( | |
child: Icon( | |
Icons.rocket_launch, | |
size: 200, | |
color: Colors.deepPurple, | |
), | |
), | |
), | |
), | |
); | |
}, | |
); | |
} | |
Widget _buildFeaturesSection(BoxConstraints constraints) { | |
bool isWide = constraints.maxWidth > 900; | |
return Container( | |
width: double.infinity, | |
padding: EdgeInsets.symmetric( | |
horizontal: isWide ? 100 : 20, | |
vertical: 100, | |
), | |
color: Colors.white, | |
child: Column( | |
children: [ | |
Text( | |
'Our Features', | |
style: TextStyle( | |
fontSize: 36, | |
fontWeight: FontWeight.bold, | |
color: Colors.deepPurple, | |
), | |
), | |
SizedBox(height: 50), | |
isWide | |
? Row( | |
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | |
children: _buildFeatureCards(), | |
) | |
: Column( | |
children: _buildFeatureCards(), | |
), | |
], | |
), | |
); | |
} | |
List<Widget> _buildFeatureCards() { | |
return [ | |
_featureCard( | |
Icons.design_services, | |
'Custom Design', | |
'Unique and tailored solutions for your specific needs.', | |
), | |
_featureCard( | |
Icons.speed, | |
'High Performance', | |
'Optimized and efficient technology that delivers results.', | |
), | |
_featureCard( | |
Icons.support, | |
'24/7 Support', | |
'Dedicated team always ready to help you succeed.', | |
), | |
]; | |
} | |
Widget _featureCard(IconData icon, String title, String description) { | |
return Container( | |
width: 300, | |
margin: EdgeInsets.all(15), | |
padding: EdgeInsets.all(25), | |
decoration: BoxDecoration( | |
color: Colors.white, | |
borderRadius: BorderRadius.circular(15), | |
boxShadow: [ | |
BoxShadow( | |
color: Colors.deepPurple.withOpacity(0.1), | |
blurRadius: 15, | |
offset: Offset(0, 10), | |
), | |
], | |
), | |
child: Column( | |
children: [ | |
Icon( | |
icon, | |
size: 60, | |
color: Colors.deepPurple, | |
), | |
SizedBox(height: 20), | |
Text( | |
title, | |
style: TextStyle( | |
fontSize: 22, | |
fontWeight: FontWeight.bold, | |
color: Colors.deepPurple, | |
), | |
), | |
SizedBox(height: 15), | |
Text( | |
description, | |
textAlign: TextAlign.center, | |
style: TextStyle( | |
fontSize: 16, | |
color: Colors.black54, | |
), | |
), | |
], | |
), | |
); | |
} | |
Widget _buildFooter(BoxConstraints constraints) { | |
return Container( | |
width: double.infinity, | |
color: Colors.deepPurple, | |
padding: EdgeInsets.symmetric( | |
horizontal: constraints.maxWidth > 600 ? 100 : 20, | |
vertical: 50, | |
), | |
child: Column( | |
children: [ | |
Text( | |
'© 2023 InnovateTech. All Rights Reserved.', | |
style: TextStyle( | |
color: Colors.white, | |
fontSize: 16, | |
), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment