1

The main objective is to allow the user to choose an image from the gallery/camera but in order to make things look good some animation has been used and entire image picking dialogue box has been designed

class _ProfileImageState extends State<ProfileImage>{

      @override

      File _image;

      //ImagePickerHandler imagePicker;

      @override
      void initState() {

        super.initState();
//initiating to start so that transition from one state to another is smooth
 
        var _controller = new AnimationController(
          vsync: this,
          duration: const Duration(milliseconds: 500),
        );


        imagePicker=new ImagePickerHandler(this.userImage(_image));


      }
James Z
  • 12,209
  • 10
  • 24
  • 44

2 Answers2

12

You need to use the SingleTickerProviderStateMixin mixin to use this as vsync param. You can achieve this by using with keyword here is how:

class _ProfileImageState extends State<ProfileImage> with SingleTickerProviderStateMixin {

      @override

      File _image;

      //ImagePickerHandler imagePicker;

      @override
      void initState() {

        super.initState();
 
        var _controller = new AnimationController(
          vsync: this,
          duration: const Duration(milliseconds: 500),
        );


        imagePicker=new ImagePickerHandler(this.userImage(_image));


      }```
sid
  • 407
  • 5
  • 13
2

Extending SingleTickerProviderStateMixin fixed the issue:

class _ProfileImageState extends State with SingleTickerProviderStateMixin{

er.arunkushwaha
  • 138
  • 1
  • 5