Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d4a137c

Browse files
Add home page design
1 parent 878ae97 commit d4a137c

File tree

5 files changed

+447
-69
lines changed

5 files changed

+447
-69
lines changed

‎lib/main.dart

Lines changed: 29 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import 'package:day34/pages/explore.dart';
2+
import 'package:day34/pages/notification.dart';
3+
import 'package:day34/pages/profile.dart';
4+
import 'package:day34/pages/search.dart';
15
import 'package:flashy_tab_bar/flashy_tab_bar.dart';
26
import 'package:flutter/material.dart';
37

@@ -16,86 +20,42 @@ class HomePage extends StatefulWidget {
1620
}
1721

1822
class _HomePageState extends State<HomePage> {
19-
int _selectedIndex = 0;
23+
late PageController _myPage;
24+
int _selectedPage = 0;
25+
26+
List<Widget> pages = [
27+
ExplorePage(),
28+
SearchPage(),
29+
NotificationPage(),
30+
ProfilePage()
31+
];
2032

2133
void _onItemTapped(int index) {
2234
setState(() {
23-
_selectedIndex = index;
35+
_selectedPage = index;
36+
_myPage.jumpToPage(index);
2437
});
2538
}
2639

40+
@override
41+
void initState() {
42+
// TODO: implement initState
43+
_myPage = PageController(initialPage: 0);
44+
45+
super.initState();
46+
}
47+
2748
@override
2849
Widget build(BuildContext context) {
2950
return Scaffold(
30-
body: SingleChildScrollView(
31-
child: Column(
32-
crossAxisAlignment: CrossAxisAlignment.start,
33-
children: [
34-
Container(
35-
padding: EdgeInsets.all(20),
36-
width: double.infinity,
37-
height: 350,
38-
decoration: BoxDecoration(
39-
image: DecorationImage(
40-
image: AssetImage('assets/images/background.png'),
41-
fit: BoxFit.cover,
42-
),
43-
),
44-
child: Column(
45-
crossAxisAlignment: CrossAxisAlignment.start,
46-
children: [
47-
SizedBox(height: 80,),
48-
Text("Find your 2021 Collections", style: TextStyle(color: Colors.black, fontSize: 40, height: 1.4),),
49-
SizedBox(height: 40,),
50-
Container(
51-
width: double.infinity,
52-
height: 60,
53-
child: Row(
54-
children: [
55-
Expanded(
56-
child: Container(
57-
height: 60,
58-
child: TextField(
59-
cursorColor: Colors.grey,
60-
decoration: InputDecoration(
61-
contentPadding: EdgeInsets.symmetric(horizontal: 20, vertical: 20),
62-
filled: true,
63-
fillColor: Colors.white,
64-
prefixIcon: Icon(Icons.search, color: Colors.black),
65-
border: OutlineInputBorder(
66-
borderRadius: BorderRadius.circular(10),
67-
borderSide: BorderSide.none
68-
),
69-
hintText: "Search e.g Login Page",
70-
hintStyle: TextStyle(fontSize: 14, color: Colors.black),
71-
72-
),
73-
),
74-
),
75-
),
76-
SizedBox(width: 20),
77-
Container(
78-
padding: EdgeInsets.all(10),
79-
decoration: BoxDecoration(
80-
color: Colors.white,
81-
borderRadius: BorderRadius.circular(10)
82-
),
83-
child: IconButton(
84-
onPressed: () {},
85-
icon: Icon(Icons.filter_list, size: 30,),
86-
),
87-
)
88-
],
89-
),
90-
),
91-
],
92-
),
93-
),
94-
],
95-
),
51+
body: PageView(
52+
controller: _myPage,
53+
children: [
54+
...pages
55+
],
9656
),
9757
bottomNavigationBar: FlashyTabBar(
98-
selectedIndex: _selectedIndex,
58+
selectedIndex: _selectedPage,
9959
showElevation: false,
10060
onItemSelected: (index) => _onItemTapped(index),
10161
items: [

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /