In my Flutter app there is Drawer that shows menu items.
Selected menu item has different color, I handle it storing selectedItemIndex in Drawer. I want to solve two issues:
When app receives push notification it changes screen so now selectedItemIndex should be changed outside Drawer.
Routes that are used while handling push notifications are almost similar to routes used in Drawer menu. So I want to avoid code duplication.
What way of storing and updating selectedMenuIndex as well as handling routes should be used in Flutter?
Related
I'm trying to add buttons to a widget having family type ".systemLarge". I want to execute some code without opening the app.
Anyone knows how to do that?
For example the Shortcuts App Widget includes buttons you can tap to execute a shortcut without opening the app.
Widgets are read only. The Shortcuts app is an exception.
https://developer.apple.com/documentation/widgetkit/creating-a-widget-extension
Widgets present read-only information and don’t support interactive elements such as scrolling elements or switches. WidgetKit omits interactive elements when rendering a widget’s content.
You can add Link controls on medium and large size widgets to get a button like behavior.
This won't allow you to create interactive widgets, which change their content by clicking elements inside the widgets.
But you will be able to tell which "link" was clicked based on the widgetUrl provided when your app gets activated through the widget.
See the chapter Respond to User Interactions here:
https://developer.apple.com/documentation/widgetkit/creating-a-widget-extension
On android one can add listener to Backhandler to detect hardware back action. So, if i create a screen and modify the content of the screen upon some action, then it is easy to go back to previous content with backhandler listener.
On ios, this is not possible to do with the swipe gesture.
React navigation does provide swipe gesture enable/disable to disable the action all together. But if i want to use the swipe gesture to update the content of the app, is it possible with react native/react navigation?
Or adding new screens with different content is the only and recommended option?
for example signing up on the app.
On android what i do is create a single screen and modify its content with different sub components when user presses the next button and its easier to go back by listening to hardware press back. But on ios one can go back by swiping left to right. But using react navigation it goes back to previous screen and i find no way to listen to the gesture and go back to previous sub component instead of previous screen.
React Native Swipe Gestures use this library.
I hope it help you.
Looking to retrieve the selected ListView row at any given time. I know I can keep track of it on click, but there are many scenarios where the "selected" status gets removed. I would like to keep it consistent so that if the row has the selected background color I can get that index.
Right now I'm keeping a variable on click and hunting down all the scenarios where it gets removed (window blur, redraw of the list view). The one I can't find an event for is when you slide the row to show the edit actions. As soon as you start to slide, the row loses its selected background color, but there's no event for that as far as I can tell.
Any help would be appreciated. Thank you
The ListView has no selected state in Titanium. Not sure if it has natively either.
If the functionality is there natively it could be a great add-on to Titanium, and to help set that in motion you could raise a ticket on the Appcelerator Jira to get that implemented. To expedite even that you could submit a Pull Request to their open source code on github
For now you will indeed have to keep track of it through click events and what you describe.
I solved by setting selectionStyle to none, listening for the click and updating the background color manually. This doesn't truly represent the native "selected" status of the row, but works for my purposes.
I've been working on a couple of iOS action extensions for a while, but I have noticed an odd behavior I was wondering if anyone else saw. In short, after you install and turn the extension on from the share button menu and leave the menu, it disappears from the menu.
More specifically, when you first install the extension, you expect you have to press the share button, scroll the bottom bar menu (for the action extensions) all the way to the right, press the "More" button, toggle your extension on and then press done. At that point the icon for the extension will appear and you can use it. However, the next time you want to use the action extension, the icon will not appear and you have to repeat the process, even though when you look in the "More" menu, the toggle switches for your app are already flipped on.
I wish I could add images to further elaborate here, but I can't because of StackOverflow's rules.
I have not been able to find any information on this any where, so I was hoping someone here has noticed this behavior or not. Any help on resolving this would be greatly appreciated.
This has been a bug in iOS 8.3, and has been acknowledged by Apple.
Fixed in iOS 9.
Issue on OpenRadar
How to solve:
The new share extension is NOT visible in the default list, and is CHECKED in the “More…” list. Changing any of the switches and tapping Done will show the new share extension in the default list.
In ios 8 new app extensions, is it possible to create an app extension that would enable performing an action on a highlighted text? Similar to how today the copy and select sub menus appear, would it be able to add another custom action?
Something similar to what you have described could be accomplished with an Action type extension, which allows your extension to act on the user's current selected content (text, image, etc). However, you won't be able to populate your action in the copy/paste submenu, as iOS action extensions are limited to displaying an action sheet or modal view. This will be presented when a user makes a selection, taps the Share button, and selects your extension from the activity view controller. Read more in the App Extensions Programming Guide under "Action" (page 48).