Flutter Extract Method vs. Extract Widget vs. Extract Flutter Widget in androidStudio - flutter

Hi I'm new to Flutter and I have several questions regarding Extract Method and Extract Widget in Android Studio.
When it comes to making code clean and reusable,
what is the difference between Extract Method and Extract Widget?
When do I know what to use? It seems they both work fine to me.
If I Right click on a Widget that I want to extract and go to Refactor -> Extract Flutter Widget then it works, however if I Left click on a Widget to focus and use the hotkey Command+Option+W, it doesn't work. Why is it happening? Moreover if I go to Flutter outline -> select the Widget -> Right click -> Extract Widget then it shows the same result. What's the difference between Extract Flutter Widget and Extract Widget?
Thank you.

If you want to show a widget use the Extract widget and method is basically a function needs to be executed basically logical part.
You can do same by return the widget in methods but it's not a right choice as per performance basis.
But if you are a beginner then it's ohkk to use for now.
This comment is basically posted by Satyarth Mittal.

Related

Is there a way to print the same exact page on flutter web?

i'm trying to make a page with flutter widgets and i want the user to be able to print the same exact page.
I have tried:
syncfusion_flutter_pdf library
Which is work fine but i cant make complex designs.
PDF library
Unfortunately i couldn't figure it out because i'm using dart:html
If you want to output a Flutter scene exactly as they appear on the screen, you can use a RepaintBoundary widget, to save the widget into a PNG file.
You can insert RepaintBoundary at any level of the widget tree. So if you put it near the root of the widget tree, you will be able to capture the whole screen.
Take a look at this answer for how to use RepaintBoundary.

Create Vertical List in Flutter

I want to create this type of listview using flutter.
https://dribbble.com/shots/6872462-Food-ordering-app-Animate
You can find out more by clicking on this link. But I don't know how to create this type of list. I mean, you can see in the GIF that the list is indexed based.
A fixed indexed item container is colored.
How can I achieve it?
Flutter provides you with a widget very similar to the result you want to achieve called NavigationRail.
You will not have the animation by default, but you can maybe search in the source code of this widget how to create a custom widget that will implement animations.

Why is expanded widget is destroying my UI in flutter after publishing it on play store

I have developed an application in Flutter Dart and used an Expanded widget in my application but wherever I used expanded widget, it destroyed my UI and converted that List into an infinite list with no data on it.
Please let me know that reason why does this occur and the potential solution.
Thank you everyone in advance
You can use the expanded widget inside the column and row. Sometimes with use of an expanded widget with the wrong widget will give the error in release mode while it is working in the debug mode.
Make sure you are using the expanded widget inside the column or row and that column and row should not be inside the scroll view or other scrollable widgets.
If still not clear then update the question with the widget hierarchy.

Can I store a widget from widget and later use it in another page without rebuilding it from scratch? - Flutter

I have a Stateful widget called Widget1 shown in one page. When I open my app the widget1 gets build from scratch and shown in the page. Let's assume the widget1 is quite heavy with lot's of other widget's inside it.
Now I want to display the same widget in another page but I don't want to build the same widget1 from scratch like I did in the first page. I want to reuse the widget which was built in the Previous page to be shown in this page.
Is that possible in flutter? I know flutter must build a widget inorder to make changes in Ui. But is this really possible? that is , to store a widget and use it, whenever we want without having to rebuild it, again from scratch?.

swt widget (pallet widget) for group selection

I am looking to have a widget like below screen in my rcp application. I tried to find an existing one however I could not find one. Anyone can please help. Do you think I will have to create my own (by having two list and arrows and then writing arrow event code).
Please help.
You should take a look at Opal
The have a widget called DualList, see Screenshot