Skip to content

Commit db75c40

Browse files
Merge pull request #171 from Mus2413/master
Overflow Problem in Settings Page
2 parents 2062487 + d383f7a commit db75c40

File tree

4 files changed

+77
-169
lines changed

4 files changed

+77
-169
lines changed

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ dependencies {
6464
implementation platform('com.google.firebase:firebase-bom:26.6.0')
6565
implementation 'com.google.firebase:firebase-analytics'
6666
implementation 'com.google.android.gms:play-services-ads:19.7.0'
67-
}
67+
}

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ subprojects {
2929

3030
task clean(type: Delete) {
3131
delete rootProject.buildDir
32-
}
32+
}

lib/views/profile/settings/settings_view.dart

Lines changed: 58 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
22
import 'package:retro_shopping/helpers/constants.dart';
33
import 'package:retro_shopping/widgets/retro_button.dart';
44
import 'package:retro_shopping/widgets/settings_item.dart';
5+
import 'package:retro_shopping/widgets/stacked_container.dart';
56

67
class Settings extends StatefulWidget {
78
@override
@@ -20,20 +21,71 @@ class _SettingsState extends State<Settings> {
2021

2122
@override
2223
Widget build(BuildContext context) {
24+
final view = ListView(children: <Widget>[
25+
Column(mainAxisAlignment: MainAxisAlignment.center,
26+
children: <Widget>[
27+
settingsItem(context, 'Your Orders', Icons.bookmark_border_sharp,
28+
routeName: RouteConstant.ORDERS_SCREEN, push: true,),
29+
Padding(padding: const EdgeInsets.only(left: 16.0, right: 16.0),
30+
child: divider(),),
31+
settingsItem(context, 'Change Username/\nPassword', Icons.person,
32+
routeName: RouteConstant.CHANGE_USERNAME_SCREEN, push: true,),
33+
Padding(padding: const EdgeInsets.only(left: 16.0, right: 16.0),
34+
child: divider(),),
35+
settingsItem(context, 'FAQs', Icons.question_answer,
36+
routeName: RouteConstant.FAQs_SCREEN, push: true,),
37+
Padding(padding: const EdgeInsets.only(left: 16.0, right: 16.0),
38+
child: divider(),),
39+
settingsItem(context, 'Manage Address', Icons.location_pin,
40+
routeName: RouteConstant.ADDRESS_SCREEN, push: true,),
41+
Padding(padding: const EdgeInsets.only(left: 16.0, right: 16.0),
42+
child: divider(),),
43+
settingsItem(context, 'T&C', Icons.quick_contacts_dialer,
44+
routeName: RouteConstant.TERMS_CONDITIONS, push: true,),
45+
Padding(padding: const EdgeInsets.only(left: 16.0, right: 16.0),
46+
child: divider(),),
47+
Row(children: <Widget>[
48+
const SizedBox(height: 70,),
49+
Expanded(child: Row(children: const <Widget>[
50+
SizedBox(width: 10,),
51+
Icon(Icons.notifications_active, size: 25, color: Colors.white,),
52+
SizedBox(width: 20,),
53+
Expanded(child: Text('Notifications(on/off)', style: TextStyle(
54+
fontWeight: FontWeight.normal, fontSize: 16)),)
55+
],),),
56+
Switch(value: switchedOn, onChanged: (bool value) {
57+
setState(() {
58+
switchedOn = value;
59+
});
60+
}, activeColor: Colors.white, activeTrackColor: Colors.black,)
61+
],),
62+
Padding(padding: const EdgeInsets.only(left: 16.0, right: 16.0),
63+
child: divider(),),
64+
settingsItem(context, 'LogOut', Icons.logout,
65+
routeName: RouteConstant.LOGIN_SCREEN, push: false,),
66+
Padding(padding: const EdgeInsets.only(left: 16.0, right: 16.0),
67+
child: divider(),),
68+
settingsItem(
69+
context, 'GitHub Repo Link', Icons.verified_user_outlined),
70+
Padding(padding: const EdgeInsets.only(left: 16.0, right: 16.0),
71+
child: divider(),),
72+
],),
73+
]);
74+
2375
return Scaffold(
2476
appBar: AppBar(
2577
backgroundColor: RelicColors.backgroundColor,
2678
leading: Padding(
27-
padding: const EdgeInsets.all(8.0),
79+
padding: const EdgeInsets.only(left:14.0, right: 10, top: 15, bottom: 10),
2880
child: GestureDetector(
2981
onTap: () {
3082
Navigator.pop(context);
3183
},
3284
child: RetroButton(
3385
upperColor: Colors.white,
3486
lowerColor: Colors.black,
35-
width: 35,
36-
height: 35,
87+
width: 25,
88+
height: 25,
3789
borderColor: Colors.white,
3890
child: const Icon(
3991
Icons.arrow_back,
@@ -46,144 +98,10 @@ class _SettingsState extends State<Settings> {
4698
elevation: 0.0,
4799
),
48100
body: Padding(
49-
padding: const EdgeInsets.only(left: 14.0, right: 10.0),
101+
padding: const EdgeInsets.only(left: 20,right: 15,top: 10),
50102
child: SingleChildScrollView(
51-
child: Stack(
52-
children: <Widget>[
53-
Container(
54-
width: MediaQuery.of(context).size.width * 0.92 + 10,
55-
height: MediaQuery.of(context).size.height * 0.85 + 10,
56-
decoration: const BoxDecoration(color: Colors.black),
57-
),
58-
Container(
59-
padding:
60-
const EdgeInsets.symmetric(vertical: 16, horizontal: 12),
61-
width: MediaQuery.of(context).size.width * 0.92 - 3,
62-
height: MediaQuery.of(context).size.height * 0.85 + 5,
63-
decoration:
64-
const BoxDecoration(color: RelicColors.primaryColor),
65-
child: Column(
66-
mainAxisAlignment: MainAxisAlignment.center,
67-
children: <Widget>[
68-
settingsItem(
69-
context,
70-
'Your Orders',
71-
Icons.bookmark_border_sharp,
72-
routeName: RouteConstant.ORDERS_SCREEN,
73-
push: true,
74-
),
75-
Padding(
76-
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
77-
child: divider(),
78-
),
79-
settingsItem(
80-
context,
81-
'Change Username/\nPassword',
82-
Icons.person,
83-
routeName: RouteConstant.CHANGE_USERNAME_SCREEN,
84-
push: true,
85-
),
86-
Padding(
87-
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
88-
child: divider(),
89-
),
90-
settingsItem(
91-
context,
92-
'FAQs',
93-
Icons.question_answer,
94-
routeName: RouteConstant.FAQs_SCREEN,
95-
push: true,
96-
),
97-
Padding(
98-
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
99-
child: divider(),
100-
),
101-
settingsItem(
102-
context,
103-
'Manage Address',
104-
Icons.location_pin,
105-
routeName: RouteConstant.ADDRESS_SCREEN,
106-
push: true,
107-
),
108-
Padding(
109-
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
110-
child: divider(),
111-
),
112-
settingsItem(
113-
context,
114-
'T&C',
115-
Icons.quick_contacts_dialer,
116-
routeName: RouteConstant.TERMS_CONDITIONS,
117-
push: true,
118-
),
119-
Padding(
120-
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
121-
child: divider(),
122-
),
123-
Row(
124-
children: <Widget>[
125-
const SizedBox(
126-
height: 70,
127-
),
128-
Expanded(
129-
child: Row(
130-
children: const <Widget>[
131-
SizedBox(
132-
width: 5,
133-
),
134-
Icon(
135-
Icons.notifications_active,
136-
size: 30,
137-
color: Colors.white,
138-
),
139-
SizedBox(
140-
width: 5,
141-
),
142-
Text('Notifications(on/off)',
143-
style: TextStyle(
144-
fontWeight: FontWeight.normal,
145-
fontSize: 20))
146-
],
147-
),
148-
),
149-
Switch(
150-
value: switchedOn,
151-
onChanged: (bool value) {
152-
setState(() {
153-
switchedOn = value;
154-
});
155-
},
156-
activeColor: Colors.white,
157-
activeTrackColor: Colors.black,
158-
)
159-
],
160-
),
161-
Padding(
162-
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
163-
child: divider(),
164-
),
165-
settingsItem(
166-
context,
167-
'LogOut',
168-
Icons.logout,
169-
routeName: RouteConstant.LOGIN_SCREEN,
170-
push: false,
171-
),
172-
Padding(
173-
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
174-
child: divider(),
175-
),
176-
settingsItem(context, 'GitHub Repo Link',
177-
Icons.verified_user_outlined),
178-
Padding(
179-
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
180-
child: divider(),
181-
),
182-
],
183-
),
184-
),
185-
],
186-
),
103+
child: StackedContainer( height: MediaQuery.of(context).size.height * 0.82 + 10,
104+
width: MediaQuery.of(context).size.width * 0.92 + 10, child: view,)
187105
),
188106
));
189107
}

lib/widgets/settings_item.dart

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:flutter/cupertino.dart';
12
import 'package:flutter/material.dart';
23

34
Widget settingsItem(BuildContext context, String text, IconData ic,
@@ -13,36 +14,25 @@ Widget settingsItem(BuildContext context, String text, IconData ic,
1314
}
1415
}
1516
},
16-
child: Row(
17-
children: <Widget>[
18-
const SizedBox(
19-
height: 70,
17+
child: Padding(
18+
padding: const EdgeInsets.only(left: 15,right: 5, top: 10,bottom: 5),
19+
child: ListTile(
20+
contentPadding: EdgeInsets.zero,
21+
dense: true,
22+
leading: Icon(
23+
ic,
24+
size: 20,
25+
color: Colors.white,
2026
),
21-
Expanded(
22-
child: Row(
23-
children: <Widget>[
24-
const SizedBox(
25-
width: 5,
26-
),
27-
Icon(
28-
ic,
29-
size: 30,
30-
color: Colors.white,
31-
),
32-
const SizedBox(
33-
width: 5,
34-
),
35-
Text(text,
36-
style: const TextStyle(
37-
fontWeight: FontWeight.normal, fontSize: 20))
38-
],
39-
),
27+
title: Text(
28+
text, style: const TextStyle(
29+
fontWeight: FontWeight.normal, fontSize: 16) ,
4030
),
41-
IconButton(
42-
onPressed: () {},
31+
trailing: IconButton(
32+
onPressed: (){},
4333
icon: const Icon(Icons.keyboard_arrow_right),
44-
)
45-
],
34+
),
35+
),
4636
),
4737
);
4838
}

0 commit comments

Comments
 (0)