Skip to content

Commit

Permalink
added home file
Browse files Browse the repository at this point in the history
  • Loading branch information
samarth-5 committed Jul 18, 2024
1 parent 7c9d48a commit 769d159
Showing 1 changed file with 284 additions and 0 deletions.
284 changes: 284 additions & 0 deletions lib/resources/home.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
import 'package:flutter/material.dart';
// Nt used file
class Home extends StatefulWidget {
const Home({super.key});

@override
State<Home> createState() => _HomeState();
}

class _HomeState extends State<Home> {
List categories = [
"images/watch.png",
"images/TV.png",
"images/laptop.png",
"images/headphone.png",
];

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xfff2f2f2),
body: SafeArea(
child: Container(
margin: const EdgeInsets.only(left: 20, right: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Hey, Samarth!"
),
Text(
"Good Morning!",
//style: AppWidget.lightTextFieldStyle(),
),
],
),
ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Image.asset(
"images/profile.png",
height: 60,
width: 60,
fit: BoxFit.cover,
),
),
],
),
const SizedBox(height: 30),
Container(
padding: const EdgeInsets.only(left: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
),
width: MediaQuery.of(context).size.width,
child: TextField(
decoration: InputDecoration(
border: InputBorder.none,
hintText: "Search Products...",
//hintStyle: AppWidget.lightTextFieldStyle(),
suffixIcon: const Icon(
Icons.search,
color: Colors.black,
),
),
),
),
const SizedBox(height: 15),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Categories',
//style: AppWidget.semiBoldTextFieldStyle(),
),
const Text(
'See all',
style: TextStyle(
color: Color(0xFFfd6f3e),
fontSize: 15,
fontWeight: FontWeight.w500,
),
),
],
),
const SizedBox(height: 10),
Row(
children: [
Container(
margin: const EdgeInsets.only(right: 20),
padding: const EdgeInsets.all(20),
height: 120,
decoration: BoxDecoration(
color: Color(0xFFFD6F3E),
borderRadius: BorderRadius.circular(10),
),
child: const Center(
child: Text(
'All',
style: TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
),
Expanded(
child: Container(
height: 120,
child: ListView.builder(
padding: EdgeInsets.zero,
itemCount: categories.length,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
return CategoryTile(image: categories[index]);
},
),
),
),
],
),
SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'All Products',
//style: AppWidget.semiBoldTextFieldStyle(),
),
const Text(
'See all',
style: TextStyle(
color: Color(0xFFfd6f3e),
fontSize: 15,
fontWeight: FontWeight.w500,
),
),
],
),
const SizedBox(height: 10),
Container(
height: 160,
child: ListView(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
children: [
Container(
margin: EdgeInsets.only(right: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10)),
padding: EdgeInsets.all(5),
child: Column(
children: [
Image.asset(
"images/earbuds.png",
height: 100,
width: 100,
fit: BoxFit.cover,
),
Text(
"Realme buds 2",
//style: AppWidget.normalTextFieldStyle(),
),
Row(
children: [
Text(
"Rs.30",
style: TextStyle(
color: Color(0xFFFD6F3E),
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
SizedBox(
width: 30,
),
Container(
decoration: BoxDecoration(
color: Color(0xFFFD6F3E),
borderRadius: BorderRadius.circular(12)),
child: Icon(
Icons.add,
color: Colors.white,
),
),
],
)
],
),
),
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10)),
padding: EdgeInsets.all(5),
child: Column(
children: [
Image.asset(
"images/earbuds.png",
height: 100,
width: 100,
fit: BoxFit.cover,
),
Text(
"Realme buds 2",
//style: AppWidget.normalTextFieldStyle(),
),
Row(
children: [
Text(
"Rs.30",
style: TextStyle(
color: Color(0xFFFD6F3E),
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
SizedBox(
width: 30,
),
Container(
decoration: BoxDecoration(
color: Color(0xFFFD6F3E),
borderRadius: BorderRadius.circular(12)),
child: Icon(
Icons.add,
color: Colors.white,
),
),
],
)
],
),
),
],
),
),
],
),
),
),
);
}
}

class CategoryTile extends StatelessWidget {
String image;
CategoryTile({super.key, required this.image});

@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(20),
margin: const EdgeInsets.only(right: 20),
height: 90,
width: 90,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Image.asset(
image,
height: 50,
width: 50,
fit: BoxFit.cover,
),
const Icon(Icons.arrow_forward),
],
),
);
}
}

0 comments on commit 769d159

Please sign in to comment.