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 69bcf5b

Browse files
add SingleChildScrollView for fix overflowed
1 parent 42188a6 commit 69bcf5b

File tree

1 file changed

+129
-109
lines changed

1 file changed

+129
-109
lines changed

‎lib/main.dart

Lines changed: 129 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import 'package:flutter/material.dart';
22

3-
void main() => runApp(
4-
MaterialApp(
5-
debugShowCheckedModeBanner: false,
6-
theme: ThemeData(fontFamily: 'Roboto'),
7-
home: HomePage(),
8-
)
9-
);
3+
void main() => runApp(MaterialApp(
4+
debugShowCheckedModeBanner: false,
5+
theme: ThemeData(fontFamily: 'Roboto'),
6+
home: HomePage(),
7+
));
108

119
class HomePage extends StatefulWidget {
1210
@override
@@ -23,112 +21,139 @@ class _HomePageState extends State<HomePage> {
2321
brightness: Brightness.light,
2422
elevation: 0,
2523
leading: IconButton(
26-
icon: Icon(Icons.menu, color: Colors.black87,),
24+
icon: Icon(
25+
Icons.menu,
26+
color: Colors.black87,
27+
),
2728
onPressed: () {},
2829
),
2930
),
3031
body: SafeArea(
31-
child: Column(
32-
crossAxisAlignment: CrossAxisAlignment.start,
33-
children: <Widget>[
34-
Container(
35-
width: double.infinity,
36-
decoration: BoxDecoration(
37-
color: Colors.white,
38-
borderRadius: BorderRadius.vertical(bottom: Radius.circular(30))
39-
),
40-
padding: EdgeInsets.all(20.0),
41-
child: Column(
42-
crossAxisAlignment: CrossAxisAlignment.start,
43-
children: <Widget>[
44-
Text('Find Your', style: TextStyle(color: Colors.black87, fontSize: 25),),
45-
SizedBox(
46-
height: 5,
47-
),
48-
Text('Inspiration', style: TextStyle(color: Colors.black, fontSize: 40, fontWeight: FontWeight.bold),),
49-
SizedBox(
50-
height: 20,
51-
),
52-
Container(
53-
padding: EdgeInsets.all(5),
54-
decoration: BoxDecoration(
55-
color: Color.fromRGBO(244, 243, 243, 1),
56-
borderRadius: BorderRadius.circular(15)
32+
child: SingleChildScrollView(
33+
child: Column(
34+
crossAxisAlignment: CrossAxisAlignment.start,
35+
children: <Widget>[
36+
Container(
37+
width: double.infinity,
38+
decoration: BoxDecoration(
39+
color: Colors.white,
40+
borderRadius:
41+
BorderRadius.vertical(bottom: Radius.circular(30))),
42+
padding: EdgeInsets.all(20.0),
43+
child: Column(
44+
crossAxisAlignment: CrossAxisAlignment.start,
45+
children: <Widget>[
46+
Text(
47+
'Find Your',
48+
style: TextStyle(color: Colors.black87, fontSize: 25),
49+
),
50+
SizedBox(
51+
height: 5,
52+
),
53+
Text(
54+
'Inspiration',
55+
style: TextStyle(
56+
color: Colors.black,
57+
fontSize: 40,
58+
fontWeight: FontWeight.bold),
59+
),
60+
SizedBox(
61+
height: 20,
5762
),
58-
child: TextField(
59-
decoration: InputDecoration(
60-
border: InputBorder.none,
61-
prefixIcon: Icon(Icons.search, color: Colors.black87,),
62-
hintText: "Search you're looking for",
63-
hintStyle: TextStyle(color: Colors.grey, fontSize: 15)
63+
Container(
64+
padding: EdgeInsets.all(5),
65+
decoration: BoxDecoration(
66+
color: Color.fromRGBO(244, 243, 243, 1),
67+
borderRadius: BorderRadius.circular(15)),
68+
child: TextField(
69+
decoration: InputDecoration(
70+
border: InputBorder.none,
71+
prefixIcon: Icon(
72+
Icons.search,
73+
color: Colors.black87,
74+
),
75+
hintText: "Search you're looking for",
76+
hintStyle:
77+
TextStyle(color: Colors.grey, fontSize: 15)),
6478
),
6579
),
66-
),
67-
SizedBox(
68-
height:10,
69-
),
70-
],
80+
SizedBox(
81+
height:10,
82+
),
83+
],
84+
),
7185
),
72-
),
73-
SizedBox(
74-
height: 20,
75-
),
76-
Padding(
77-
padding: const EdgeInsets.symmetric(horizontal: 20.0),
78-
child: Column(
79-
crossAxisAlignment: CrossAxisAlignment.start,
80-
children: <Widget>[
81-
Text('Promo Today', style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),),
82-
SizedBox(height: 15,),
83-
Container(
84-
height: 200,
85-
child: ListView(
86-
scrollDirection: Axis.horizontal,
87-
children: <Widget>[
88-
promoCard('assets/images/one.jpg'),
89-
promoCard('assets/images/two.jpg'),
90-
promoCard('assets/images/three.jpg'),
91-
promoCard('assets/images/four.jpg'),
92-
],
86+
SizedBox(
87+
height: 20,
88+
),
89+
Padding(
90+
padding: const EdgeInsets.symmetric(horizontal: 20.0),
91+
child: Column(
92+
crossAxisAlignment: CrossAxisAlignment.start,
93+
children: <Widget>[
94+
Text(
95+
'Promo Today',
96+
style:
97+
TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
98+
),
99+
SizedBox(
100+
height: 15,
93101
),
94-
),
95-
SizedBox(
96-
height: 20,
97-
),
98-
Container(
99-
height: 150,
100-
decoration: BoxDecoration(
101-
borderRadius: BorderRadius.circular(20),
102-
image: DecorationImage(
103-
fit: BoxFit.cover,
104-
image: AssetImage('assets/images/three.jpg')
102+
Container(
103+
height: 200,
104+
child: ListView(
105+
scrollDirection: Axis.horizontal,
106+
children: <Widget>[
107+
promoCard('assets/images/one.jpg'),
108+
promoCard('assets/images/two.jpg'),
109+
promoCard('assets/images/three.jpg'),
110+
promoCard('assets/images/four.jpg'),
111+
],
105112
),
106113
),
107-
child: Container(
114+
SizedBox(
115+
height: 20,
116+
),
117+
Container(
118+
height: 150,
108119
decoration: BoxDecoration(
109120
borderRadius: BorderRadius.circular(20),
110-
gradient: LinearGradient(
111-
begin: Alignment.bottomRight,
112-
stops: [0.3, 0.9],
113-
colors: [
114-
Colors.black.withOpacity(.8),
115-
Colors.black.withOpacity(.2)
116-
]
117-
),
121+
image: DecorationImage(
122+
fit: BoxFit.cover,
123+
image: AssetImage('assets/images/three.jpg')),
118124
),
119-
child: Align(
120-
alignment: Alignment.bottomLeft,
121-
child: Padding(
122-
padding: const EdgeInsets.all(15.0),
123-
child: Text('Best Design', style: TextStyle(color: Colors.white, fontSize: 20),),
125+
child: Container(
126+
decoration: BoxDecoration(
127+
borderRadius: BorderRadius.circular(20),
128+
gradient: LinearGradient(
129+
begin: Alignment.bottomRight,
130+
stops: [
131+
0.3,
132+
0.9
133+
],
134+
colors: [
135+
Colors.black.withOpacity(.8),
136+
Colors.black.withOpacity(.2)
137+
]),
138+
),
139+
child: Align(
140+
alignment: Alignment.bottomLeft,
141+
child: Padding(
142+
padding: const EdgeInsets.all(15.0),
143+
child: Text(
144+
'Best Design',
145+
style:
146+
TextStyle(color: Colors.white, fontSize: 20),
147+
),
148+
),
124149
),
125150
),
126-
),
127-
)
128-
],
129-
),
130-
)
131-
],
151+
)
152+
],
153+
),
154+
)
155+
],
156+
),
132157
),
133158
),
134159
);
@@ -141,23 +166,18 @@ class _HomePageState extends State<HomePage> {
141166
margin: EdgeInsets.only(right: 15.0),
142167
decoration: BoxDecoration(
143168
borderRadius: BorderRadius.circular(20),
144-
image: DecorationImage(
145-
fit: BoxFit.cover,
146-
image: AssetImage(image)
147-
),
169+
image: DecorationImage(fit: BoxFit.cover, image: AssetImage(image)),
148170
),
149171
child: Container(
150172
decoration: BoxDecoration(
151-
borderRadius: BorderRadius.circular(20),
152-
gradient: LinearGradient(
153-
begin:Alignment.bottomRight,
154-
stops: [0.1, 0.9],
155-
colors: [
173+
borderRadius: BorderRadius.circular(20),
174+
gradient: LinearGradient(begin:Alignment.bottomRight, stops: [
175+
0.1,
176+
0.9
177+
], colors: [
156178
Colors.black.withOpacity(.8),
157179
Colors.black.withOpacity(.1)
158-
]
159-
)
160-
),
180+
])),
161181
),
162182
),
163183
);

0 commit comments

Comments
(0)

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