Developping an app with Flutter and I can't deactivate the default sound (and animation) of the FlatButton.
I can't find any doc about that sound in the official doc
https://api.flutter.dev/flutter/material/FlatButton-class.html.
I tried a MaterialButton and a RawMaterialButton but it has the same sound and animation...
Any help appreciated
I am on the same thing and found as a solution using the InkWell Widget instead like this:
child: InkWell(
enableFeedback: false, //if true, sound and vibration are enable
child: Text('Testing'),
onTap: () {
//your code
},
It worked for me.
The MatierialButton has no default animation or sound. Something else is causing it. Try it out on a fresh emulator to see.
Related
I have a basic website using GetX for navigation. I have inkwells with ontap functions which navigate to a new view. Right now, if you right click these buttons there is no "open link in new tab/window", "save link as" or "copy link address".
Is there any way to get this functionality for Flutter Web?
Edit:
Since Flutter version 2.10, you no longer need to switch to channel beta for this.
Maybe I'm answering this late, but this may help someone in the future.
At the moment of writing this it is possible to be done, it is bugged on the stable channel, but it works perfectly on channel beta.
Just switch to channel beta:
flutter channel beta
flutter upgrade
Then follow this instructions to add url_launcher dependency to your project and import this package wherever you want to use it:
import 'package:url_launcher/link.dart';
And finally wrap any widget with this:
Link(
uri: Uri.parse('www.google.com'),
builder: (context, function) {
return InkWell(
onTap: () => print('Do something'),
child: Text('Right clickable text')
);
});
i have a problem in the ios version of my app, this is the code.
void showErrorAlert(BuildContext context, String msj) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text('Error'),
content: Text(msj),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text('ok'),
)
],
);
},
);
}
the Navigator.of(context).pop() in android works perfect, close the dialog and everything is ok, but in ios, the full app is closed when that code is called 'Navigator.of(context).pop()', someone know what can i do to close only the dialog in ios?
P.D.: i dont have any error or warning in the output console, even when te app get closed
P.D.2: i already tried change the .pop to this 'Navigator.of(context, rootNavigator: true).pop('dialog')' but it doesnt work
Try switching to the stable branch because it is a reported bug. Use
flutter channel stable
EDIT
Damn it this answer got saved as a draft and I closed my laptop. I just realized you had already solved it
use
Navigator.of(context,rootNavigator:true).pop()
SystemNavigator.pop() is the recommended way to exit your app.
what I usually use is
Navigator.pop(context);
and it works fine for me. Had a similar issue when adding .pop()
I'm building an app where the users can choose the notification sounds inside the app.
The app would display a List of all notification sound that are inside the smartphone.
The Question:
How can I get a list of all notification sounds from the users phone, so the user can choose the preferable sound?
Is there any package in pub.dev or any way to do this (Android & iOS)?
Currently, it is not extensively available. But there is a work around, and that is:
Have a button
On press of that, open up your Sound and Vibration Settings.
Let the user choose from there itself
For that you can use app_settings package.
This is simple representation of how you can open up your location settings on press of a button
Widget build(BuildContext context) {
return Row(
children: <Widget>[
RaisedButton(
onPressed: AppSettings.openLocationSettings(), // here is the magic
child: Text('Open Location Settings'),
),
],
);
}
Consider this as an option. If you don't find anything, you can come back to it, and make use of it :)
First thing there is no plugins available which are fit into your requirement.
For iOS & Android, It is mandatory to keep sound file inside your project to play custom sound when notification received.
You need to get a list of the available sound file inside your project and load it to the widget.
Thanks.
I am using flushbar to display some important in-app notifications of my App to the user.
I want to be able to display the flushbar that is independent of the app open or closed.Because the flushbar notification is drawn over the current BuildContext only, as soon as the user closes the App , the flushbar notification disappears as well (because the notification widget is part of that screen's widget subtree).
Is there a way to display the flushbar notification on top of the other apps,in spite of my App being closed??
This is the Flushbar code I want to display.
In other words is there any kind of stuff where in which we can run a function or a piece of dart code irrespective of the app being closed or open?
I have been breaking my head for this for the past 5 days and I am not getting it
Flushbar(
title: "Hey",
message: "This is the important message XYZ for you.",
duration: Duration(seconds: 5),
isDismissible: true,
icon: Icon(
Icons.warning,
color: Colors.red,
),
dismissDirection: FlushbarDismissDirection
.HORIZONTAL,
mainButton: FlatButton(
onPressed: () {
flush.dismiss(true);
},
child: Text(
"CANCEL",
style: TextStyle(color: Colors.amber),
),
),
)
you can use this plugin system_alert_window
A flutter plugin to show Truecaller like overlay window, over all other apps along with callback events.
Using that, Build your notification which will act like a floating window on top of all apps and more importantly, it runs in the background.
My original Flare file/animation has a Cubic curve defined for all its animation. But when I export and run the same animation on my Flutter app, it seems to use a Linear curve. I have exported the files multiple times with different changes on it, but no luck.
Flutter code:
Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Container(
child: FlareActor(
"assets/flare.flr",
animation: "animate",
),
),
),
),
Files: https://github.com/2d-inc/Flare-Flutter/files/3266731/flare_files.zip
Link to flare: https://www.2dimensions.com/a/iamyogik/files/flare/new-file-4
Video of the flare animation running in the app: https://drive.google.com/file/d/1B98DNE3Zq26jQs4YCsDx-2gYnNaPIo4J/view?usp=sharing
As you have provided the link in which there is a animation but it is named as "new" (You can see that under the Animations tab in bottom left) but here in the code you have wrote "animate" instead of "new".
Try replacing this code
animation : "animate"
with this
animation : "new"
"new" is the name of your animation as i said before, and you have to write name of animation in the "animation" in your code, you can check this article from medium
and in case if that doesn't work then please make sure that you are using the same flare file for that animation.
As you specified here there the file name is "New File 4.flr" and animation for that is "new" as you can see in the bottom left.
But In flutter code you are using file name as "flare.flr" and animation for that as "animation".
So please cross check your file name and its animation name.