I'm kind of new to flutter development and I've hit a big wall with the issue of making the app "international".
For this project, it's supposed to be available in 3 languages including english. So I've followed the flutter tutorial available here. I wrote 3 .arb files, and everything works with the phone's language. Now I'm supposed to create a button in the settings page that allows me to manually switch language.
And that's where I'm stuck. I've found many tutorials from different pages, all different, none of them I was able to make work. I've defined globale Locales and I've tried to call AndroidLocalizationDelegate.load(myLocaleEN) to no avail.
Any help is appreciated, I'm really lost!
If you're using MaterialApp / CupertinoApp / WidgetsApp then you can just pass your current locale with the locale parameter.
So you can treat your locale as any other state in the app – change it on button press, store it in shared preferences, etc.
Related
I have a task to solve a bug for an application form update on an application that uses Flutter when it is built. However, this is my first time using Flutter, and the program structure is a bit confusing. Can you tell me the easiest way to find the form structure in a Flutter program?
Start with exploring the screens available in your project to know which screen is being displayed that you need to debug. Then have a look at the widgets which this screen is composed of to point to the one that is causing the bug.
Need help to understand if Flutter can help us.
We are looking at flutter for app development for a rewrite of a js electron for desktop and js webview for mobiles.
It is basically a sophisticated reading app with multiple dictionaries and searching algorithms and other features specific to an Asian language and also English parallel translations.
We want to display Religious books in the native Unicode language with extensive dictionary support.
The books will have some bold and heading text markup (the markup style can be any format but we currently use html styles).
The books will be in a sqlite DB and streamed to the user.
The books will be stored in the db by paragraph.. We need to display this in a built up flow to the user.
The books will have some items which can be displayed or hidden upon user request but we can regenerate the display if needed. (currently it does live through js).
The books will need to communicate if a tap() or Textselect() event has been called (we often tap to select a word and it goes to a custom dictionary).
Searching for strings in the book will be done by paragraph and then we need to 1) highlight the text and bring the user to that text.
We wish to implement infinite scroll or "Lazy load" as the books are very big and often text processing to change the native script font is involved before display.
Conclusion
I think this captures much of what we want to have.
I have done some work in flutter, but i'm very new to it.
It seems that there is a SelectableText.rich widget and perhaps we could connect them together in an infinite scroll list widget from pub.dev
For hiding the page numbers.. and alt readings, it is fine to reload the book and remove those as we feed the widget with text.
There are a few html widgets, but I'm not sure if it gives select and tap events.
Can Flutter do this for us?
Are there packages that I'm not aware of?
Am I heading in the wrong direction?
I have done a test called https://github.com/bksubhuti/mydbtest
It seems to work.. the selecting of texts are off by a few bits, but it is workable..
However, I have found a full app for my purpose already written in flutter with a sqlite philosophy already working. The dev and myself are in touch and the project has been upgraded to null safety. Flutter is awesome. In about a month.. part time.. I have learned flutter and written my first app and submitted it to the play store called Buddhist Sun. (pending approval). I use sqflite and the multiplatform eq for getting cities.. the db search of cities was more of a flutter tutorial for me than purpose.
https://github.com/bksubhuti/buddhist_sun
Flutter will be the language of the future. I'm so amazed at how great it works and all the packages on pub.dev
I have one project that I have to sell to another clients, so I wanna found a way to unify the code to, when I release some updates, I have to manipulate only one code (and, of course, keeping the specificities from each one)
I found an article HERE which the guy creates a new folder named 'config' and set some variables there to be used in the parent project. I tried this but find out that would be very tough to do because the first app was developed specifically by one client, and with it I would need so much time to make all the aspects dynamic... Another problem is firebase, in first app I used firebase but in the second i won't. How to make it possible?
And in this article they say about 'flavours' that can be used to do something similar.
Someone knows about this approaches or there is another to reach my goal? With flavours I will have less re-factor than with config?
I appreciate any help
A third way to do this with no client specific app configuration is to make an api call to get back your client specific theme, and then set the flutter theme based on this.
If you need web support see below:
First update your assets in index.html that aren't white labeled, leaving stubs in their place that we'll fill in later. i.e.
Next show a nice loading indicator while flutter loads. To do this, just put the html for it in the body element of the index.html file.
Finally update the webpage title and favicon using javascript inside Flutter. I used package
universal_html: 2.0.8
https://pub.dev/packages/universal_html
then you can update the favicon
import 'package:universal_html/html.dart';
var favicon = document.getElementById('favicon');
favicon?.setAttribute('href','insertLinkToYourImage');
Updating the title can be accomplished in various normal ways like just setting the title attribute of a MaterialApp widget.
I See this:
Add different routes/screens to Flutter app
but not the same thing.
So. I have several Flutter "TEMPLATE" apps, not real code, just the views not hooked up to the backend.
I am using Flutter Template A as the base with its screens.
Now I want to grab some Screens from Flutter Template B and Add/Import them into Flutter Template A
Again, I want to grab some Screens from Flutter Template C and Add/Import them into Flutter Template A
I am new to Flutter - but have over 35 development experiences in a broad range of languages.
Which files needed to move "A Screen" over and add to the router?
If anyone has done this, please help.
It needs what it needs. There are view, model, and controller classes, perhaps all in one file, or spread out across multiple directories. So many ways of doing it that your question is unanswerable without looking at the code. If you got these "templates" from a vendor, hopefully the vendor documented some of that.
I have implemented Google-Cast in my iOS application. It already casts content just fine but the whole UI is in English, even when my device language is set to something else. The library is supposed to have support for lots of languages but I cannot seem to make it work. I cannot access any of the components to change its text value.
I have tried to access the components through UI inspector but I don't think that the library is prepared to be modified like this.
Also tried to change UserDefaults to change the value for key "AppleLanguages".
If there is anything else I could try or you come up with ideas/solutions, please, feel free to help me out since I have ran out of ideas.
This is a known issue and we are working towards fixing this. We are targeting to release a fix in v4.4.2 release. Right now we do not have an ETA.
You can follow this bug for more updates: https://issuetracker.google.com/132135605