Skip to content

Commit 7724ebb

Browse files
authored
Merge pull request JideGuru#15 from JideGuru/code-cleanup
Code cleanup
2 parents 1f14d2f + afaa19d commit 7724ebb

File tree

8 files changed

+318
-303
lines changed

8 files changed

+318
-303
lines changed

lib/screens/details.dart

Lines changed: 33 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@ import 'package:flutter/material.dart';
22
import 'package:flutter_travel_concept/util/places.dart';
33
import 'package:flutter_travel_concept/widgets/icon_badge.dart';
44

5-
class Details extends StatefulWidget {
6-
@override
7-
_DetailsState createState() => _DetailsState();
8-
}
9-
10-
class _DetailsState extends State<Details> {
5+
class Details extends StatelessWidget {
116
@override
127
Widget build(BuildContext context) {
138
return Scaffold(
@@ -27,35 +22,10 @@ class _DetailsState extends State<Details> {
2722
),
2823
],
2924
),
30-
3125
body: ListView(
3226
children: <Widget>[
33-
SizedBox(height: 10),
34-
Container(
35-
padding: EdgeInsets.only(left: 20),
36-
height: 250,
37-
child: ListView.builder(
38-
scrollDirection: Axis.horizontal,
39-
primary: false,
40-
itemCount: places == null ? 0 : places.length,
41-
itemBuilder: (BuildContext context, int index) {
42-
Map place = places[index];
43-
44-
return Padding(
45-
padding: EdgeInsets.only(right: 10),
46-
child: ClipRRect(
47-
borderRadius: BorderRadius.circular(10),
48-
child: Image.asset(
49-
"${place["img"]}",
50-
height: 250,
51-
width: MediaQuery.of(context).size.width - 40,
52-
fit: BoxFit.cover,
53-
),
54-
),
55-
);
56-
},
57-
),
58-
),
27+
SizedBox(height: 10.0),
28+
buildSlider(),
5929
SizedBox(height: 20),
6030
ListView(
6131
padding: EdgeInsets.symmetric(horizontal: 20),
@@ -135,45 +105,57 @@ class _DetailsState extends State<Details> {
135105
textAlign: TextAlign.left,
136106
),
137107
),
138-
SizedBox(height: 10),
108+
SizedBox(height: 10.0),
139109
Container(
140110
alignment: Alignment.centerLeft,
141111
child: Text(
142112
"${places[0]["details"]}",
143113
style: TextStyle(
144114
fontWeight: FontWeight.normal,
145-
fontSize: 15,
115+
fontSize: 15.0,
146116
),
147117
textAlign: TextAlign.left,
148118
),
149119
),
150-
SizedBox(height: 10),
120+
SizedBox(height: 10.0),
151121
],
152122
),
153123
],
154124
),
155-
156125
floatingActionButton: FloatingActionButton(
157126
child: Icon(
158127
Icons.airplanemode_active,
159128
),
160129
onPressed: () {},
161130
),
131+
);
132+
}
162133

163-
// bottomNavigationBar: Container(
164-
// height: 50,
165-
// child: RaisedButton(
166-
// elevation: 15,
167-
// color: Theme.of(context).primaryColor,
168-
// child: Text(
169-
// "See Availability",
170-
// style: TextStyle(
171-
// color: Theme.of(context).accentColor,
172-
// ),
173-
// ),
174-
// onPressed: (){},
175-
// ),
176-
// ),
134+
buildSlider() {
135+
return Container(
136+
padding: EdgeInsets.only(left: 20),
137+
height: 250.0,
138+
child: ListView.builder(
139+
scrollDirection: Axis.horizontal,
140+
primary: false,
141+
itemCount: places == null ? 0 : places.length,
142+
itemBuilder: (BuildContext context, int index) {
143+
Map place = places[index];
144+
145+
return Padding(
146+
padding: EdgeInsets.only(right: 10.0),
147+
child: ClipRRect(
148+
borderRadius: BorderRadius.circular(10.0),
149+
child: Image.asset(
150+
"${place["img"]}",
151+
height: 250.0,
152+
width: MediaQuery.of(context).size.width - 40.0,
153+
fit: BoxFit.cover,
154+
),
155+
),
156+
);
157+
},
158+
),
177159
);
178160
}
179161
}

0 commit comments

Comments
 (0)