This time I started off with designing new application icon since I could not stand looking at default one 😉 Designed it in Gravity Designer and below you can see what I got. I hope you like it as much as I do (any suggestions welcome as well) 🙂
Splash (launch screen will be pretty much the same, might do some animation similar to Twitter’s later one).
Creating a settings page was quite easy — just a ListView of a few widgets: Gender, age, and daily goal (with goal suggestion depending on the other two settings) selection, with a save button at the bottom of the view.
I have used a flutter_svg plugin to show male/female icons. Sadly I could not make it work with SVG files generated by Gravit Designer so had to use another app to generate them for me 😢.
Connecting everything with Redux was simple and did not take more than an hour (it is really easy once you understand how it works). Just did not like saving (same thing with loading) gender variable to the shared preferences — could not save the enum and instead had to get an index of it. Also loading a value that does not exist throws an error — why not just a null? Could wrap it in a try-catch I guess but oh well, made another workaround for that.
Adding iOS’s Quick Actions and Android’s App Shortcuts was the easier thing to do I think. Just added quick_actions plugin to my dependencies and followed a very short example and configuring it all took me 15 minutes… but, it does not work sadly 🙁 Seems like
— (BOOL)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL succeeded))completionHandler;
iOS’s method is not being called. Right now I am trying to reach someone’s from Flutter Team to get a help with that one since I am not able to localize it myself — seems like everything is fine, yet it does not work. Maybe anyone else sees any issue with this class. It does work on Android though 👌. The screen blinks a little bit though while adding a drink through shortcut — no idea why yet, will have to look into it closer.
Actually after a while, after I was almost done with this article I found a workaround for the iOS’s issue and it has been already reported to Flutter Team 👌.
Also noticed that I actually unnecessary dispatching 2 actions, seems like one (adding to the history) was just enough because changing the history (adding or removing element there) updates the Glass status anyway so yeah, thanks to quick actions I gained a bit or performance 😎.
In the meantime, I started working on the local notifications. For that, I am gonna use flutterlocalnotifications plugin.
At first, created a Notification Settings page which looks like shown on the image below (for now).
Scheduling daily notification was not an issue although had issues scheduling a few daily notifications at the specific time. Each notification’s id (obviously) has to be unique so fixed this one and all works fine… or does it really? I never had a chance to schedule so many local notifications so I was not aware that there is a scheduled local notification limit on iOS (probably on Android as well?) — good to know, I am really happy that while learning Flutter I can also increase my knowledge about iOS as well 🤓. So had to reduce the minimum interval to 30 minutes to make sure no one will try to schedule more than 64 🤯.
Just one thing that is missing in CupertinoPicker — being able to set the initial index of a selected item. Hopefully will be added later on.
Ahh, I am almost done with core features of my water tracking app. Faced a few issues this time — cannot really blame Flutter for that, it is currently in beta and there is still a lot of work to be done before I can say I enjoy applications written with this SDK as much as I enjoy those written natively in Swift. I prefer iOS’s style for aan application (like navigation) and it almost feels the same but yeah, “almost” makes big difference. Recently version 0.6.0-beta has been released (btw. had no issues upgrading 🔥) and some Cupertino (iOS-style) widgets have been released so will have to refactor my app a bit to use those ones. Hopefully, I can make it look more similar to the native iOS (navigation without having to create a new navigation bar! 😅) because right now I hate it that I have to push “the whole screen”, together with top bar — maybe I do not know about something yet? But I am pretty sure I’ll make it work before the next article (which will be most likely the last one).
Follow me if you do not want to miss the last part which will most likely contain redesign of whole application (I am still looking for a designer to help me out with an app design. If I do not find any, I will do it myself though so no worries 🖌), as well as some finishing touches (making it feels more like a native iOS app, some animations etc.).