peng8350 / flutter_gifimage Goto Github PK
View Code? Open in Web Editor NEWgif image widget help to controll gif progress,speed,repeat frames
License: MIT License
gif image widget help to controll gif progress,speed,repeat frames
License: MIT License
Failed assertion: line 582 pos 12: '_pendingDimensions': is not true.
Flutter (Channel stable, 1.22.2)
内存溢出了
class SplashWidget extends StatefulWidget {
SplashWidget({Key key}) : super(key: key);
@override
_SplashWidgetState createState() => _SplashWidgetState();
}
class _SplashWidgetState extends State<SplashWidget>
with TickerProviderStateMixin {
GifController gifController;
@override
void initState() {
super.initState();
gifController =
GifController(vsync: this, duration: Duration(milliseconds: 500))
..addListener(() {
if (gifController.value.ceil() >= 80) {
gifController.stop();
gifController.dispose();
gifController = null;
}
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: GifImage(
image: AssetImage(A.assetsImagesAppWelcome),
controller: gifController,
fit: BoxFit.contain,
onFetchCompleted: () {
gifController.repeat(
min: 2, max: 91, period: Duration(milliseconds: 500));
},
),
);
}
}
你好,为什么我用普通的Image.asset放入gif之后,从另一页面返回后只停留在gif的第一帧?用了GifImage之后是最后一帧?这里哪段代码处理这个问题呢?
Whenever I ran the controller, it is crashing.
The method 'addListener' was called on null.
Receiver: null
Tried calling: addListener(Closure: () => void from Function '_listener@47216319':.)
in my class:
class Foo extends State<Bar> with TickerProviderStateMixin {
GifController gifController;
@override
void initState() {
...
gifController = GifController(vsync: this);
WidgetsBinding.instance.addPostFrameCallback((_){
gifController.repeat(min: 0,max: 53,period: Duration(milliseconds: 200));
});
super.initState();
}
...
@override
Widget build(BuildContext context) {
...
return Container(
...
GifImage(
controller: gifController,
image: AssetImage("assets/inkman-hour-tick.gif"),
),
}
...
Unhandled Exception: Exception: Could not instantiate image codec.
E/flutter ( 3260): #0 _futurize (dart:ui/painting.dart:4304:5)
E/flutter ( 3260): #1 instantiateImageCodec (dart:ui/painting.dart:1682:10)
E/flutter ( 3260): #2 PaintingBinding.instantiateImageCodec (package:flutter/src/painting/binding.dart:88:12)
E/flutter ( 3260): #3 fetchGif (package:flutter_gifimage/flutter_gifimage.dart:243:49)
tried with
https://www.howtogeek.com/wp-content/uploads/2019/09/2.gif
return Align(
child: GifImage(
image: FileImage(File(path)),
controller: _gitController,
),
alignment: Alignment.center);
../../../../.pub-cache/hosted/pub.dev/gif-2.2.0/lib/gif.dart:348:51: Error: The method 'instantiateImageCodec' isn't defined for the class 'PaintingBinding'.
I have ensured that I am using the latest versions of both Flutter and the gif package. However, I am still encountering this issue. Could you please provide guidance on how to resolve this error? If the method instantiateImageCodec has been deprecated or removed, I would appreciate information on alternative methods or any necessary code changes.
wo find in flutter,the gif speed up,I don't know how to do
Gif won't animate, just show first frame.
GifImage(
controller: controller1,
image: NetworkImage('https://xxicon.xxwolo.com/live_666_new3.gif'),
)
Unsupported operation: Infinity or NaN toInt
但是设置了每个图片的 max 又不一样。
This library should be migrated to the latest features of Flutter, including the null-safety.
Tried with this:
https://www.howtogeek.com/wp-content/uploads/2019/09/2.gif (I downloaded to my sd card..)
return Align(
child: GifImage(
image: FileImage(File(path)),
controller: _gifController,
onFetchCompleted: () {
_gifController.repeat(period: Duration(milliseconds: 300));
},
),
alignment: Alignment.center);
got an exception:
Unhandled Exception: Unsupported operation: Infinity or NaN toInt
E/flutter ( 4817): #0 double.toInt (dart:core-patch/double.dart:194:36)
E/flutter ( 4817): #1 GifImageState.didChangeDependencies.. (package:flutter_gifimage/flutter_gifimage.dart:163:49)
E/flutter ( 4817): #2 State.setState (package:flutter/src/widgets/framework.dart:1148:30)
E/flutter ( 4817): #3 GifImageState.didChangeDependencies. (package:flutter_gifimage/flutter_gifimage.dart:160:11)
E/flutter ( 4817): #4 _rootRunUnary (dart:async/zone.dart:1134:38)
E/flutter ( 4817): #5 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
E/flutter ( 4817): #6 _FutureListener.handleValue (dart:async/future_impl.dart:139:18)
E/flutter ( 4817): #7 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:680:45)
E/flutter ( 4817): #8 Future._propagateToListeners (dart:async/future_impl.dart:709:32)
E/flutter ( 4817): #9 Future._completeWithValue (dart:async/future_impl.dart:524:5)
E/flutter ( 4817): #10 Future._asyncComplete. (dart:async/future_impl.dart:554:7)
E/flutter ( 4817): #11 _rootRun (dart:async/zone.dart:1126:13)
How to animate gif without repeat? If i dont use repeat, gif won't display at all
Is there a way to get info of the GIF image about frames count and frame delay?
Some functions like repeat require max argument but I don't know the exact number of GIF frames. Specially when that GIF image is coming from network.
Also when the GIF has no frame delay information, the playback goes too fast. It should be defaulted to about 100ms if there is no delay information provided.
例子在 web 端运行报错:
RangeError (index): Index out of range: index should be less than 1: 1
我试了例子中的 animate.gif 和自己的 gif,发现 codec.frameCount 都等于 1,紧急求助
Dear peng8350,
First I would like to thank you for creating such an awesome and useful library. I am currently building an app for deaf people and I need to use many gifs for them to see in their language the meaning of all the objects in the app.
My problem is that as I need to use many gifs, I cannot keep them in a local file because it will make the app too heavy for upload in the stores.
I am trying to implement your GifImage widget (which works perfectly) with CachedNetworkImage like so:
CachedNetworkImage(
imageUrl:
'https://firebasestorage.googleapis.com/v0/b/app-lsc-7310d.appspot.com/o/test.gif?alt=media',
imageBuilder: (context, imageProvider) => GifImage(
controller: controller,
image: imageProvider,
),
placeholder: (context, url) => CircularProgressIndicator(),
errorWidget: (context, url, error) => Icon(Icons.error),
),
But I get an error because if I put the imageProvider in your image (although both are imageProvider objects, in your function I guess this alternative is not considered, so I get the following error:
[VERBOSE-2:shell.cc(242)] Dart Unhandled Exception: NoSuchMethodError: The getter 'buffer' was called on null.
Receiver: null
Tried calling: buffer, stack trace: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
#1 fetchGif (package:flutter_gifimage/flutter_gifimage.dart:243:76)
#2 GifImageState.didChangeDependencies (package:flutter_gifimage/flutter_gifimage.dart:158:7)
#3 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4653:11)
#4 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4469:5)
#5 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3541:14)
#6 Element.updateChild (package:flutter/src/widgets/framework.dart:3303:20)
#7 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5981:14)
#8 Element.updateChild (package:flutter/src/widgets/framework.dart:3293:15)
#9 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4520:16)
#10<…>
Do you think you can help me figure out how I can implement both libraries and for them to work good together?
Best regards,
Manuela
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.