Git Product home page Git Product logo

fps_jank_flash_widget's Introduction

FPS Jank Flash widget

A flutter widget that flashes when flutter fails to render a frame in a certain timeframe

lesnitsky.dev GitHub stars Twitter Follow

Installation

flutter pub add fps_jank_flash_widget
flutter packages get

Usage

import 'package:fps_jank_flash_widget/fps_jank_flash_widget.dart';

void main() {
  const frameBudget = Duration(milliseconds: 17); // 60 fps
  FPSJankFlash.frameBudget = frameBudget;

  runApp(FPSJankFlash.overlay(child: const MyApp()));
}

FPSJankFlash could be used directly:

import 'package:fps_jank_flash_widget/fps_jank_flash_widget.dart';

class SomeWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        Column(
         children: [
            /// ... your widgets,
          ],
        ),
        const FPSJankFlash(),
      ]
    );
  }
}

You can also use a JankObserver:

import 'package:fps_jank_flash_widget/fps_jank_flash_widget.dart';

void main() {
  JankObserver.addListener(() {
    print('jank detected');
  });

  runApp(YourApp());
}

If you're testing the app on a higher refresh rate displays, override the frame duration budget:

import 'package:fps_jank_flash_widget/fps_jank_flash_widget.dart';


void main() {
  const refreshRate = 120;
  final budgetMs = 1000 ~/ refreshRate;
  FPSJankFlash.frameBudget = Duration(milliseconds: budgetMs);

  runApp(FPSJankFlash.overlay(child: const MyApp()));
}

License

MIT

lesnitsky.dev GitHub stars Twitter Follow

fps_jank_flash_widget's People

Contributors

lesnitsky avatar

Stargazers

Kyle Tse avatar  avatar Tauqeer Ahmed avatar Kamran Bekirov avatar Vitalii avatar Pankaj Koirala avatar Anastasiya avatar Peter Leibiger avatar Andres Garcia avatar Dhari avatar Zoran Conevski avatar Diego Schulz avatar Ali Fellahi avatar Jérémie Vincke avatar Helielson avatar 爱可可-爱生活 avatar Ilyas LEFEBVRE avatar Felipe Gonçalves dos Reis avatar hisaichi5518 avatar Philipp avatar Muhammed OKUR avatar  avatar Jens Becker avatar Zahid Shaikh avatar Jeremiah Ogbomo avatar Denis Gordin avatar Elliot Hesp avatar Glenn Versweyveld avatar Ahmet Recep Navruz avatar Erlend avatar Arin Faraj avatar Ramamurthy K avatar  avatar Reuben Turner avatar  avatar Maksim Shastsel avatar Chinmay Kabi avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.