From 68a9e7f81e4509fc49ad31a9a02afdecd1b66ea3 Mon Sep 17 00:00:00 2001 From: Mus2413 Date: Sun, 28 Mar 2021 00:12:11 +0530 Subject: [PATCH] Overflow problem in Settings Page --- android/app/build.gradle | 4 +- android/build.gradle | 4 +- lib/views/profile/settings/settings_view.dart | 198 +++++------------- lib/widgets/settings_item.dart | 44 ++-- 4 files changed, 79 insertions(+), 171 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 30e8305..b20cdbd 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -27,7 +27,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion 29 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -63,5 +63,5 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 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' + implementation 'com.google.android.gms:play-services-ads:19.8.0' } diff --git a/android/build.gradle b/android/build.gradle index c57831d..65a88d4 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -7,8 +7,8 @@ buildscript { dependencies { classpath 'com.google.gms:google-services:4.3.5' - classpath 'com.android.tools.build:gradle:4.0.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath 'com.android.tools.build:gradle:4.0.2' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61" } } diff --git a/lib/views/profile/settings/settings_view.dart b/lib/views/profile/settings/settings_view.dart index 8db6de8..afce926 100644 --- a/lib/views/profile/settings/settings_view.dart +++ b/lib/views/profile/settings/settings_view.dart @@ -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 @@ -20,11 +21,62 @@ class _SettingsState extends State { @override Widget build(BuildContext context) { + final view = ListView(children: [ + Column(mainAxisAlignment: MainAxisAlignment.center, + children: [ + 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: [ + const SizedBox(height: 70,), + Expanded(child: Row(children: const [ + 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); @@ -32,8 +84,8 @@ class _SettingsState extends State { 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, @@ -46,144 +98,10 @@ class _SettingsState extends State { 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: [ - 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: [ - 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: [ - const SizedBox( - height: 70, - ), - Expanded( - child: Row( - children: const [ - 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,) ), )); } diff --git a/lib/widgets/settings_item.dart b/lib/widgets/settings_item.dart index 04b95df..c59d566 100644 --- a/lib/widgets/settings_item.dart +++ b/lib/widgets/settings_item.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; Widget settingsItem(BuildContext context, String text, IconData ic, @@ -13,36 +14,25 @@ Widget settingsItem(BuildContext context, String text, IconData ic, } } }, - child: Row( - children: [ - 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: [ - 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), - ) - ], + ), + ), ), ); }