Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
66 changes: 61 additions & 5 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,66 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
<<<<<<< HEAD
version: "2.5.0-nullsafety"
=======
version: "2.4.2"
>>>>>>> bd4ea44a12e13d52c4f00d32ba891d0da56fde3c
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
<<<<<<< HEAD
version: "2.1.0-nullsafety"
=======
version: "2.0.0"
>>>>>>> bd4ea44a12e13d52c4f00d32ba891d0da56fde3c
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
<<<<<<< HEAD
version: "1.1.0-nullsafety.2"
=======
version: "1.0.0"
>>>>>>> bd4ea44a12e13d52c4f00d32ba891d0da56fde3c
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
<<<<<<< HEAD
version: "1.2.0-nullsafety"
=======
version: "1.1.3"
>>>>>>> bd4ea44a12e13d52c4f00d32ba891d0da56fde3c
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
<<<<<<< HEAD
version: "1.1.0-nullsafety"
=======
version: "1.0.1"
>>>>>>> bd4ea44a12e13d52c4f00d32ba891d0da56fde3c
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
<<<<<<< HEAD
version: "1.15.0-nullsafety.2"
=======
version: "1.14.13"
>>>>>>> bd4ea44a12e13d52c4f00d32ba891d0da56fde3c
convert:
dependency: transitive
description:
Expand All @@ -63,7 +87,11 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
<<<<<<< HEAD
version: "1.1.0-nullsafety"
=======
version: "1.1.0"
>>>>>>> bd4ea44a12e13d52c4f00d32ba891d0da56fde3c
flutter:
dependency: "direct main"
description: flutter
Expand Down Expand Up @@ -99,21 +127,29 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
<<<<<<< HEAD
version: "0.12.10-nullsafety"
=======
version: "0.12.8"
>>>>>>> bd4ea44a12e13d52c4f00d32ba891d0da56fde3c
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.8"
version: "1.3.0-nullsafety.2"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
<<<<<<< HEAD
version: "1.8.0-nullsafety"
=======
version: "1.7.0"
>>>>>>> bd4ea44a12e13d52c4f00d32ba891d0da56fde3c
path_drawing:
dependency: transitive
description:
Expand Down Expand Up @@ -153,49 +189,65 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
<<<<<<< HEAD
version: "1.8.0-nullsafety"
=======
version: "1.7.0"
>>>>>>> bd4ea44a12e13d52c4f00d32ba891d0da56fde3c
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
<<<<<<< HEAD
version: "1.10.0-nullsafety"
=======
version: "1.9.5"
>>>>>>> bd4ea44a12e13d52c4f00d32ba891d0da56fde3c
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0-nullsafety"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
version: "1.1.0-nullsafety"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0-nullsafety"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
<<<<<<< HEAD
version: "0.2.19-nullsafety"
=======
version: "0.2.17"
>>>>>>> bd4ea44a12e13d52c4f00d32ba891d0da56fde3c
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
<<<<<<< HEAD
version: "1.3.0-nullsafety.2"
=======
version: "1.2.0"
>>>>>>> bd4ea44a12e13d52c4f00d32ba891d0da56fde3c
url_launcher:
dependency: "direct main"
description:
Expand Down Expand Up @@ -230,7 +282,7 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.1.0-nullsafety.2"
xml:
dependency: transitive
description:
Expand All @@ -239,5 +291,9 @@ packages:
source: hosted
version: "4.2.0"
sdks:
<<<<<<< HEAD
dart: ">=2.10.0-0.0.dev <2.10.0"
=======
dart: ">=2.9.0-14.0.dev <3.0.0"
>>>>>>> bd4ea44a12e13d52c4f00d32ba891d0da56fde3c
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