sort 0.0.2 copy "sort: ^0.0.2" to clipboard
sort: ^0.0.2 copied to clipboard

Flutter package for sorting numbers, lists, maps, doubles and dates with quick and simple sort algorithms

example/lib/main.dart

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

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final textEditingController = TextEditingController();

  var list = <double>[9.3, 12.4, 2, 3, 6, 7];

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: SafeArea(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text(
                '$list',
                style: TextStyle(
                  fontSize: 21,
                ),
              ),
              SizedBox(height: 10),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                children: [
                  RaisedButton(
                    onPressed: () {
                      setState(() {
                        list.simpleSort();
                      });
                    },
                    child: Text('Simple Sort'),
                  ),
                  RaisedButton(
                    onPressed: () {
                      setState(() {
                        list.quickSort();
                      });
                    },
                    child: Text('Quick Sort'),
                  ),
                ],
              ),
              SizedBox(height: 10),
              Container(
                padding: EdgeInsets.symmetric(horizontal: 10),
                child: Row(
                  children: [
                    Expanded(
                      child: TextField(
                        keyboardType: TextInputType.number,
                        controller: textEditingController,
                        decoration: InputDecoration(hintText: 'Enter a number'),
                      ),
                    ),
                    RaisedButton(
                      onPressed: () {
                        setState(() {
                          list.addAndSort(
                              item: double.parse(textEditingController.text));
                        });
                      },
                      child: Text('Add and Sort'),
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
19
likes
40
pub points
60%
popularity

Publisher

unverified uploader

Flutter package for sorting numbers, lists, maps, doubles and dates with quick and simple sort algorithms

Repository (GitHub)
View/report issues

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on sort