Flare Flutter animation issue - flutter

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.

Related

Colors.white.withOpacity not working on Flutter Web app

Problem description
I am not able to set white color with some opacity in Flutter on the Web.
Either
Colors.white24
or
Color(0x3DFFFFFF)
or even (suggested by #biruk-is)
Colors.white.withOpacity(0.24)
fail to show in Web app. It works as expected on Android and Windows, though...
How to reproduce?
Simply create a new Flutter App, with the standard template and modify the Scaffold as
return Scaffold(
backgroundColor: Colors.white24,
body: Center(
child: Text(
'Test text',
),
),
);
by doing this you get a colored background in Android or Windows, but on the web (both Chrome and Edge) show a white background...
Question:
Am i doing something wrong or did i misunderstood anything? Please kindly let me know (i am new to flutter (and web!) developement).
try using this:
const Color.fromRGBO(0, 0, 0, 0.3)
it gives me grey with 30% opacity.
Posible solution
If by using
Colors.white.withOpacity(0.24)
you do get the color white, you might still be able to get your desired color by calling
Colors.black.withOpacity(0.74)
If that is your case read the "What causes this issue?" section below.
What causes this issue?
The problem is a background color set up in the tree. If that background color is set to black, then setting Colors.black.withOpacity will always return black, or if the background color is white then setting Colors.white.withOpacity will always return white.
In my case, running
import 'package:flutter/material.dart';
void main() {
runApp(Container());
}
returns a black screen on Android, Windows and iOS, but a white screen in Chrome and Edge.
I also found out that there is already an issue in flutter that reports this problem.
use this:
Colors.white.withOpacity(0.5)

How do I fix values display error on Flutter Cupertino TimerPicker widget?

I'm implementing a simple Cupertino TimerPicker widget on a Flutter app and, for some reason, the values displayed on the picker for the minutes get trimmed once they go above 20:
https://www.dropbox.com/s/jqu45skpjob4it0/Screenshot%202019-11-01%2013.51.29.png
Originally I had the widget inside a showModalBottomSheet widget with some customization, but the problem persists even after trying to display the simplest implementation of the timer picker within a column widget.
When I spin the picker, I can get the correct values. For example, if I select 22 minutes, onTimerDurationChanged passes a Duration value of 22 minutes, even if the picker displays only "2" in the UI (as seen in the screenshot). So it looks like the problem is in how the widget displays the values.
Here's the code for the Timer Picker child in its containing Column widget:
Expanded(
child: Container(
height: 200,
child: CupertinoTimerPicker(
mode: CupertinoTimerPickerMode.hm,
initialTimerDuration: Duration(minutes: 20),
onTimerDurationChanged: (Duration value) {},
),
),
),
Further details:
1) The bug is present only when setting
mode: CupertinoTimerPickerMode.hm
The issue goes away if mode is set to .ms or to .hms. Unfortunately, I need to use the .hm mode.
2) The issue appears when running the app on iOS (both in the simulator and on a physical device). Ironically, it works just fine on Android.
--
I'm not getting any kind of error in the console or within the Android Studio editor. I'm not sure where else to look for troubleshooting.

Flutter using basic flr and play in project

From this link i downloaded basic flr binary file and i would like to use and animate that in flutter.
after downloading that and put in assets folder and define in pubspec.yml, that can ba show on application but, it doesn't has any animation
return FlareActor(
"assets/flr/liquid_loader.flr",
alignment: Alignment.center,
fit: BoxFit.contain,
animation: "go", //<--- how can i play or put some option here?
);
The name of the animation is the same as the one you created in two dimensions. Example: This image animation has the name idle, so you would have to put animation: "idle" or the name of the other animations that are just below.

Deactivate FlatButton default Sound and animation

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.

How to use flare binary files in a flutter app?

How can I use flare binary files (.flr) in my flutter app?
FlareActor(
"location/00.flr",
alignment: Alignment.center,
fit: BoxFit.contain,
animation: // "here you set the name of the animations tab",
),
for example here https://www.2dimensions.com/a/pollux/files/flare/success-check
the name of animation is Untitled
How about you check the docs https://pub.dev/packages/flare_flutter
You can create your own flare file by signing in on https://www.2dimensions.com/
if your currently trying experimenting with someone else's flare file.
Assuming that you have an existing project,
Add the package to your project's dependencies (pubspec.yaml)
Check the docs(above link) and see which files you really need and import them accordingly
import 'package:flarecode/flare_actor.dart';
You'll surely need the above one.
Paste the files within your project directory and don't forget to mention it in pubspec.yaml.
(Optional)
Make sure you have some way to trigger the animation using FlareController (Raised Animation or as soon as the widget is built)
Example Code:
Container(
FlareActor(
"assets/yourflare",
alignment:Alignment.center,
fit:BoxFit.contain,
animation:"idle" /* Default_Animation_Name (One Flare file can hold multiple flare animations with the same name) */ ) );