flutter_backdrop 1.0.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 79

flutter_backdrop #

This package is used for implementing Backdrop widget in Flutter easily.

You can add properties like-

  • frontLayer
  • backLayer
  • frontHeader
  • borderRadius
  • shape
  • frontHeaderHeight
  • titleVisibleOnPanelClosed
  • frontPanelPadding
  • panelVisibleInitially
  • toggleFrontLayer
  • appBarLeadingMenuIcon
  • appBarAnimatedLeadingMenuIcon
  • appBarAutomaticallyImplyLeading
  • appBarTitle
  • appBarActions
  • appBarBackgroundColor
  • appBarIconTheme
  • appBarTextTheme
  • appBarCenterTitle
  • appBarTitleSpacing
  • appBarElevation

to manipulate the backdrop easily.

Each property has been defined in package.

Refer to the example to create something like this:

Result of example

Or modify the borderRadius property to get this:

Circular Border

Or modify titleVisibleOnPanelClosed property to get this:

Title visible or Title not visible

[1.0.4] - 30/10/2019 #

  • Added elevation property.

[1.0.2] - 08/02/2019 #

  • Modified to remove a redundant print statement and modified example.

[1.0.1] - 25/01/2019 #

  • Example has been added for reference.

[1.0.0] - 25/01/2019 #

  • More properties and stable release.

[0.0.1] - 24/01/2019 #

  • This is a package which allows you to implement Backdrop Widget easily

example/lib/main.dart

// Example to demostrate the use of package.
import 'package:flutter/material.dart';
import 'package:flutter_backdrop/flutter_backdrop.dart';
import 'package:scoped_model/scoped_model.dart';

main() => runApp(MyApp());

bool _toggleFrontLayer = false;

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Backdrop',
      theme: ThemeData(
        primarySwatch: Colors.orange,
      ),
      home: HomePage(),
    );
  }
}

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

/// Implementation of Backdrop Widget starts here.

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return ScopedModel(
      model: FrontPanelModel(FrontPanels.panelOne),
      child: ScopedModelDescendant<FrontPanelModel>(
        builder: (context, _, model) => Backdrop(
          appBarAnimatedLeadingMenuIcon: AnimatedIcons.close_menu,
          appBarTitle: Text('Backdrop'),
          backLayer: BackPanel(),
          toggleFrontLayer: _toggleFrontLayer,
          frontLayer: model.activePanel,
          frontHeader: model.panelTitle(context),
          frontHeaderHeight: 35.0,
          titleVisibleOnPanelClosed: true,
          shape: BeveledRectangleBorder(
              borderRadius: BorderRadius.only(
                topLeft: Radius.circular(35.0),
              )),
        ),
      ),
    );
  }
}

/// Creation of Model Class to be used for changing frontLayer
/// as well as on clicking of any option on backLayer

enum FrontPanels { panelOne, panelTwo }

class FrontPanelModel extends Model {
  FrontPanels _activePanel;

  FrontPanelModel(this._activePanel);

  FrontPanels get activePanelType => _activePanel;

  Widget panelTitle(BuildContext context) {
    return Container(
      child: Center(
        child: _activePanel == FrontPanels.panelOne
            ? Text('Panel ONE')
            : Text('Panel TWO'),
      ),
    );
  }

  Widget get activePanel =>
      _activePanel == FrontPanels.panelOne ? PanelOne() : PanelTwo();

  void activate(FrontPanels panel) {
    _activePanel = panel;
    notifyListeners();
  }
}

/// Creation of front layers, both [PanelOne] and [PanelTwo] as well as
/// back layer, [BackPanel]

class PanelOne extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Center(
        child: Text(
          'Panel ONE',
          style: TextStyle(fontSize: 42.0),
        ),
      ),
    );
  }
}

class PanelTwo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Center(
        child: Text(
          'Panel TWO',
          style: TextStyle(fontSize: 42.0),
        ),
      ),
    );
  }
}

class BackPanel extends StatefulWidget {
  @override
  _BackPanelState createState() => _BackPanelState();
}

class _BackPanelState extends State<BackPanel> {
  @override
  Widget build(BuildContext context) {
    return Container(
      color: Theme.of(context).primaryColor,
      child: Container(
        margin: EdgeInsets.only(top: 16.0),
        child: ListView(
          itemExtent: 70.0,
          children: <Widget>[
            ScopedModelDescendant<FrontPanelModel>(
              rebuildOnChange: false,
              builder: (context, _, model) {
                return FlatButton(
                  child: Text('First Panel', style: TextStyle(color: Colors.white, fontSize: 20.0),),
                  onPressed: () {
                    model.activate(FrontPanels.panelOne);
                    _toggleFrontLayer = true;
                  },
                );
              },
            ),

            ScopedModelDescendant<FrontPanelModel>(
              rebuildOnChange: false,
              builder: (context, _, model) {
                return FlatButton(
                  child: Text('Second Panel', style: TextStyle(color: Colors.white, fontSize: 20.0),),
                  onPressed: () {
                    model.activate(FrontPanels.panelTwo);
                    _toggleFrontLayer = true;
                  },
                );
              },
            ),

          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_backdrop: ^1.0.4

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

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

  • Dart: 2.8.2
  • pana: 0.13.8-dev
  • Flutter: 1.17.1

Health suggestions

Format lib/backdrop_panel.dart.

Run flutter format to format lib/backdrop_panel.dart.

Format lib/flutter_backdrop.dart.

Run flutter format to format lib/flutter_backdrop.dart.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

exitCode: 255 stdout: Documenting flutter_backdrop... Initialized dartdoc with 511 libraries in 91.9 seconds Generating docs for library flutter_backdrop from package:flutter_backdrop/flutter_backdrop.dart... Generating docs for library flutter_backdrop from package:flutter_backdrop/backdrop_panel.dart... Validating docs... Documented 2 public libraries in 17.8 seconds stderr: warning: flutter_backdrop has no library level documentation comments, from flutter_backdrop: (file:///tmp/pub-dartlang-dartdocHHKSQE/pkg/lib/flutter_backdrop.dart:1:9) warning: unresolved doc reference [frontPanel] from flutter_backdrop.Backdrop.frontPanelPadding: (file:///tmp/pub-dartlang-dartdocHHKSQE/pkg/lib/flutter_backdrop.dart:41:20) in documentation inherited from flutter_backdrop.Backdrop.frontPanelPadding: (file:///tmp/pub-dartlang-dartdocHHKSQE/pkg/lib/flutter_backdrop.dart:41:20) warning: unresolved doc reference [frontPanel] from flutter_backdrop.Backdrop.panelVisibleInitially: (file:///tmp/pub-dartlang-dartdocHHKSQE/pkg/lib/flutter_backdrop.dart:46:14) in documentation inherited from flutter_backdrop.Backdrop.panelVisibleInitially: (file:///tmp/pub-dartlang-dartdocHHKSQE/pkg/lib/flutter_backdrop.dart:46:14) warning: unresolved doc reference [backPanel] from flutter_backdrop.Backdrop.panelVisibleInitially: (file:///tmp/pub-dartlang-dartdocHHKSQE/pkg/lib/flutter_backdrop.dart:46:14) in documentation inherited from flutter_backdrop.Backdrop.panelVisibleInitially: (file:///tmp/pub-dartlang-dartdocHHKSQE/pkg/lib/flutter_backdrop.dart:46:14) warning: flutter_backdrop has no library level documentation comments, from flutter_backdrop: (file:///tmp/pub-dartlang-dartdocHHKSQE/pkg/lib/backdrop_panel.dart:1:9) error: failed to write file at: flutter_backdrop/flutter_backdrop-library.html for symbol flutter_backdrop: (file:///tmp/pub-dartlang-dartdocHHKSQE/pkg/lib/backdrop_panel.dart:1:9) conflicting with file already generated by flutter_backdrop: (file:///tmp/pub-dartlang-dartdocHHKSQE/pkg/lib/flutter_backdrop.dart:1:9) Dartdoc generates a path and filename to write to for each symbol. flutter_backdrop conflicts with another symbol in the generated path, and therefore can not be written out. Changing the name, library name, or class name (if appropriate) of one of the conflicting items can resolve the conflict. Alternatively, use the @nodoc tag in one symbol's documentation comments to hide it. warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop-class.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/Backdrop.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/appBarActions.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/appBarAnimatedLeadingMenuIcon.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/appBarAutomaticallyImplyLeading.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/appBarBackgroundColor.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/appBarCenterTitle.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/appBarElevation.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/appBarIconTheme.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/appBarLeadingMenuIcon.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/appBarTextTheme.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/appBarTitle.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/appBarTitleSpacing.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/backLayer.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/borderRadius.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/createState.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/frontHeader.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/frontHeaderHeight.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/frontLayer.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/frontPanelPadding.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/panelVisibleInitially.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/shape.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/titleVisibleOnPanelClosed.html (from index.json) warning: dartdoc generated a broken link to: flutter_backdrop/Backdrop/toggleFrontLayer.html (from index.json) found 29 warnings and 1 error Unhandled exception: dartdoc encountered 1 errors while processing. #0 Dartdoc.generateDocs (package:dartdoc/dartdoc.dart:225:9)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
scoped_model ^1.0.1 1.0.1
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
Dev dependencies
flutter_test