added bend_box
This commit is contained in:
@@ -1,3 +1,2 @@
|
|||||||
## 0.0.1
|
### 0.0.2
|
||||||
|
* Added BendBox
|
||||||
* TODO: Describe initial release.
|
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ packages:
|
|||||||
path: ".."
|
path: ".."
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "0.0.1"
|
version: "0.0.2"
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
40
lib/src/bend_box.dart
Normal file
40
lib/src/bend_box.dart
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class BendBox extends StatelessWidget {
|
||||||
|
final EdgeInsets inward;
|
||||||
|
final Color color;
|
||||||
|
|
||||||
|
BendBox({this.inward = const EdgeInsets.all(0), this.color = Colors.red});
|
||||||
|
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return CustomPaint(painter: _BendBoxPainter(inward: inward, color: color));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _BendBoxPainter extends CustomPainter {
|
||||||
|
final EdgeInsets inward;
|
||||||
|
final Color color;
|
||||||
|
|
||||||
|
_BendBoxPainter({this.inward, this.color});
|
||||||
|
|
||||||
|
void paint(Canvas canvas, Size size) {
|
||||||
|
final paint = Paint()
|
||||||
|
..style = PaintingStyle.fill
|
||||||
|
..isAntiAlias = true
|
||||||
|
..color = color;
|
||||||
|
|
||||||
|
final path = Path()
|
||||||
|
..moveTo(0, 0)
|
||||||
|
..quadraticBezierTo(size.width / 2, inward.top, size.width, 0)
|
||||||
|
..quadraticBezierTo(
|
||||||
|
size.width - inward.left, size.height / 2, size.width, size.height)
|
||||||
|
..quadraticBezierTo(
|
||||||
|
size.width / 2, size.height - inward.bottom, 0, size.height)
|
||||||
|
..quadraticBezierTo(inward.left, size.height / 2, 0, 0)
|
||||||
|
..close();
|
||||||
|
|
||||||
|
canvas.drawPath(path, paint);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool shouldRepaint(CustomPainter oldDelegate) => true;
|
||||||
|
}
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
import 'dart:async';
|
library scoped;
|
||||||
|
|
||||||
|
import 'dart:async';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
export 'src/bend_box.dart';
|
||||||
|
|
||||||
class Ux {
|
class Ux {
|
||||||
static const MethodChannel _channel =
|
static const MethodChannel _channel =
|
||||||
const MethodChannel('ux');
|
const MethodChannel('ux');
|
||||||
|
|||||||
41
pubspec.yaml
41
pubspec.yaml
@@ -1,6 +1,6 @@
|
|||||||
name: ux
|
name: ux
|
||||||
description: UX Kit
|
description: UX Kit
|
||||||
version: 0.0.1
|
version: 0.0.2
|
||||||
author: Alexandru R. Agrapine <alex@swipelab.co>
|
author: Alexandru R. Agrapine <alex@swipelab.co>
|
||||||
homepage: https://swipelab.co/
|
homepage: https://swipelab.co/
|
||||||
|
|
||||||
@@ -15,46 +15,7 @@ dev_dependencies:
|
|||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
|
||||||
|
|
||||||
# The following section is specific to Flutter.
|
|
||||||
flutter:
|
flutter:
|
||||||
# This section identifies this Flutter project as a plugin project.
|
|
||||||
# The androidPackage and pluginClass identifiers should not ordinarily
|
|
||||||
# be modified. They are used by the tooling to maintain consistency when
|
|
||||||
# adding or updating assets for this project.
|
|
||||||
plugin:
|
plugin:
|
||||||
androidPackage: io.swipelab.ux
|
androidPackage: io.swipelab.ux
|
||||||
pluginClass: UxPlugin
|
pluginClass: UxPlugin
|
||||||
|
|
||||||
# To add assets to your plugin package, add an assets section, like this:
|
|
||||||
# assets:
|
|
||||||
# - images/a_dot_burr.jpeg
|
|
||||||
# - images/a_dot_ham.jpeg
|
|
||||||
#
|
|
||||||
# For details regarding assets in packages, see
|
|
||||||
# https://flutter.dev/assets-and-images/#from-packages
|
|
||||||
#
|
|
||||||
# An image asset can refer to one or more resolution-specific "variants", see
|
|
||||||
# https://flutter.dev/assets-and-images/#resolution-aware.
|
|
||||||
|
|
||||||
# To add custom fonts to your plugin package, add a fonts section here,
|
|
||||||
# in this "flutter" section. Each entry in this list should have a
|
|
||||||
# "family" key with the font family name, and a "fonts" key with a
|
|
||||||
# list giving the asset and other descriptors for the font. For
|
|
||||||
# example:
|
|
||||||
# fonts:
|
|
||||||
# - family: Schyler
|
|
||||||
# fonts:
|
|
||||||
# - asset: fonts/Schyler-Regular.ttf
|
|
||||||
# - asset: fonts/Schyler-Italic.ttf
|
|
||||||
# style: italic
|
|
||||||
# - family: Trajan Pro
|
|
||||||
# fonts:
|
|
||||||
# - asset: fonts/TrajanPro.ttf
|
|
||||||
# - asset: fonts/TrajanPro_Bold.ttf
|
|
||||||
# weight: 700
|
|
||||||
#
|
|
||||||
# For details regarding fonts in packages, see
|
|
||||||
# https://flutter.dev/custom-fonts/#from-packages
|
|
||||||
|
|||||||
Reference in New Issue
Block a user