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 60c1ee6

Browse files
Add home page
1 parent 81ba47e commit 60c1ee6

File tree

4 files changed

+394
-129
lines changed

4 files changed

+394
-129
lines changed

‎lib/main.dart

Lines changed: 3 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,10 @@
1-
import 'package:day35/animation/FadeAnimation.dart';
2-
import 'package:day35/models/service.dart';
3-
import 'package:day35/pages/cleaning.dart';
1+
import 'package:day35/pages/home.dart';
2+
import 'package:day35/pages/select_service.dart';
43
import 'package:flutter/material.dart';
54

65
void main () {
76
runApp(MaterialApp(
8-
home: HomePage(),
7+
home: SelectService(),
98
debugShowCheckedModeBanner: false,
109
));
1110
}
12-
13-
class HomePage extends StatefulWidget {
14-
const HomePage({ Key? key }) : super(key: key);
15-
16-
@override
17-
_HomePageState createState() => _HomePageState();
18-
}
19-
20-
class _HomePageState extends State<HomePage> {
21-
List<Service> services = [
22-
Service('Cleaning', 'https://img.icons8.com/external-vitaliy-gorbachev-flat-vitaly-gorbachev/2x/external-cleaning-labour-day-vitaliy-gorbachev-flat-vitaly-gorbachev.png'),
23-
Service('Plumber', 'https://img.icons8.com/external-vitaliy-gorbachev-flat-vitaly-gorbachev/2x/external-plumber-labour-day-vitaliy-gorbachev-flat-vitaly-gorbachev.png'),
24-
Service('Electrician', 'https://img.icons8.com/external-wanicon-flat-wanicon/2x/external-multimeter-car-service-wanicon-flat-wanicon.png'),
25-
Service('Painter', 'https://img.icons8.com/external-itim2101-flat-itim2101/2x/external-painter-male-occupation-avatar-itim2101-flat-itim2101.png'),
26-
Service('Carpenter', 'https://img.icons8.com/fluency/2x/drill.png'),
27-
Service('Gardener', 'https://img.icons8.com/external-itim2101-flat-itim2101/2x/external-gardener-male-occupation-avatar-itim2101-flat-itim2101.png'),
28-
Service('Tailor', 'https://img.icons8.com/fluency/2x/sewing-machine.png'),
29-
Service('Maid', 'https://img.icons8.com/color/2x/housekeeper-female.png'),
30-
Service('Driver', 'https://img.icons8.com/external-sbts2018-lineal-color-sbts2018/2x/external-driver-women-profession-sbts2018-lineal-color-sbts2018.png'),
31-
Service('Cook', 'https://img.icons8.com/external-wanicon-flat-wanicon/2x/external-cooking-daily-routine-wanicon-flat-wanicon.png'),
32-
];
33-
34-
int selectedService = -1;
35-
36-
@override
37-
Widget build(BuildContext context) {
38-
return Scaffold(
39-
backgroundColor: Colors.white,
40-
floatingActionButton: selectedService >= 0 ? FloatingActionButton(
41-
onPressed: () {
42-
Navigator.push(
43-
context,
44-
MaterialPageRoute(
45-
builder: (context) => CleaningPage(),
46-
),
47-
);
48-
},
49-
child: Icon(Icons.arrow_forward_ios, size: 20,),
50-
backgroundColor: Colors.blue,
51-
) : null,
52-
body: NestedScrollView(
53-
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
54-
return <Widget>[
55-
SliverToBoxAdapter(
56-
child: FadeAnimation(1.2, Padding(
57-
padding: EdgeInsets.only(top: 120.0, right: 20.0, left: 20.0),
58-
child: Text(
59-
'Which service \ndo you need?',
60-
style: TextStyle(
61-
fontSize: 40,
62-
color: Colors.grey.shade900,
63-
fontWeight: FontWeight.bold,
64-
),
65-
),
66-
),
67-
))
68-
];
69-
},
70-
body: Padding(
71-
padding: EdgeInsets.all(20.0),
72-
child: Column(
73-
crossAxisAlignment: CrossAxisAlignment.start,
74-
children: <Widget>[
75-
Expanded(
76-
child: GridView.builder(
77-
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
78-
crossAxisCount: 2,
79-
childAspectRatio: 1.0,
80-
crossAxisSpacing: 20.0,
81-
mainAxisSpacing: 20.0,
82-
),
83-
physics: NeverScrollableScrollPhysics(),
84-
itemCount: services.length,
85-
itemBuilder: (BuildContext context, int index) {
86-
return FadeAnimation((1.0 + index) / 4, serviceContainer(services[index].imageURL, services[index].name, index));
87-
}
88-
),
89-
),
90-
]
91-
),
92-
),
93-
)
94-
);
95-
}
96-
97-
serviceContainer(String image, String name, int index) {
98-
return GestureDetector(
99-
onTap: () {
100-
setState(() {
101-
if (selectedService == index)
102-
selectedService = -1;
103-
else
104-
selectedService = index;
105-
});
106-
},
107-
child: AnimatedContainer(
108-
duration: Duration(milliseconds: 300),
109-
padding: EdgeInsets.all(10.0),
110-
decoration: BoxDecoration(
111-
color: selectedService == index ? Colors.blue.shade50 : Colors.grey.shade100,
112-
border: Border.all(
113-
color: selectedService == index ? Colors.blue : Colors.blue.withOpacity(0),
114-
width: 2.0,
115-
),
116-
borderRadius: BorderRadius.circular(20.0),
117-
),
118-
child: Column(
119-
mainAxisAlignment: MainAxisAlignment.center,
120-
children: <Widget>[
121-
Image.network(image, height: 80),
122-
SizedBox(height: 20,),
123-
Text(name, style: TextStyle(fontSize: 20),)
124-
]
125-
),
126-
),
127-
);
128-
}
129-
}

‎lib/pages/date_time.dart

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:day35/animation/FadeAnimation.dart';
2+
import 'package:day35/pages/home.dart';
23
import 'package:flutter/material.dart';
34
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
45

@@ -117,8 +118,6 @@ class _DateAndTimeState extends State<DateAndTime> {
117118

118119
@override
119120
void initState() {
120-
// TODO: implement initState
121-
122121
Future.delayed(Duration(milliseconds: 500), () {
123122
_scrollController.scrollTo(
124123
index: 24,
@@ -135,7 +134,14 @@ class _DateAndTimeState extends State<DateAndTime> {
135134
return Scaffold(
136135
backgroundColor: Colors.white,
137136
floatingActionButton: FloatingActionButton(
138-
onPressed: () {},
137+
onPressed: () {
138+
Navigator.push(
139+
context,
140+
MaterialPageRoute(
141+
builder: (context) => HomePage(),
142+
),
143+
);
144+
},
139145
child: Icon(Icons.arrow_forward_ios),
140146
),
141147
body: NestedScrollView(
@@ -215,7 +221,7 @@ class _DateAndTimeState extends State<DateAndTime> {
215221
),
216222
),
217223
SizedBox(height: 10,),
218-
Container(
224+
FadeAnimation(1.2, Container(
219225
height: 60,
220226
decoration: BoxDecoration(
221227
borderRadius: BorderRadius.circular(10),
@@ -227,7 +233,7 @@ class _DateAndTimeState extends State<DateAndTime> {
227233
scrollDirection: Axis.horizontal,
228234
itemCount: _hours.length,
229235
itemBuilder: (BuildContext context, int index) {
230-
return FadeAnimation((1+ index) /6, GestureDetector(
236+
return GestureDetector(
231237
onTap: () {
232238
setState(() {
233239
_selectedHour = _hours[index];
@@ -251,10 +257,10 @@ class _DateAndTimeState extends State<DateAndTime> {
251257
],
252258
),
253259
),
254-
));
260+
);
255261
}
256262
),
257-
),
263+
)),
258264
SizedBox(height: 40,),
259265
FadeAnimation(1.2, Text("Repeat", style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),)),
260266
SizedBox(height: 10,),

0 commit comments

Comments
(0)

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