Skip to content
Merged
1 change: 0 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class MyApp extends StatelessWidget {
);
}

//
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
Expand Down
244 changes: 1 addition & 243 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,243 +1 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.2"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.13"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_svg:
dependency: "direct main"
description:
name: flutter_svg
url: "https://pub.dartlang.org"
source: hosted
version: "0.18.1"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
getwidget:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "1.1.3"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.8"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.8"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
path_drawing:
dependency: transitive
description:
name: path_drawing
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.1+1"
path_parsing:
dependency: transitive
description:
name: path_parsing
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.4"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.5"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.17"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "5.4.1"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+2"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.1"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.0"
sdks:
dart: ">=2.9.0-14.0.dev <3.0.0"
flutter: ">=1.18.0-6.0.pre <2.0.0"

76 changes: 76 additions & 0 deletions lib/components/border/gf_border.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:getwidget/components/border/gf_dashed_border.dart';
import 'package:getwidget/types/gf_border_type.dart';

class GFBorder extends StatelessWidget {
GFBorder({
@required this.child,
this.color = Colors.black,
this.strokeWidth = 1,
this.type = GFBorderType.Rect,
this.dashedLine = const <double>[3, 1],
this.padding = const EdgeInsets.all(10),
this.radius = const Radius.circular(0),
this.customPath,
}) : assert(child != null),
assert(_isValiddashedLine(dashedLine), 'Invalid dash pattern');

/// child of type [Widget] which can be any component or text , etc
final Widget child;

/// padding of time [EdgeInsets] where in padding is given to the border types
final EdgeInsets padding;

/// storkeWidth of type [double] which is used to define the thickness of the border
final double strokeWidth;

/// color of type [Color] or GFColor which is used to change the color of the border type
final Color color;

/// dashedLine of type [List<double>] which is used for the linear and simple dashed line of border
final List<double> dashedLine;

/// type of [GFBorderType] which is used to define the different types of borders ie, circle, Rect, RRect and oval
final GFBorderType type;

/// radius of type [Radius] used to give a curved border only when the border type is RRect, in other cases radius will not work
final Radius radius;

/// customPath of type [PathBuilder] used for drawing the paths
final PathBuilder customPath;

@override
Widget build(BuildContext context) => Stack(
children: <Widget>[
Positioned.fill(
child: CustomPaint(
painter: DashedType(
strokeWidth: strokeWidth,
radius: radius,
color: color,
type: type,
dashedLine: dashedLine,
customPath: customPath,
),
),
),
Container(padding: padding, child: child),
],
);
}

/// the value of dashedLine cannot be 0 or null, it should have some definite and proper value
bool _isValiddashedLine(List<double> dash) {
final Set<double> _dashSet = dash.toSet();
if (_dashSet == null) {
return false;
}
if (_dashSet.length == 1 && _dashSet.elementAt(0) == 0.0) {
return false;
}
if (_dashSet.isEmpty) {
return false;
}
return true;
}
Loading