Home Screen widget in Flutter - flutter

I have to build a flutter app where the data need to be shown on home screen
of the phone, if the app is in background mode.
Till now i have not found any relevant information regarding the home screen widget or how to create the app widget in flutter except the one that
we can build app widget in native(Android/iOS).
Native widget in android
Do i need to handle app widget from the native code or is there a way to handle app widget in flutter.

It's not official supported, but there are some packages, to do the basic stuff:
https://pub.dev/packages/home_widget
Android
iOS
There is also a ticket in the Flutter repo: Explore home widgets for iOS 14. So you can upvote this ticket, if you are interested.

Related

Flutter - Update periodically home screen widget in Ios and Andorid

I made home screen widget using resources from https://medium.com/#ashishgarg1998/how-to-create-home-screen-app-widgets-in-flutter-ce3458f3638e but have issues to update this widget periodically. I have tried to update with background task applying workmanager plugin but this plugin does not support periodic task in Ios. Can anyone help to solve it with single plugin or source code

Flutter to native- Calling native android or ios screen as a widget in flutter

I got a requirement to use the natively developed screen as a form of widget in the flutter code.
say i have a screen where half of the screen contains google-map for some height and rest of the design includes some other widgets. Here i want the google-map widget-a natively developed screen in the flutter as a widget(not as a screen directly but as a form of widget).
I want to know whether it is possible to do this way or not if yes how can we achieve this if anyone have any resources or links please share , it would be helpful to me.
Thanks in advance.

Can PlatformView on flutter help build AdMob BannerAd widget for flutter?

The firebase_admob plugin has support for banner ad which can be placed only on a fixed set of positions (top,bottom) because its just putting native view in top of the flutters activity/ViewController. Is it possible no to export BannerAd as a widget using PlatformView?
Or is it somehow possible right now to add banner ad inside a scrollable widget of flutter.
You can try thís https://pub.dartlang.org/packages/flutter_native_admob. It uses exact PlatformView as you expect. But the limitation is not supporting iOS yet.
Warning: The plugin is based on Flutter PlatformView (AndroidView) to
create a custom widget from Native View. Therefore, only Android is
supported at the moment. For iOS, wait for Flutter team to implement
iOSView equivalent.

Is it possible to auto-theme widgets in Flutter?

In Google's mobile framework Flutter, you can build your app using either Cupterino (iOS) widgets or Material Design (Android) widgets. This means you have to build your app twice in order to create two different styles consistent to each device -- one time using Cupertino widgets to build for iOS, and then another time using Material Design widgets to build for Android. Is there a way to auto-theme these widgets to tailor to each platform so I can avoid building a Flutter app twice?
Yes, of course this is possible. You can use the inherited Theme widget to get the ThemeData object of your MaterialApp.
ThemeData has a property called platform, which can be used to supply different widgets for different platforms. In your Android-iOS case, it would look something like this:
#override
Widget build(BuildContext contect) =>
Theme.of(context).platform == TargetPlatform.iOS ? // ternary if statement to check for iOS
CupertinoAlertDialog() : // Cupertino style dialog
AlertDialog(); // Material style dialog
As you can see, you can use a TargetPlatform constant to check on what platform your application is running.
This can obviously also be applied to icons etc.
If you are using the Flutter plugin for Android Studio or IntelliJ IDEA, you can also use the Flutter Inspector to switch the TargetPlatform on the fly, i.e. emulate that the Flutter SDK is running on iOS even though you are on Android and vise versa.

mono for android. Home screen widget

Do you know any examples, screencasts that document how to develop an home screen widget on "mono for android" ?
I would like to develop a tiny home screen view and I'm searching for the proper way to code it.
Xamarin has a sample widget project available in their samples on GitHub