joneldominic / personal-finance-management-app

Personal Finance Management App
GNU General Public License v3.0
2 stars 2 forks source link

Add Back button Confirmation on Home Screen (WillPop - Double tap back to close) #66

Open joneldominic opened 1 year ago

valentine-bvc commented 1 year ago

Accepting any newbies? Don't have any experience with dart or cmake yet but i've been learning c++ for the past couple months now, willing to help anybody with whatever i can so i am willing to give this a try if. Cheers!

joneldominic commented 1 year ago

Yes, very much welcome. By the way, this project is built with Flutter. You can give it a try.

valentine-bvc commented 1 year ago

Update: I am still working on this if nobody else is taking care of it, i managed to install flutter and everything else including the dependencies necessary and other libraries since i kept getting errors in visual studio code and after some fiddling i got to run the app for testing on a VM, will look for some documentation files on flutter soon since i've never touched flutter or dart and implement the feature if possible with a WillPopScope widget. Cheers!

joneldominic commented 1 year ago

That's great. Don't hesitate to ping me in case you encounter some blockers regarding the setup.

valentine-bvc commented 1 year ago

Hello, I'm back with a little update, I'm still working on it and sorry for the holdup, it's just a lot to learn but I have a couple of points I could use some assistance with:

Sorry if any of my points are stupid. I don't know much about flutter/dart atm nor have I ever worked on a real project so I've doing this as I document myself and learn. I'd love to hear your thoughts about all of this. Cheers!

joneldominic commented 1 year ago

Hello, sorry for the late response. I just got other priorities in the past few days. Great to hear about your progress. I'll answer your queries one at a time.

joneldominic commented 1 year ago

I don't know if you're building this on windows or not but I've been required to do a couple extra steps to get the project to run on my setup (windows with visual studio code and android manager used as a AVD) but I would be happy to help with documentation if necessary

Yes, I'm also using windows. That would be great. You can add more set-up details on the README.md::Getting-Started section.

joneldominic commented 1 year ago

https://github.com/joneldominic/personal-finance-management-app/commit/bdc1438f2a33e86d40d880105b2882dfa88bfd86 is the latest commit I've been working with, and because once I push the commit I want you to have an easy time merging with the latest develop branch possible, I've downloaded the latest commit https://github.com/joneldominic/personal-finance-management-app/commit/38307d138ad2ce6e2daaedd3e5580a454dab3172 as of 6th of march as a separate project and I've run out of options, updated everything (followed the readme too) including all the latest dependencies but I keep getting errors of my flutter missing some whatsap icons which causes the build to fail every time I execute 'flutter run'

Hmmm, interesting. Did you fork the repo? If not, I think it would be better to fork it first, then apply your changes. When done, you can just directly create a pull request so that I can review and merge it.

Another thing, did you run flutter pub run build_runner build --delete-conflicting-outputs upon getting the latest changes/commit?

joneldominic commented 1 year ago

because I've had to upgrade all my dependencies to get commit https://github.com/joneldominic/personal-finance-management-app/commit/bdc1438f2a33e86d40d880105b2882dfa88bfd86 running I've been getting a bunch of warnings about deprecated classes and what not that should be replaced (ex: 'ReactiveServiceMixin' is deprecated and it's asking me to replace it with 'ListenableServiceMixin' instead, 'onModelReady' replace with onViewModelReady instead and a couple more. What do you think? Should we ignore this or update the classes? it's only a handful but I think it does require the latest dependencies possible updated in the 'pubspec.yaml' else i need to run 'flutter pub get' 'flutter pub upgrade' and a couple others every time i set up the project

In the meantime, I think it would be better to just retain our dependencies' version. We'll just have a separate issue for upgrading the dependencies if necessary.

joneldominic commented 1 year ago

i have managed to add a quit confirm on the homepage, you will get a popup asking if you want to quit the app and you have to options yes (or exit) and no (or cancel), It is not the design you had it mind I believe but I did manage to implement the double tap to exit along with a message telling the user to press twice but I'm having a couple of errors so I will have to dig further to get that to work but let me know which one you'd prefer.

hmmm, I prefer to have the following behavior:

  1. Tap back button
  2. Shows snackbar with a message: "Press Back again to quit the app."
  3. If back button is tapped again within 2 seconds, app will close. Otherwise shows snackbar again if back button is tapped.
joneldominic commented 1 year ago

also, you want this on the homepage but when the user presses the back button on transactions page or settings page, the app quits. What should we do about it? We could either implement the confirm exit on them too or return to the homepage if back key is pressed instead.

I think we can implement exit confirmation on them too.

valentine-bvc commented 1 year ago

Hmmm, interesting. Did you fork the repo? If not, I think it would be better to fork it first, then apply your changes. When done, you can just directly create a pull request so that I can review and merge it.

Another thing, did you run flutter pub run build_runner build --delete-conflicting-outputs upon getting the latest changes/commit?

Hello! I did not fork it. Not familiar with forking as I still don't have a complete grasp on git and github yet but I will document myself and try again! I've only been cloning so far and like I said, after I downloaded all the dependencies and yes I did run flutter pub run build_runner build --delete-conflicting-outputs, I still getting the same error. BUT, if I use git to go into detached head to an older branch (bdc1438) I would get no such errors as flutter is missing whatsap icons and what not but this is what I'm going to do, I'll document on forking, fork the project, set it up and check again, I will let you know if it's still not working, also if it does end up working, I will work on finishing the back button double press with the snackbar feature and try to get rid of the errors I was getting. Cheers!

joneldominic commented 1 year ago

Hello @valentine-bvc . I think, I know what is causing the missing icon error. It was caused by my breaking change (#44); Wherein I replaced category colors with icons. You may try fixing the issue by uninstalling the app in your emulator/device and then rerunning it. Just update me if the issue is resolved. Thanks

valentine-bvc commented 1 year ago

Awesome! I've been trying to get some solutions for the past two hours and I came to the conclusion I can't do anything because the compiler is complaining that icons are missing from the project files no matter what i try to do to resolve the problem, then was trying to find the last commit that would work but you came to the rescue haha. I will try to do your suggestion and update you!

valentine-bvc commented 1 year ago

Hey! So i tried again and still the same result. Some of the things i've tried:

/C:/Users/Val/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_iconpicker-3.2.2/lib/IconPicker/Packs/Material.dart:25570:21: Error: Member not found: 'whatsapp'.
  'whatsapp': Icons.whatsapp,
                    ^^^^^^^^
/C:/Users/Val/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_iconpicker-3.2.2/lib/IconPicker/Packs/Material.dart:25573:27: Error: Member not found: 'whatsapp_sharp'.
  'whatsapp_sharp': Icons.whatsapp_sharp,

/C:/Users/Val/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_iconpicker-3.2.2/lib/IconPicker/Packs/Material.dart:25576:29: Error: Member not found: 'whatsapp_rounded'.
  'whatsapp_rounded': Icons.whatsapp_rounded,
                            ^^^^^^^^^^^^^^^^
/C:/Users/Val/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_iconpicker-3.2.2/lib/IconPicker/Packs/Material.dart:25579:30: Error: Member not found: 'whatsapp_outlined'.
  'whatsapp_outlined': Icons.whatsapp_outlined,
                             ^^^^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1151
joneldominic commented 1 year ago

hmmm, may I know the exact commit hash that you're currently using? It seems I can't reproduce the issue in the latest dev branch.

valentine-bvc commented 1 year ago

Hello! Sorry for the delay, I was getting errors even with the latest commit in the dev branch but I finally managed to find the issue. It took me hours of trying many things like I said before but I finally got it working. I lack the knowledge to fully understand what's going on but it might have to do with icon picker. I believe some of the icons it's using are deprecated and have been taken out from the latest versions of flutter. I don't know if this issue occurs everywhere or only when the project is cloned.

The fix was to pretty much downgrade my flutter version to an old version by going to the flutter source files on my pc, opening git command, go to flutter's github and look for an older branch of flutter. The last version of flutter is 3.7.7 I believe, I tried downgrading automatically but was only able to go to 3.7.6 which was still giving errors.

Now going back to the github page I saw a 3.3 branch so I opened git in the flutter source directory, downloaded 3.3 branch and switched to it, therefore using an older version of flutter. And sure enough that fixed the issue. Deleted the whole local project and tried to clone again just to make sure this is an actual fix, after a quick flutter pub get and flutter pub upgrade and using your formatting and building commands I was able to use flutter run and open the app in the android emulator.

After all this struggle now I can finally work on implementing the feature again! Cheers!

joneldominic commented 1 year ago

You're right. The issue was caused by the flutter version. My bad, I took the disclaimer from flutter_iconpicker's page for granted.

valentine-bvc commented 1 year ago

Hello! I think I managed to implement the feature you asked! It shows "Press Back again to quit the app" as a snackbar if pressed once and quits the app if pressed twice! Imma clean the code double check everything and make a pull request soon!

valentine-bvc commented 1 year ago

@joneldominic I have couple of questions if you don't mind:

joneldominic commented 1 year ago
valentine-bvc commented 1 year ago

Got it. Will get on it!

valentine-bvc commented 1 year ago

Hello! Everything is done and ready! I have implemented the feature on all 3 views (home, transactions and settings) and updated readme a little bit (just added troubleshooting and commands suggested that helped me set up the project). I will do a pull request right away.

As for testing I have done the following testing with flutter 3.3 :

valentine-bvc commented 1 year ago

Hello let's communicate back here for now. I have been spending a couple of hours because with the newset commits i have been getting new errors again. I have tried latest flutter, old flutter, clean project, basically anything i can think of and i cannot get the project to build the app. This is what i'm getting:

Error: The argument type 'Object?' can't be assigned to the parameter type 'T?'.
 - 'Object' is from 'dart:core'.
        instance: instance,
                  ^
[INFO] Precompiling build script... completed, took 1.8s
[SEVERE] Failed to precompile build script .dart_tool/build/entrypoint/build.dart.
This is likely caused by a misconfigured builder definition.

I will try to spend some more time these days and see what the issue is but could you tell me what flutter and dart versions are you using? Cheers!

joneldominic commented 1 year ago

Hello let's communicate back here for now. I have been spending a couple of hours because with the newset commits i have been getting new errors again. I have tried latest flutter, old flutter, clean project, basically anything i can think of and i cannot get the project to build the app. This is what i'm getting:

Error: The argument type 'Object?' can't be assigned to the parameter type 'T?'.
 - 'Object' is from 'dart:core'.
        instance: instance,
                  ^
[INFO] Precompiling build script... completed, took 1.8s
[SEVERE] Failed to precompile build script .dart_tool/build/entrypoint/build.dart.
This is likely caused by a misconfigured builder definition.

I will try to spend some more time these days and see what the issue is but could you tell me what flutter and dart versions are you using? Cheers!

Hello @valentine-bvc, here's my flutter and dart version

$ flutter --version
Flutter 3.0.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision cd41fdd495 (12 months ago) • 2022-06-08 09:52:13 -0700
Engine • revision f15f824b57
Tools • Dart 2.17.3 • DevTools 2.12.2
valentine-bvc commented 1 year ago

Hello, sorry for taking a while to respond, i haven't had much time to work on it and i haven't tried your versions yet but i can definitely confirm this has to do with flutter again and not my configuration because i tested it on 3 different setups with windows 10, Fedora and Ubuntu and i was getting the same exact error on all 3. I managed to fix this error by messing around with the dart files from my system but that fixed the current issue and caused other problems. I will dig in more and possibly try your versions too and hope to get to the bottom of this. If however you feel like I'm taking too long and want to take care of it yourself let me know although personally i don't want to give up on it yet. Cheers!

joneldominic commented 1 year ago

Sure thing. No problem. I'm also trying to work on other features so I'll just wait with your updated PR. Keep it up 💯