expanding_button 1.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 50

Expanding Button #

A Flutter package containing an animated button that expands without causing overflow and changes colour on tapping.

Screenshot #

image

Do ⭐ the repo if you like it! #

Usage #

To use this package add the following dependency to your pubspec.yaml file:

  dependencies:
    flutter:
      sdk: flutter
    expanding_button:

Usage Example #

An example file can be found here

Expanding button takes in the following parameters:

1. child (Type Widget) (@required)

    ExpandingButton(child: Text('This can be any widget'));

2. onTap (Type VoidCallBack)

    ExpandingButton(
        child: Text('This can be any widget'),
        onTap: () {
            print('This can be any voidcallback which is called on tapping');
        }
    );

3. onTapWhenExpanded (Type VoidCallBack)

    ExpandingButton(
        child: Text('This can be any widget'),
        onTap: () {
            print('This can be any voidcallback which is called on tapping when button is expanded');
        }
    );

4. background (Type Color)

    ExpandingButton(
        child: Text('This can be any widget'),
        // This is the background color of button in non-expanded state        
        background: Colors.blue
    );

5. backgroundAfterAnimation (Type Color)

    ExpandingButton(
        child: Text('This can be any widget'),
        // This is the background color of button in expanded state        
        backgroundAfterAnimation: Colors.greenAccent
    );

License #

Copyright 2020 Abhishek Upmanyu

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

[1.0.2] - 22 March 2020 #

  • Fixed a major error.

[1.0.1] - 22 March 2020 #

  • Fixed a major issue where adding more than one expanding button would throw an error.

[1.0.0] - 18 March 2020 #

  • Added comments in example file

[0.0.1] - 18 March 2020 #

  • A simple widget that expands and changes color on tapping.

example/example.dart

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

class Example extends StatefulWidget {
  @override
  _ExampleState createState() => _ExampleState();
}

class _ExampleState extends State<Example> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Expanding Button Example'),
      ),
      body: Material(
        child: Center(
          // Using the Expanding Button
          child: ExpandingButton(
            // child <Widget>
            child: Text('Finesse', style: TextStyle(color: Colors.white)),
            // onTap <VoidCallback>
            onTap: () {print('expand');},
            // onTapWhenExpanded <VoidCallback>
            onTapWhenExpanded: () {print('collapse');},
            // background <Color>
            background: Colors.blue,
            // backgroundAfterAnimation <Color>
            backgroundAfterAnimation: Colors.greenAccent,
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  expanding_button: ^1.0.2

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:expanding_button/expanding_button.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
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]
50
Learn more about scoring.

We analyzed this package on Jul 3, 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 [expanding_button] that is in a package requiring null.

Health suggestions

Format lib/expanding_button.dart.

Run flutter format to format lib/expanding_button.dart.

Format lib/src/expanded_button.dart.

Run flutter format to format lib/src/expanded_button.dart.

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