statsfl 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 86

statsfl - A simple FPS monitor for Flutter #

🔨 Installation #

dependencies:
  statsfl: ^0.0.3+1

⚙ Import #

import 'package:statsfl/statsfl.dart';

🕹ī¸ Usage #

Just wrap your root view in the StatsFl widget:

StatsFl(child: MyApp());

There are a few additional options you can play with:

return StatsFl(
        isEnabled: true, //Toggle on/off
        width: 600, //Set size
        height: 20, //
        showText: true, // Hide text label
        sampleTime: .5, //Interval between fps calculations, in seconds.
        totalTime: 15, //Total length of timeline, in seconds.
        align: Alignment.topLeft, //Alignment of statsbox
        child: MyApp());

🐞 Bugs/Requests #

If you encounter any problems please open an issue. If you feel the library is missing a feature, please raise a ticket on Github and we'll look into it. Pull request are welcome.

📃 License #

MIT License

[0.1.0] #

  • Update to 1.0 and extended description length to satisfy 'health' requirements for pub.dev

[0.0.3+1] #

  • Rendering fix

[0.0.2] #

  • Added height
  • Added showText
  • Improved sizing logic
  • Added asserts

[0.0.1] - Initial release. #

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:statsfl/statsfl.dart';

void main() {
  runApp(MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(body: MyApp())));
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    int boxCount = 10;
    List<Widget> boxes = List.generate(boxCount, (index) => ShadowBox()).toList();
    /// Using 3 StatsFl instances to show different configs,
    /// you'll probably only want to show one in your app.
    return StatsFl(
      align: Alignment.topRight,
      child: StatsFl(
        width: double.infinity,
        showText: false,
        height: 20,
        align: Alignment.bottomLeft,
        child: StatsFl(
            width: 200,
            height: 30,
            align: Alignment.topLeft,
            child: Center(child: ListView(children: boxes))),
      ),
    );
  }
}

class ShadowBox extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(bottom: 20),
      height: 50,
      decoration: BoxDecoration(color: Colors.white, boxShadow: [
        BoxShadow(spreadRadius: 4, blurRadius: 4, color: Colors.redAccent.withOpacity(.2)),
      ]),
      child: Container(
          width: double.infinity,
          alignment: Alignment.center,
          child: SizedBox.fromSize(size: Size(20, 20), child: CircularProgressIndicator())),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  statsfl: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:statsfl/statsfl.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
71
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
86
Learn more about scoring.

We analyzed this package on May 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.1
  • pana: 0.13.8-dev
  • Flutter: 1.17.0

Health suggestions

Format lib/statsfl.dart.

Run flutter format to format lib/statsfl.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8