Skip to content

Commit b89eb17

Browse files
authored
Merge pull request #1 from DevStack06/devstack06/landing-page
Devstack06/landing page
2 parents 63df263 + ba3b974 commit b89eb17

File tree

8 files changed

+142
-1
lines changed

8 files changed

+142
-1
lines changed
10.3 KB
Loading
21 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import 'package:flutter/material.dart';
2+
3+
class Categories extends StatefulWidget {
4+
Categories({Key? key}) : super(key: key);
5+
6+
@override
7+
_CategoriesState createState() => _CategoriesState();
8+
}
9+
10+
class _CategoriesState extends State<Categories> {
11+
@override
12+
Widget build(BuildContext context) {
13+
return Scaffold(
14+
body: Center(
15+
child: Text("Categories"),
16+
),
17+
);
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import 'package:flutter/material.dart';
2+
3+
class HomePage extends StatefulWidget {
4+
HomePage({Key? key}) : super(key: key);
5+
6+
@override
7+
_HomePageState createState() => _HomePageState();
8+
}
9+
10+
class _HomePageState extends State<HomePage> {
11+
@override
12+
Widget build(BuildContext context) {
13+
return Scaffold(
14+
body: Center(
15+
child: Text("home"),
16+
),
17+
);
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:myntra/feature/categories/categories.dart';
3+
import 'package:myntra/feature/home_page/home_page.dart';
4+
import 'package:myntra/feature/profile/profile.dart';
5+
import 'package:myntra/foundation/sp_icon/sp_icon.dart';
6+
7+
class LandingPage extends StatefulWidget {
8+
LandingPage({Key? key}) : super(key: key);
9+
10+
@override
11+
_LandingPageState createState() => _LandingPageState();
12+
}
13+
14+
class _LandingPageState extends State<LandingPage> {
15+
int currentIndex = 0;
16+
List<Widget> pages = [HomePage(), Categories(), Profile()];
17+
@override
18+
Widget build(BuildContext context) {
19+
return Scaffold(
20+
bottomNavigationBar: BottomNavigationBar(
21+
currentIndex: currentIndex,
22+
selectedItemColor: const Color(0xfffe416c),
23+
selectedLabelStyle: const TextStyle(fontSize: 13),
24+
onTap: (index) {
25+
setState(() {
26+
currentIndex = index;
27+
});
28+
},
29+
items: [
30+
BottomNavigationBarItem(
31+
icon: SPIcon(
32+
assetname: "logo-black.png",
33+
index: 0,
34+
currentIndex: currentIndex,
35+
),
36+
label: "Home",
37+
),
38+
BottomNavigationBarItem(
39+
icon: SPIcon(
40+
assetname: "categories.png",
41+
index: 1,
42+
currentIndex: currentIndex,
43+
),
44+
label: "Categories",
45+
),
46+
BottomNavigationBarItem(
47+
icon: SPIcon(
48+
assetname: "profile.png",
49+
index: 2,
50+
currentIndex: currentIndex,
51+
),
52+
label: "Profile",
53+
),
54+
],
55+
),
56+
body: pages[currentIndex],
57+
);
58+
}
59+
}
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import 'package:flutter/material.dart';
2+
3+
class Profile extends StatefulWidget {
4+
Profile({Key? key}) : super(key: key);
5+
6+
@override
7+
_ProfileState createState() => _ProfileState();
8+
}
9+
10+
class _ProfileState extends State<Profile> {
11+
@override
12+
Widget build(BuildContext context) {
13+
return Scaffold(
14+
body: Center(
15+
child: Text("Proile"),
16+
),
17+
);
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import 'package:flutter/material.dart';
2+
3+
class SPIcon extends StatelessWidget {
4+
const SPIcon(
5+
{Key? key,
6+
required this.assetname,
7+
required this.index,
8+
required this.currentIndex})
9+
: super(key: key);
10+
final String assetname;
11+
final int index;
12+
final int currentIndex;
13+
14+
@override
15+
Widget build(BuildContext context) {
16+
return Image.asset(
17+
"assets/images/$assetname",
18+
height: 25,
19+
width: 25,
20+
color: index == currentIndex ? const Color(0xfffe416c) : Colors.black,
21+
);
22+
}
23+
}

front-end/lib/main.dart

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import 'package:flutter/material.dart';
22
import 'package:get/get.dart';
33

4+
import 'feature/landing_page/landing_page.dart';
5+
46
void main() {
57
runApp(const MyApp());
68
}
@@ -13,7 +15,7 @@ class MyApp extends StatelessWidget {
1315
Widget build(BuildContext context) {
1416
return GetMaterialApp(
1517
title: "Myntra",
16-
home: Scaffold(),
18+
home: LandingPage(),
1719
);
1820
}
1921
}

0 commit comments

Comments
 (0)