How to show snack bar in flutter? - flutter

I am developing flutter calculator app
And when I am getting numbers from textfields just I want to show snackbar if the one of the textfield is empty or
If both of them are empty after clicking a button if they are not empty I am showing the sum result and in this case I don't have any problem
And to be more specific I am adding a picture of my simple app
I tried showsnakbarmassenger.of(context).showsnackbare and other codes after reading documentation and watching videos in YouTube but I got error no scaffold messenger widget found.

Those are deprecated APIs, currently you can show a snackBar with this:
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("example text")));

Related

Screenshot Controller flutter - capture method returns a null Uint8List when record is added

On the home screen on my app :
I have a list view with a bunch of card widgets and a screenshot action associated with each card widget. When I click on the screenshot action it captures the screenshot of that widget as it’s supposed to.
I have a floating action button which when clicked takes me to an add screen where I add data and save it to the database. Once saved a snackbar message is displayed and screen is popped out. The list view now displays the new record as a card widget.
PROBLEM :
After adding the record, when I click the screenshot action no widget screenshot is captured and on debugging I noticed the “Uint8List? image” is null.
Now if I scroll the list view and perform the screenshot action again everything seems to work.
It sounds to me that this might be a widget tree rebuild issue, but I am not sure how to go about with it. I have other actions, edit and delete on the card widget and they work without any issue.
Package used: screenshot 1.2.3

flutter display form errors on the bottom of page

I'am working on a flutter application where the user clicks on register button and if input has errors i don't wanna show the errors below the TextFormField, i've managed to create a form with a GlobalKey and added validator and it's working fine but i'm looking to show errors at the end of page not under TextFormField, any ideas how to do that ?
Thanks in advance
you can use visible widget to show your error text on error with a bool val to
validate your textfields.

How to do infinite navigation with PageView builder?

I am developing a kind of Twitter with Flutter, and I am encountering a problem with pageView.builder.
I want to create the same profile navigation that Twitter and Instagram are using : I mean I have a NestedScrollView which is my FeedPage and it contains a List of post tiles.
The feature I want is when I click on a tile, pageView build the user profile associated and show up as Twitter does. I used a Navigator.push whichs leads to the user concerned but it doesn't keep my BottomAppBar.
Images are better than words : Illustration
Thanks for your futur help and have a nice day !
There is a package in the pub to have a persistent bottom navigation: https://pub.dev/packages/persistent_bottom_nav_bar.

Flutter, cupertinotabview keyboard is not showing up

Am I doing something wrong with this super simple app?
I have CupertinoTabView with two tabs. The first one shows a Page which holds a textfield. Problem is when I tap on the textfield, the keyboard is showing for a fraction of a second and then hides again.
Link to issue on flutter github

Flutter Modal Sheet

I have seen and tried the 'showModalBottomSheet' widget in flutter, and thought whether there was a widget like 'top sheet modal'. like whatsapp when a message comes in. as below,
Thanks in advance.
If you need a 'top' modal sheet inside the app, try using the Banner widget: https://docs.flutter.io/flutter/widgets/Banner-class.html.
Otherwise, what is shown is screenshot is a notification which appears differently on iOS and Android.