Skip to content

Commit

Permalink
Merge pull request #171 from Mus2413/master
Browse files Browse the repository at this point in the history
Overflow Problem in Settings Page
  • Loading branch information
himanshusharma89 authored Mar 28, 2021
2 parents 2062487 + d383f7a commit db75c40
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 169 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ dependencies {
implementation platform('com.google.firebase:firebase-bom:26.6.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.android.gms:play-services-ads:19.7.0'
}
}
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ subprojects {

task clean(type: Delete) {
delete rootProject.buildDir
}
}
198 changes: 58 additions & 140 deletions lib/views/profile/settings/settings_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/widgets/retro_button.dart';
import 'package:retro_shopping/widgets/settings_item.dart';
import 'package:retro_shopping/widgets/stacked_container.dart';

class Settings extends StatefulWidget {
@override
Expand All @@ -20,20 +21,71 @@ class _SettingsState extends State<Settings> {

@override
Widget build(BuildContext context) {
final view = ListView(children: <Widget>[
Column(mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
settingsItem(context, 'Your Orders', Icons.bookmark_border_sharp,
routeName: RouteConstant.ORDERS_SCREEN, push: true,),
Padding(padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),),
settingsItem(context, 'Change Username/\nPassword', Icons.person,
routeName: RouteConstant.CHANGE_USERNAME_SCREEN, push: true,),
Padding(padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),),
settingsItem(context, 'FAQs', Icons.question_answer,
routeName: RouteConstant.FAQs_SCREEN, push: true,),
Padding(padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),),
settingsItem(context, 'Manage Address', Icons.location_pin,
routeName: RouteConstant.ADDRESS_SCREEN, push: true,),
Padding(padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),),
settingsItem(context, 'T&C', Icons.quick_contacts_dialer,
routeName: RouteConstant.TERMS_CONDITIONS, push: true,),
Padding(padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),),
Row(children: <Widget>[
const SizedBox(height: 70,),
Expanded(child: Row(children: const <Widget>[
SizedBox(width: 10,),
Icon(Icons.notifications_active, size: 25, color: Colors.white,),
SizedBox(width: 20,),
Expanded(child: Text('Notifications(on/off)', style: TextStyle(
fontWeight: FontWeight.normal, fontSize: 16)),)
],),),
Switch(value: switchedOn, onChanged: (bool value) {
setState(() {
switchedOn = value;
});
}, activeColor: Colors.white, activeTrackColor: Colors.black,)
],),
Padding(padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),),
settingsItem(context, 'LogOut', Icons.logout,
routeName: RouteConstant.LOGIN_SCREEN, push: false,),
Padding(padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),),
settingsItem(
context, 'GitHub Repo Link', Icons.verified_user_outlined),
Padding(padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),),
],),
]);

return Scaffold(
appBar: AppBar(
backgroundColor: RelicColors.backgroundColor,
leading: Padding(
padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.only(left:14.0, right: 10, top: 15, bottom: 10),
child: GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: RetroButton(
upperColor: Colors.white,
lowerColor: Colors.black,
width: 35,
height: 35,
width: 25,
height: 25,
borderColor: Colors.white,
child: const Icon(
Icons.arrow_back,
Expand All @@ -46,144 +98,10 @@ class _SettingsState extends State<Settings> {
elevation: 0.0,
),
body: Padding(
padding: const EdgeInsets.only(left: 14.0, right: 10.0),
padding: const EdgeInsets.only(left: 20,right: 15,top: 10),
child: SingleChildScrollView(
child: Stack(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width * 0.92 + 10,
height: MediaQuery.of(context).size.height * 0.85 + 10,
decoration: const BoxDecoration(color: Colors.black),
),
Container(
padding:
const EdgeInsets.symmetric(vertical: 16, horizontal: 12),
width: MediaQuery.of(context).size.width * 0.92 - 3,
height: MediaQuery.of(context).size.height * 0.85 + 5,
decoration:
const BoxDecoration(color: RelicColors.primaryColor),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
settingsItem(
context,
'Your Orders',
Icons.bookmark_border_sharp,
routeName: RouteConstant.ORDERS_SCREEN,
push: true,
),
Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(
context,
'Change Username/\nPassword',
Icons.person,
routeName: RouteConstant.CHANGE_USERNAME_SCREEN,
push: true,
),
Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(
context,
'FAQs',
Icons.question_answer,
routeName: RouteConstant.FAQs_SCREEN,
push: true,
),
Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(
context,
'Manage Address',
Icons.location_pin,
routeName: RouteConstant.ADDRESS_SCREEN,
push: true,
),
Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(
context,
'T&C',
Icons.quick_contacts_dialer,
routeName: RouteConstant.TERMS_CONDITIONS,
push: true,
),
Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
Row(
children: <Widget>[
const SizedBox(
height: 70,
),
Expanded(
child: Row(
children: const <Widget>[
SizedBox(
width: 5,
),
Icon(
Icons.notifications_active,
size: 30,
color: Colors.white,
),
SizedBox(
width: 5,
),
Text('Notifications(on/off)',
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 20))
],
),
),
Switch(
value: switchedOn,
onChanged: (bool value) {
setState(() {
switchedOn = value;
});
},
activeColor: Colors.white,
activeTrackColor: Colors.black,
)
],
),
Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(
context,
'LogOut',
Icons.logout,
routeName: RouteConstant.LOGIN_SCREEN,
push: false,
),
Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(context, 'GitHub Repo Link',
Icons.verified_user_outlined),
Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
],
),
),
],
),
child: StackedContainer( height: MediaQuery.of(context).size.height * 0.82 + 10,
width: MediaQuery.of(context).size.width * 0.92 + 10, child: view,)
),
));
}
Expand Down
44 changes: 17 additions & 27 deletions lib/widgets/settings_item.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

Widget settingsItem(BuildContext context, String text, IconData ic,
Expand All @@ -13,36 +14,25 @@ Widget settingsItem(BuildContext context, String text, IconData ic,
}
}
},
child: Row(
children: <Widget>[
const SizedBox(
height: 70,
child: Padding(
padding: const EdgeInsets.only(left: 15,right: 5, top: 10,bottom: 5),
child: ListTile(
contentPadding: EdgeInsets.zero,
dense: true,
leading: Icon(
ic,
size: 20,
color: Colors.white,
),
Expanded(
child: Row(
children: <Widget>[
const SizedBox(
width: 5,
),
Icon(
ic,
size: 30,
color: Colors.white,
),
const SizedBox(
width: 5,
),
Text(text,
style: const TextStyle(
fontWeight: FontWeight.normal, fontSize: 20))
],
),
title: Text(
text, style: const TextStyle(
fontWeight: FontWeight.normal, fontSize: 16) ,
),
IconButton(
onPressed: () {},
trailing: IconButton(
onPressed: (){},
icon: const Icon(Icons.keyboard_arrow_right),
)
],
),
),
),
);
}

0 comments on commit db75c40

Please sign in to comment.