Skip to content

Commit 4f5b2fa

Browse files
authored
added disease selection page
1 parent dd54b53 commit 4f5b2fa

File tree

1 file changed

+201
-0
lines changed

1 file changed

+201
-0
lines changed
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
import 'package:flutter/material.dart';
2+
3+
class UserDiseaseSelect extends StatefulWidget {
4+
@override
5+
_UserDiseaseSelectState createState() => _UserDiseaseSelectState();
6+
}
7+
8+
class _UserDiseaseSelectState extends State<UserDiseaseSelect> with TickerProviderStateMixin {
9+
AnimationController _controller;
10+
Animation<Offset> _offsetFloat1;
11+
Animation<Offset> _offsetFloat2;
12+
13+
@override
14+
void initState() {
15+
super.initState();
16+
17+
_controller = AnimationController(
18+
vsync: this,
19+
duration: const Duration(seconds: 2),
20+
);
21+
22+
_offsetFloat1 = Tween<Offset>(begin: Offset(2.0, 0.0), end: Offset.zero)
23+
.animate(_controller);
24+
25+
_offsetFloat1.addListener(() {
26+
setState(() {});
27+
});
28+
29+
_offsetFloat2 = Tween<Offset>(begin: Offset(-2.0, 0.0), end: Offset.zero)
30+
.animate(_controller);
31+
32+
_offsetFloat2.addListener(() {
33+
setState(() {});
34+
});
35+
36+
_controller.forward();
37+
}
38+
39+
@override
40+
void dispose() {
41+
_controller.dispose();
42+
super.dispose();
43+
}
44+
45+
// Stroke, liver, heart, diabetes, cancer, malaria, fetal_health
46+
47+
@override
48+
Widget build(BuildContext context) {
49+
return Scaffold(
50+
body: SafeArea(
51+
child: ListView(
52+
children: [
53+
Padding(
54+
padding: const EdgeInsets.only(top: 20.0, left: 20.0, right: 20.0),
55+
child: Row(
56+
children: [
57+
58+
Spacer(),
59+
60+
],
61+
),
62+
),
63+
Padding(
64+
padding:
65+
const EdgeInsets.only(top: 20.0, left: 10.0, right: 10.0),
66+
child:
67+
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
68+
Text(
69+
'Select disease',
70+
style: TextStyle(fontSize: 35.0, fontFamily: 'Langar'),
71+
),
72+
])),
73+
SlideTransition(
74+
position: _offsetFloat1,
75+
child: GestureDetector(
76+
onTap: () {},
77+
child: Padding(
78+
padding: const EdgeInsets.only(
79+
top: 80.0, right: 10.0, left: 70.0, bottom: 20.0),
80+
child: CategoriesLayout( categoryName: 'Heart Disease', imageUrl:'assets/images/heart.jpg'),
81+
),
82+
),),
83+
SlideTransition(
84+
position: _offsetFloat2,
85+
child: GestureDetector(
86+
onTap: () {
87+
Navigator.pushNamed(context, '/cancer');
88+
},
89+
child: Padding(
90+
padding: const EdgeInsets.only(
91+
top: 20.0, right: 70.0, left: 10.0, bottom: 20.0),
92+
child: CategoriesLayout(categoryName:'Cancer', imageUrl:'assets/images/cancer.jpg')
93+
)
94+
),
95+
),
96+
SlideTransition(
97+
position: _offsetFloat1,
98+
child: GestureDetector(
99+
onTap: () {},
100+
child: Padding(
101+
padding: const EdgeInsets.only(
102+
top: 20.0, right: 10.0, left: 70.0, bottom: 20.0),
103+
child: CategoriesLayout(categoryName:'Diabetes', imageUrl:'assets/images/diabetes.jpg')
104+
)
105+
),
106+
),
107+
SlideTransition(
108+
position: _offsetFloat2,
109+
child: GestureDetector(
110+
onTap: () {},
111+
child: Padding(
112+
padding: const EdgeInsets.only(
113+
top: 20.0, right: 70.0, left: 10.0, bottom: 20.0),
114+
child: CategoriesLayout(categoryName:'Liver Disease', imageUrl:'assets/images/liver.jpg')
115+
)
116+
),
117+
),
118+
SlideTransition(
119+
position: _offsetFloat1,
120+
child: GestureDetector(
121+
onTap: () {},
122+
child: Padding(
123+
padding: const EdgeInsets.only(
124+
top: 20.0, right: 10.0, left: 70.0, bottom: 20.0),
125+
child: CategoriesLayout(categoryName:'Stroke Disease', imageUrl:'assets/images/stroke.jpg')
126+
)
127+
),
128+
),
129+
SlideTransition(
130+
position: _offsetFloat2,
131+
child: GestureDetector(
132+
onTap: () {},
133+
child: Padding(
134+
padding: const EdgeInsets.only(
135+
top: 20.0, right: 70.0, left: 10.0, bottom: 20.0),
136+
child: CategoriesLayout(categoryName:'Fetal Health', imageUrl:'assets/images/fetal.jpg')
137+
)
138+
),
139+
)
140+
]
141+
142+
),
143+
),
144+
);
145+
}
146+
}
147+
148+
//-------------------- Category Class ---------------------------//
149+
class CategoriesLayout extends StatelessWidget {
150+
final String imageUrl;
151+
final String categoryName;
152+
153+
CategoriesLayout({this.imageUrl, this.categoryName});
154+
155+
@override
156+
Widget build(BuildContext context) {
157+
return Container(
158+
width: MediaQuery.of(context).size.width,
159+
height: 200,
160+
child: Stack(
161+
children: [
162+
Container(
163+
width: MediaQuery.of(context).size.width,
164+
height: 200,
165+
decoration: BoxDecoration(
166+
borderRadius: BorderRadius.circular(15),
167+
image: DecorationImage(
168+
image: AssetImage(imageUrl), fit: BoxFit.cover),
169+
boxShadow: [
170+
BoxShadow(
171+
color: Theme.of(context).primaryColor,
172+
blurRadius: 10,
173+
spreadRadius: 0,
174+
offset: Offset(2, 2))
175+
],
176+
),
177+
),
178+
Container(
179+
alignment: Alignment.center,
180+
width: MediaQuery.of(context).size.width,
181+
height: 200,
182+
decoration: BoxDecoration(
183+
borderRadius: BorderRadius.circular(15),
184+
color: Colors.black.withOpacity(0.6),
185+
),
186+
child: Text(
187+
categoryName,
188+
style: TextStyle(
189+
color: Colors.white,
190+
fontWeight: FontWeight.w500,
191+
fontSize: 35,
192+
letterSpacing: 1,
193+
fontFamily: 'Langar',
194+
),
195+
),
196+
),
197+
],
198+
),
199+
);
200+
}
201+
}

0 commit comments

Comments
 (0)