superellipse 1.0.0 copy "superellipse: ^1.0.0" to clipboard
superellipse: ^1.0.0 copied to clipboard

A superellipse package that include some useful class like painter,path,shape,etc.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:superellipse/superellipse.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: 'Superellipse Demo',
      home: Home(),
    );
  }
}

class Home extends StatefulWidget {
  Home({Key key}) : super(key: key);

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

class _HomeState extends State<Home> {
  double _value = 3;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Superellipse Demo'),
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Center(
            child: MaterialButton(
              onPressed: () {},
              color: Colors.grey,
              clipBehavior: Clip.antiAlias,
              shape: SuperellipseShape(
                radius: SuperellipseRadius.all(SuperRadius.value(_value)),
                side: BorderSide(
                  color: Colors.pink,
                  width: 4,
                ),
              ),
              minWidth: 100,
              height: 100,
            ),
          ),
          SizedBox(height: 20),
          Center(
            child: CustomPaint(
              painter: SuperellipsePainter(
                radius: SuperellipseRadius.only(
                  topLeft: SuperRadius.value(_value),
                ),
              ),
              size: Size(100, 100),
            ),
          ),
          SizedBox(height: 20),
          Text('n=${_value.toStringAsFixed(1)}'),
        ],
      ),
      bottomNavigationBar: Container(
        height: 56,
        child: Slider(
          value: _value,
          min: 0.01,
          max: 10,
          onChanged: (value) {
            setState(() {
              _value = value;
            });
          },
        ),
      ),
    );
  }
}
4
likes
130
pub points
0%
popularity

Publisher

verified publisherlaihz.tech

A superellipse package that include some useful class like painter,path,shape,etc.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on superellipse