Baseflow / octo_image

A multifunctional Flutter image widget
https://baseflow.com/
MIT License
156 stars 23 forks source link

Made custom gapless playback with fade #6

Closed renefloor closed 4 years ago

renefloor commented 4 years ago

fixes #4

:sparkles: What kind of change does this PR introduce? (Bug fix, feature, docs update...)

feature and bug fix

:arrow_heading_down: What is the current behavior?

Currently gapless playback just goes from one image to the other in 1 frame.

:new: What is the new behavior (if this is a feature change)?

The new gapless playback fades from one image to the next the same way as from a placeholder. Also it keeps the image transformations that was applied on the previous image.

:boom: Does this PR introduce a breaking change?

Not really

:bug: Recommendations for testing

With this app you can easily test the gapless playback feature:

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'OctoImage Demo',
      theme: ThemeData(),
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  int count = 1;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Gapless"),
      ),
      body: Center(
        child: OctoImage(
          gaplessPlayback: true,
        fadeInDuration: Duration.zero,
        placeholderBuilder: (context) => Center(child: CircularProgressIndicator(),),
          image: CachedNetworkImageProvider(
              'https://via.placeholder.com/${count}00'),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () => setState(() => count++),
      ),
    );
  }
}

:memo: Links to relevant issues/docs

4

:thinking: Checklist before submitting

codecov[bot] commented 4 years ago

Codecov Report

Merging #6 into develop will decrease coverage by 0.67%. The diff coverage is 22.22%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop       #6      +/-   ##
===========================================
- Coverage    43.08%   42.40%   -0.68%     
===========================================
  Files            7        7              
  Lines          188      191       +3     
===========================================
  Hits            81       81              
- Misses         107      110       +3     
Impacted Files Coverage Δ
lib/src/image.dart 54.80% <22.22%> (-1.63%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ae1f3cf...565dfc9. Read the comment docs.