widget

Flutter: Override widgets/components to get access to events

As a brief “note to self,” when you need to get access to Flutter widget events that you normally can’t access, override the widget to access lifecycle-related events like initState() and dispose() so you can access them. For example, this image (that comes from this URL) shows how to gain access to those lifecycle methods for a Flutter Drawer. You can do this with any component/widget — and you can also make the code more generic by passing in child widgets — and you can also mix in WidgetsBindingObserver and then use didChangeAppLifecycleState to gain access to more events.

Android: How to look up a widget (defined in XML layout file) by its id

Android FAQ: How do I look up (find) a widget in my Java code that I’ve defined in an XML layout file?

Solution: When you define your Android widgets in XML and then need to find a widget by its id, the method you need is named findViewById.

For example, you’ll use code like this to look up a widget by its id and create it in your Java code:

Android fragments - How to get an Activity widget alvin March 19, 2012 - 9:09am

Android Fragments FAQ: How do I access an Activity widget from an Android Fragment?

All you have to do in your Fragment code is use the getActivity method to get a reference to your Activity, and then the usual findViewById method to get a reference to your widget:

Create custom Mac dashboard widgets from web pages with Safari

Mac dashboard widgets FAQ: How can I create a Mac dashboard widget from a web page?

Some time back, I don't remember exactly when, Apple introduced the ability to create Mac dashboard widgets from web pages with their Safari web browser. The process of creating a Mac dashboard widget from a web page is fairly simple, and I thought I'd share the steps in a short tutorial here.

Create a custom Mac dashboard widget from a web page

I just created a Mac dashboard widget from an "aurora borealis" forecast web page, and these are the steps I followed:

A Java tooltip tutorial

Java Swing FAQ: How do I create a Java tooltip (also known as balloon or bubble help text)?

Run Dashboard widgets from your desktop

If you've ever wanted to see your Dashboard widgets outside of the normal Dashboard environment, Amnesty Widgets lets you run your widgets directly on your desktop. It's not free, but if it's something you always wanted, you can download a free trial.