animated_multi_select 1.0.0

Alrasasi Multi Selection Animated Widget #

Build Status

Features #

Get your horizantal smooth multi-select widget.

  • Change the color as you want
  • Change the size
  • Create you preffered customized multi list
  • Put it anywhere

ScreenShots #

Installation #

You should ensure that you add the alrasasi_animated_multi_select as a dependency in your flutter project.


dependencies:
  animated_multi_select: ^1.0

You should then run flutter packages get in your terminal so as to get the package.

Usage #

For production environments...

            SingleChildScrollView(
              child: Row(
                children: <Widget>[
                  Flexible(
                      child: MultiSelectChip(
                    reverseScroll: false,
                    introWidget: CircleTransWidget(),
                    introWidgetWidth: 100,
                    color: Color(0xff293462),
                    width: 100,
                    height: 85,
                    borderRadius: BorderRadius.circular(15),
                    borderWidth: 3,
                    mainList: this.mainList,
                    onSelectionChanged: (selectedList) {
                      setState(() {
                        selectedList = selectedList;
                      });
                    },
                    widgetList: widgetList,
                    initialSelectionList: selectedList,
                  )),
                ],
              ),
            ),

Documentation #

MultiSelectChip class #

PluginREADME
reverseScrollfrom left to write of reverse
introWidgetThe widget beside the multi list
introWidetWidththe width of the introWidget is required, it is in stack
colorThe color of the widget and its border
widthThe width of the single selectio widget
heightThe height of the single selected widget
borderRadiusthe border radius of the single selected widget
onSelectionChangedA function to react to selection actions
initialSelectionListInitial list part from the main list
widgetListthe map that mutches the item with its created widget (see example in github)

"# animated_multi_selection"

[1.0.0] - First Release.

  • Describe initial release.

example/main.dart

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

class MyApp extends StatelessWidget {
  @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> {
  List<String> mainList = [
    "item1",
    "item2",
    "item3",
    "item4",
    "item5",
  ];

  Map<String, Widget> widgetList = {
    'item1': Text('skin: 120', style: TextStyle(color:Color(0xfffff1c1)),),
    "item2": Text('Body: 130', style: TextStyle(color:Color(0xfffff1c1))),
    "item3": Text('Hair: 140', style: TextStyle(color:Color(0xfffff1c1))),
    "item4": Text('Mikiaj: 50', style: TextStyle(color:Color(0xfffff1c1))),
    "item5": Text('Nails: 60', style: TextStyle(color:Color(0xfffff1c1)))
  };

  List<String> selectedList = [
    "item1",
    "item2",
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black,
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Text(selectedList.join(" , "), style: TextStyle(color:Color(0xfffff1c1))),
            //
            SingleChildScrollView(
              child: Row(
                children: <Widget>[
                  Flexible(
                      child: MultiSelectChip(
                        reverseScroll: false,
                        introWidget: CircleTransWidget(),
                        introWidgetWidth: 100,
                        color: Color(0xff293462),
                        width: 100,
                        height: 85,
                        borderRadius: BorderRadius.circular(15),
                        borderWidth: 3,
                        mainList: this.mainList,
                        onSelectionChanged: (selectedList) {
                          setState(() {
                            selectedList = selectedList;
                          });
                        },
                        widgetList: widgetList,
                        initialSelectionList: selectedList,
                      )),
                ],
              ),
            ),
            Divider(
              height: 50,
            ),
            Padding(
              padding: const EdgeInsets.all(8.0),
              child: Text('MultiList without intro widget', style: TextStyle(color:Color(0xfffff1c1))),
            ),
            SingleChildScrollView(
              child: Row(
                children: <Widget>[
                  Flexible(
                      child: MultiSelectChip(
                        reverseScroll: false,
                        introWidgetWidth: 100,
                        color: Color(0xff382039),
                        width: 100,
                        height: 200,
                        borderRadius: BorderRadius.circular(30),
                        borderWidth: 1,
                        mainList: this.mainList,
                        onSelectionChanged: (selectedList) {
                          setState(() {
                            selectedList = selectedList;
                          });
                        },
                        widgetList: widgetList,
                        initialSelectionList: selectedList,
                      )),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}

class CircleTransWidget extends StatelessWidget {
  final String img;
  CircleTransWidget({Key key, this.img}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    double radius = 100;
    return Container(
      width: radius,
      height: radius,
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(50),
          color: Colors.red,

          // image: DecorationImage(
          //   fit: BoxFit.fill,
          //   image: AssetImage(
          //     img,
          //   ),
          // ),

          gradient: LinearGradient(
              begin: FractionalOffset.centerLeft,
              end: FractionalOffset.topRight,
              colors: [
                Colors.blue,
                Colors.yellow.withAlpha(9),
              ],
              stops: [
                0.0,
                0.7
              ])
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  animated_multi_select: ^1.0.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:animated_multi_select/animated_multi_select.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
2
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]
51
Learn more about scoring.

We analyzed this package on Aug 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/animated_multi_select.dart.

Run flutter format to format lib/animated_multi_select.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.11 1.14.12
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test