title: Flutter animate background image on drag
body: <p>I'm trying to build a widget that allows the user to change a value by dragging. Similar to a Slider but different in the sense that the background is being dragged while the "value indicator" stays fixed.</p>
  
  <p>I've got the functionality down but I'm not sure how to animate the background image properly to give it a sliding/dragging interaction.</p>
  
  <pre><code>import 'package:flutter/material.dart';
  
  class SliderTest extends StatefulWidget {
  @override
    _SliderTestState createState() =&gt; _SliderTestState();
  }
  
  class _SliderTestState extends State&lt;SliderTest&gt; {
  double foo = 100.0;
  
  @override
  Widget build(BuildContext context) {
  return new Scaffold(
    appBar: new AppBar(
      title: new Text('SliderTest'),
    ),
    body: new Builder(builder: (context) {
      return new Center(
        child: new Column(
          children: &lt;Widget&gt;[
            new Text("$foo"),
            new Row(children: &lt;Widget&gt;[
              new Expanded(
                child: new GestureDetector(
                  child: new Container(
                    height: 80.0,
                    decoration: new BoxDecoration(
                      image: new DecorationImage(
                        image: new AssetImage("resources/scale.png"),
                        repeat: ImageRepeat.repeatX
                      )
                    ),
                  ),
                  onHorizontalDragUpdate: (d) { 
                    if(d.primaryDelta &gt;= 1.0 || d.primaryDelta &lt;= - 1.0)
                    {
                      //print(d.primaryDelta); 
                      setState(() {
                        foo += d.primaryDelta;
                      });
                    }
                  },
                  )
                )
              ],
            ),
          ],
        ),
      );
    })
  );
  }
  }
  </code></pre>
  
  <p>How do I make the background image "move" in sync with the dragging?</p>