pd4d10 / git-touch

An open-source app for GitHub, GitLab, Bitbucket, Gitea, and Gitee(码云), built with Flutter
Apache License 2.0
1.56k stars 137 forks source link

[feat] set default starting tab #55

Closed shreyas1599 closed 4 years ago

shreyas1599 commented 4 years ago

Fixes #40

I used 4 StorageKeys, one for each platform. I cannot re-use the same key for all as the count of bottom bar items is not the same. Using the same key would've made this a whole lot easier.

Let me know if there are any changes to be made.

pd4d10 commented 4 years ago

Thanks!

I'll take a look ASAP

shreyas1599 commented 4 years ago

Sorry deleted the branch by mistake

shreyas1599 commented 4 years ago

@pd4d10 I figured out issues #57 and #54. They're tied to the same fix. I'll open a pr once you merge this as I have messed up my local repo and fork and both the issue fixes make changes in home.dart(which this pr modifies). I'll update them(local and fork) after this is merged and open a separate pr that fixes the above issues. Thanks.

pd4d10 commented 4 years ago

After doing some research, I found that some apps would save the last active tab and use it at the next launch, for example, Apple App Store

Personally I think it seems better because users would not be bothered to do an extra setting step.

What do you think?

shreyas1599 commented 4 years ago

I see. That makes sense. So I'll modify this. But I still feel the setting to so do should be left as it is too. Or do you want to remove it?

pd4d10 commented 4 years ago

the setting to so do should be left as it is too

It makes sense.

But it might be more complicated to implement this. We need to have two store keys for each platform, one is for the initiative settings (high priority), the other is for the tab item click (low priority). If the former is present the latter would have no effect.

It seems to be a lot of work, so I would recommend not including the settings code in this PR.

shreyas1599 commented 4 years ago

Alright. That makes sense. I'll change it.

shreyas1599 commented 4 years ago

Apologies for taking so much time. There were a few problems that escaped my notice. Within the theme.dart I found many mistakes that somehow didn't affect setting a default start tab but affected this. I fixed those but there's still one problem for which I can't seem to find a fix. The GhNotificationScreen(when not the default tab), if tapped after the app start immediately switches to the previous saved defaultTabState. However, after this if it is clicked, there is no problem. The problem is with the screen as I used GhNewsScreen as a replacement and it seems to work fine.

Hopefully, the gif explains the problem. The problem is only with the Notification screen of github and does not affect other screens of other platforms.

https://gph.is/g/Z7WdrQP

Edit: The problem was that didChangeDependencies is called again for Notifications alone and not for other screens. I used a global flag to ensure it is called only once right after the widgets are built. Feels like a hacky fix. Let me know if you feel there's a better way to do it.