barrage_flutter 0.1.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 73

barrage_flutter #

This is a barrage Engine for flutter.

中文说明

How to use #

Use MaterialBarrageWidget to Containe your Widget and the barrage will appear over it.

And you need to figure out a BarrageController for MaterialBarrageWidget where you can add your own barrage.

Here is an example.It builds two barrages that have different speeds.We use vector to figure the speed.

import 'package:barrage_flutter/barrage_flutter.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final BarrageController controller = BarrageController();
  @override
  void initState() {
    super.initState();
    Future.delayed(Duration.zero,() {
      debugPrint ("add");
      controller.push_barrage (barrage (
        vector2 (0,0),
        vector2 (10,0),
        Text ("测试一下")
      ));
      controller.push_barrage (barrage (
        vector2 (1,20),
        vector2 (15,0),
        Text ("测试2下",style: TextStyle (
          color: Colors.red
        ),)
      ));
    });
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body:Center(child:MaterialBarrageWidget(
            child: Icon (
              Icons.ac_unit,
              size: 200,
            ),
            controller: controller,
            )));
  }
}


[0.1.0] - Base Version #

Build base version.

[0.1.1] - Fixed Bug #

Fixed bug.

[0.1.2] - Document #

Compelete the document.

[0.1.3] - Description #

Compeleted.

example/lib/main.dart

import 'package:barrage_flutter/barrage_flutter.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final BarrageController controller = BarrageController();
  @override
  void initState() {
    super.initState();
    Future.delayed(Duration.zero,() {
      debugPrint ("add");
      controller.push_barrage (barrage (
        vector2 (0,0),
        vector2 (10,0),
        Text ("测试一下")
      ));
      controller.push_barrage (barrage (
        vector2 (1,20),
        vector2 (15,0),
        Text ("测试2下",style: TextStyle (
          color: Colors.red
        ),)
      ));
    });
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body:Center(child:MaterialBarrageWidget(
            child: Icon (
              Icons.ac_unit,
              size: 200,
            ),
            controller: controller,
            )));
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  barrage_flutter: ^0.1.3

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:barrage_flutter/barrage_flutter.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
48
Health:
Code health derived from static analysis. [more]
97
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [barrage_flutter] that is in a package requiring null.

Health suggestions

Fix lib/barrage_flutter.dart. (-2.96 points)

Analysis of lib/barrage_flutter.dart reported 6 hints, including:

line 5 col 7: Name types using UpperCamelCase.

line 21 col 7: This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance fields aren't final: barrage.pos, barrage.speed, barrage.npos, barrage.remove, barrage.child

line 21 col 7: Name types using UpperCamelCase.

line 41 col 7: Name types using UpperCamelCase.

line 69 col 11: Name non-constant identifiers using lowerCamelCase.

Dependencies

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