I am attempting to internationalize a flutter application using the Android Studio/VS Code Flutter Intl plugin. I can get the S.of(context).value to work throughout the app in widgets I've made myself and basic Text widgets but when I use it in Flutter widgets (Text Form field, list tile, drop down menu item, dropdown button, etc) I get the "NoSuchMethodError: the getter 'value' was called on null. It seems like there might be an issue between the static pieces of the Flutter widgets and the dynamic nature of the internationalized text?
Is there a way to correct this without making all of my own widgets?
Related
I am using a DropdownButton in a Flutter app, and when you click it and the drop down appears, it overlays a webview that I'm using.
That all works perfectly, however webviews in Flutter, when run as a web app (which this is) trap all UI interactions and don't allow clicks to flow through to the Flutter UI elements.
There is a PointerInterceptor component that handles this perfectly, all I need to be able to do is wrap all of the DropdownMenuItems that appear inside of a single pointer interceptor (because if I individually wrap them then there is a really bad performance hit).
However - the DropdownMenuItems appear in the widget tree directly under the MaterialApp widget - and that is too high in the tree for me to wrap in a PointerInterceptor.
That is the reason that I want to know :
Is it possible to specify where in the widget tree the DropdownMenuItem widgets' appear when a DropdownMenuButton is clicked ?
Is there any way to serialize the Build layout of a stateless flutter widget and save it to a database?
I would like to design many simple Badge widgets and don‘t want to update the App each Time I have a new one.
I would like to save new widgets to a db instead.
Remote flutter widgets - may be the direction. It has mechanism for rendering widgets based on declarative UI descriptions that can be obtained & rendered at runtime.
I know that there is a SelectableText widget but what I am looking for is something to make an entire table/page to be selectable, not text by text but the entire table, like a normal page in html.
By the way: I am developing web pages with flutter
Is there any way to do it using the lastest version of flutter/dart or any 3 part widget?
Thanks
As far as I know Flutter have build in widget system that named material and cupertino. But is there any other widgets sets. I want to build site with Flutter but do not want to make it look as mobile app.
No there isn't any other widget set. Flutters material and cupertino are ment to get your app a native look. They don't have any special functionality than visual design.
If you just want to do your own styling and elements, you can build your widgets by your own. You can read more about it here:
https://www.raywenderlich.com/10126984-creating-reusable-custom-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.