From 0b9522221508b6fd7c63c382c9c5dc2331829164 Mon Sep 17 00:00:00 2001 From: FaizHashmiCS22 Date: Thu, 30 Mar 2023 11:05:29 +0300 Subject: [PATCH] Added Widgets --- assets/icons/attachment_icon.svg | 7 + assets/icons/car_hit_icon.svg | 10 ++ assets/icons/car_icon.svg | 9 ++ assets/icons/clock_icon.svg | 3 + assets/icons/close_with_orange_bg.svg | 9 ++ assets/icons/credit_card_icon.svg | 8 + assets/icons/mini_clock_dark.svg | 3 + assets/icons/reserved_cone_icon.svg | 19 +++ assets/icons/review_icon.svg | 14 ++ assets/icons/schedule_appointment_icon.svg | 27 ++++ lib/classes/consts.dart | 10 ++ lib/config/dependencies.dart | 1 + lib/config/routes.dart | 2 + lib/theme/colors.dart | 1 + lib/utils/enums.dart | 7 + lib/widgets/button/show_fill_button.dart | 48 +++--- lib/widgets/common_widgets/ad_widget.dart | 111 -------------- lib/widgets/common_widgets/ads_list.dart | 145 ++++++++++++++++++ lib/widgets/common_widgets/app_bar.dart | 12 +- .../common_widgets/card_button_with_icon.dart | 38 +++++ .../customer_appointment_slider_widget.dart | 33 ++-- lib/widgets/common_widgets/dotted_rect.dart | 109 +++++++++++++ lib/widgets/extensions/extensions_widget.dart | 3 +- 23 files changed, 469 insertions(+), 160 deletions(-) create mode 100644 assets/icons/attachment_icon.svg create mode 100644 assets/icons/car_hit_icon.svg create mode 100644 assets/icons/car_icon.svg create mode 100644 assets/icons/clock_icon.svg create mode 100644 assets/icons/close_with_orange_bg.svg create mode 100644 assets/icons/credit_card_icon.svg create mode 100644 assets/icons/mini_clock_dark.svg create mode 100644 assets/icons/reserved_cone_icon.svg create mode 100644 assets/icons/review_icon.svg create mode 100644 assets/icons/schedule_appointment_icon.svg delete mode 100644 lib/widgets/common_widgets/ad_widget.dart create mode 100644 lib/widgets/common_widgets/ads_list.dart create mode 100644 lib/widgets/common_widgets/card_button_with_icon.dart create mode 100644 lib/widgets/common_widgets/dotted_rect.dart diff --git a/assets/icons/attachment_icon.svg b/assets/icons/attachment_icon.svg new file mode 100644 index 0000000..5669443 --- /dev/null +++ b/assets/icons/attachment_icon.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/icons/car_hit_icon.svg b/assets/icons/car_hit_icon.svg new file mode 100644 index 0000000..939dd86 --- /dev/null +++ b/assets/icons/car_hit_icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/icons/car_icon.svg b/assets/icons/car_icon.svg new file mode 100644 index 0000000..bed8b8e --- /dev/null +++ b/assets/icons/car_icon.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/icons/clock_icon.svg b/assets/icons/clock_icon.svg new file mode 100644 index 0000000..0e9e173 --- /dev/null +++ b/assets/icons/clock_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/icons/close_with_orange_bg.svg b/assets/icons/close_with_orange_bg.svg new file mode 100644 index 0000000..2aba62a --- /dev/null +++ b/assets/icons/close_with_orange_bg.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/icons/credit_card_icon.svg b/assets/icons/credit_card_icon.svg new file mode 100644 index 0000000..12d2cc7 --- /dev/null +++ b/assets/icons/credit_card_icon.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/icons/mini_clock_dark.svg b/assets/icons/mini_clock_dark.svg new file mode 100644 index 0000000..67d4c39 --- /dev/null +++ b/assets/icons/mini_clock_dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/icons/reserved_cone_icon.svg b/assets/icons/reserved_cone_icon.svg new file mode 100644 index 0000000..32e4883 --- /dev/null +++ b/assets/icons/reserved_cone_icon.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/assets/icons/review_icon.svg b/assets/icons/review_icon.svg new file mode 100644 index 0000000..ae18fb0 --- /dev/null +++ b/assets/icons/review_icon.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/icons/schedule_appointment_icon.svg b/assets/icons/schedule_appointment_icon.svg new file mode 100644 index 0000000..972bdca --- /dev/null +++ b/assets/icons/schedule_appointment_icon.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index f9549c6..63bd3c0 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -110,6 +110,16 @@ class MyAssets { static String logo = "${assetPath}images/logo.svg"; static String splashLogo = "${assetPath}images/splash_logo.svg"; static String searchIcon = "${assetPath}icons/search_icon.svg"; + static String miniClockDark = "${assetPath}icons/mini_clock_dark.svg"; + static String scheduleAppointmentIcon = "${assetPath}icons/schedule_appointment_icon.svg"; + static String creditCardIcon = "${assetPath}icons/credit_card_icon.svg"; + static String reservedConeIcon = "${assetPath}icons/reserved_cone_icon.svg"; + static String attachmentIcon = "${assetPath}icons/attachment_icon.svg"; + static String carIcon = "${assetPath}icons/car_icon.svg"; + static String clockIcon = "${assetPath}icons/clock_icon.svg"; + static String closeWithOrangeBg = "${assetPath}icons/close_with_orange_bg.svg"; + static String reviewIcon = "${assetPath}icons/review_icon.svg"; + static String carHitIcon = "${assetPath}icons/car_hit_icon.svg"; //PNG diff --git a/lib/config/dependencies.dart b/lib/config/dependencies.dart index c9710dc..fa0a2d8 100644 --- a/lib/config/dependencies.dart +++ b/lib/config/dependencies.dart @@ -21,5 +21,6 @@ class AppDependencies { //repos injector.registerSingleton(() => UserRepoImp()); + } } diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 6ccf08d..94b6b2b 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -53,6 +53,8 @@ class AppRoutes { static const String dashboard = "/dashboard"; static const String bookProviderAppView = "/bookProviderAppView"; static const String appointmentDetailView = "/appointmentDetailView"; + static const String adsDetailView = "/adsDetailView"; + static const String createAdView = "/createAdView"; diff --git a/lib/theme/colors.dart b/lib/theme/colors.dart index 8eb2538..52cb0e4 100644 --- a/lib/theme/colors.dart +++ b/lib/theme/colors.dart @@ -26,6 +26,7 @@ class MyColors { static const Color lightGreyEAColor = Color(0xffEAEAEA); static const Color darkWhiteColor = Color(0xffE0E0E0); static const Color redColor = Color(0xffD02127); + static const Color greenColor = Color(0xff1D934F); static const Color yellowColor = Color(0xffF4E31C); static const Color backgroundBlackColor = Color(0xff202529); static const Color black = Color(0xff000000); diff --git a/lib/utils/enums.dart b/lib/utils/enums.dart index 70b1712..8c9b0fb 100644 --- a/lib/utils/enums.dart +++ b/lib/utils/enums.dart @@ -5,6 +5,13 @@ // unverified, // } +enum AdCreationStepsEnum { + vehicleDetails, + damageParts, + adDuration, + reviewAd, +} + enum AuthMethodTypes { sms, whatsApp, diff --git a/lib/widgets/button/show_fill_button.dart b/lib/widgets/button/show_fill_button.dart index 13cd8de..6e933e1 100644 --- a/lib/widgets/button/show_fill_button.dart +++ b/lib/widgets/button/show_fill_button.dart @@ -1,21 +1,25 @@ import 'package:flutter/material.dart'; import 'package:mc_common_app/extensions/string_extensions.dart'; - -import '../../theme/colors.dart'; +import 'package:mc_common_app/theme/colors.dart'; class ShowFillButton extends StatelessWidget { String title; + Color? backgroundColor; VoidCallback onPressed; Color txtColor; double elevation, radius, maxWidth, maxHeight, fontSize, horizontalPadding, horizontalMargin, verticalMargin; bool isFlatButton, isBold; EdgeInsets? margin; + bool isFilled; ShowFillButton({ + super.key, required this.title, required this.onPressed, this.txtColor = Colors.white, + this.backgroundColor = MyColors.darkPrimaryColor, this.elevation = 0, + this.isFilled = true, this.radius = 0, this.maxWidth = 88, this.maxHeight = 45, @@ -32,36 +36,38 @@ class ShowFillButton extends StatelessWidget { Widget build(BuildContext context) { return isFlatButton ? Container( - child: showButton(), - height: maxHeight, - padding: const EdgeInsets.only( - left: 20, - right: 20, - ), - ) + height: maxHeight, + padding: const EdgeInsets.only( + left: 20, + right: 20, + ), + child: showButton(), + ) : Padding( - padding: margin ?? const EdgeInsets.all(0.0), - child: ConstrainedBox( - constraints: BoxConstraints( - minHeight: maxHeight, - minWidth: maxWidth, - maxHeight: maxHeight, - maxWidth: maxWidth, - ), - child: showButton(), - ), - ); + padding: margin ?? const EdgeInsets.all(0.0), + child: ConstrainedBox( + constraints: BoxConstraints( + minHeight: maxHeight, + minWidth: maxWidth, + maxHeight: maxHeight, + maxWidth: maxWidth, + ), + child: showButton(), + ), + ); } Widget showButton() { return Container( // decoration: isFlatButton ? null : MyColors.gradientButton, - color: isFlatButton ? null : MyColors.darkPrimaryColor, + color: isFlatButton ? null : isFilled ? backgroundColor : null, margin: EdgeInsets.symmetric(horizontal: horizontalMargin, vertical: verticalMargin), child: MaterialButton( onPressed: onPressed, + shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(radius), + side: isFilled ? BorderSide.none: const BorderSide(width: 3, color: MyColors.darkPrimaryColor), ), child: title.toText( fontSize: fontSize, diff --git a/lib/widgets/common_widgets/ad_widget.dart b/lib/widgets/common_widgets/ad_widget.dart deleted file mode 100644 index 208789d..0000000 --- a/lib/widgets/common_widgets/ad_widget.dart +++ /dev/null @@ -1,111 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mc_common_app/classes/consts.dart'; -import 'package:mc_common_app/extensions/int_extensions.dart'; -import 'package:mc_common_app/extensions/string_extensions.dart'; -import 'package:mc_common_app/theme/colors.dart'; -import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; - -class AdWidget extends StatelessWidget { - final int count; - - const AdWidget({Key? key, required this.count}) : super(key: key); - - @override - Widget build(BuildContext context) { - return ListView.builder( - itemCount: count, - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: const EdgeInsets.only(bottom: 15), - child: buildAdContainer(), - ); - }); - } - - Widget buildAdContainer() { - return Row( - children: [ - Image.asset( - MyAssets.bnCar, - width: 80, - height: 80, - fit: BoxFit.cover, - ), - 12.width, - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - "Toyota Crolla".toText(fontSize: 16, isBold: true), - Row( - children: [ - "Model:".toText( - color: MyColors.lightTextColor, - ), - 2.width, - "2019".toText(), - ], - ), - Row( - children: [ - "Mileage:".toText( - color: MyColors.lightTextColor, - ), - 2.width, - "73,000 km".toText(), - ], - ), - ], - ), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - "Riyadh".toText( - color: MyColors.lightTextColor, - ), - "9 Hours Ago".toText( - color: MyColors.lightTextColor, - ), - ], - ), - ], - ), - 8.height, - Row( - children: [ - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - "30,000".toText(fontSize: 16, isBold: true), - 2.width, - "SAR:".toText( - color: MyColors.lightTextColor, - ), - ], - ), - ), - const Icon(Icons.arrow_forward) - ], - ), - ], - ), - ), - ], - ).toWhiteContainer(width: double.infinity, allPading: 12); - } -} diff --git a/lib/widgets/common_widgets/ads_list.dart b/lib/widgets/common_widgets/ads_list.dart new file mode 100644 index 0000000..67f6c7b --- /dev/null +++ b/lib/widgets/common_widgets/ads_list.dart @@ -0,0 +1,145 @@ +import 'package:flutter/material.dart'; +import 'package:mc_common_app/classes/consts.dart'; +import 'package:mc_common_app/extensions/int_extensions.dart'; +import 'package:mc_common_app/extensions/string_extensions.dart'; +import 'package:mc_common_app/theme/colors.dart'; +import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; + +class BuildAdsList extends StatelessWidget { + final int count; + final Function() onAdPressed; + final ScrollPhysics? scrollPhysics; + + const BuildAdsList({Key? key, required this.count, this.scrollPhysics, required this.onAdPressed}) : super(key: key); + + @override + Widget build(BuildContext context) { + return ListView.builder( + itemCount: count, + shrinkWrap: true, + physics: scrollPhysics, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: const EdgeInsets.only(bottom: 15), + child: AdCard(isReserved: index == 3), + ).onPress(onAdPressed); + }); + } +} + +class AdCard extends StatelessWidget { + final bool isReserved; + + const AdCard({Key? key, required this.isReserved}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Stack( + alignment: Alignment.center, + children: [ + Row( + children: [ + Image.asset( + MyAssets.bnCar, + width: 80, + height: 80, + fit: BoxFit.cover, + ), + 12.width, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Toyota Crolla".toText(fontSize: 16, isBold: true), + Row( + children: [ + "Model:".toText( + color: MyColors.lightTextColor, + ), + 2.width, + "2019".toText(), + ], + ), + Row( + children: [ + "Mileage:".toText( + color: MyColors.lightTextColor, + ), + 2.width, + "73,000 km".toText(), + ], + ), + ], + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Riyadh".toText( + color: MyColors.lightTextColor, + ), + "9 Hours Ago".toText( + color: MyColors.lightTextColor, + ), + ], + ), + ], + ), + 8.height, + Row( + children: [ + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + "30,000".toText(fontSize: 16, isBold: true), + 2.width, + "SAR:".toText( + color: MyColors.lightTextColor, + ), + ], + ), + ), + const Icon(Icons.arrow_forward) + ], + ), + ], + ), + ), + ], + ), + if (isReserved) + Container( + height: 100, + alignment: Alignment.center, + color: MyColors.white.withOpacity(0.9), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + MyAssets.reservedConeIcon.buildSvg(), + 5.width, + "Reserved".toText( + color: MyColors.darkPrimaryColor, + fontSize: 17, + isBold: true, + ) + ], + ), + ) + else + const SizedBox(), + ], + ).toWhiteContainer(width: double.infinity, allPading: 12); + } +} diff --git a/lib/widgets/common_widgets/app_bar.dart b/lib/widgets/common_widgets/app_bar.dart index ed766ac..feceb0f 100644 --- a/lib/widgets/common_widgets/app_bar.dart +++ b/lib/widgets/common_widgets/app_bar.dart @@ -95,7 +95,8 @@ class CustomAppBar extends StatelessWidget with PreferredSizeWidget { return Column( children: [ AppBar( - leadingWidth: leadingWidth??61, + automaticallyImplyLeading: false, + leadingWidth: leadingWidth ?? 61, backgroundColor: backgroundColor ?? Colors.white, elevation: elevation ?? 0, centerTitle: isTitleCenter ?? true, @@ -126,7 +127,7 @@ class CustomAppBar extends StatelessWidget with PreferredSizeWidget { color: Colors.black, size: 16, ), - onPressed: () => onTap??Navigator.of(context).pop(), + onPressed: () => onTap ?? Navigator.of(context).pop(), ).toContainer( paddingAll: 0, borderRadius: 100, @@ -145,10 +146,9 @@ class CustomAppBar extends StatelessWidget with PreferredSizeWidget { ), if (backgroundColor == null) const Divider( - thickness: 1, - color: MyColors.lightGreyEFColor, - height: 1, - ) + thickness: 1, + // color: MyColors.lightGreyEFColor, + height: 1) ], ); } diff --git a/lib/widgets/common_widgets/card_button_with_icon.dart b/lib/widgets/common_widgets/card_button_with_icon.dart new file mode 100644 index 0000000..65b666c --- /dev/null +++ b/lib/widgets/common_widgets/card_button_with_icon.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; +import 'package:mc_common_app/extensions/int_extensions.dart'; +import 'package:mc_common_app/extensions/string_extensions.dart'; +import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; + +class CardButtonWithIcon extends StatelessWidget { + final Widget icon; + final Function() onCardTapped; + final String title; + + const CardButtonWithIcon({ + Key? key, + required this.onCardTapped, + required this.title, + required this.icon, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return SizedBox( + height: 110, + width: 110, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + icon, + // 16.height, + title.toText( + fontSize: 11, + isBold: true, + textAlign: TextAlign.left, + ) + ], + ).toWhiteContainer(allPading: 12, width: double.infinity).onPress(onCardTapped), + ); + } +} diff --git a/lib/widgets/common_widgets/customer_appointment_slider_widget.dart b/lib/widgets/common_widgets/customer_appointment_slider_widget.dart index 0c9f995..f88dcb2 100644 --- a/lib/widgets/common_widgets/customer_appointment_slider_widget.dart +++ b/lib/widgets/common_widgets/customer_appointment_slider_widget.dart @@ -26,32 +26,19 @@ class CustomerAppointmentSliderWidget extends StatelessWidget { // }, ), itemCount: 10, - itemBuilder: (BuildContext context, int itemIndex, int pageViewIndex) => const BuildAppointmentContainerForCustomer(isForHome: true), - ); - } - - Widget showServices(String title) { - return Row( - children: [ - const Icon( - Icons.ac_unit, - color: MyColors.primaryColor, - size: 18, - ), - 8.width, - title.toText( - fontSize: 14, - isBold: true, - ), - ], + itemBuilder: (BuildContext context, int itemIndex, int pageViewIndex) => BuildAppointmentContainerForCustomer( + isForHome: true, + onTapped: () {}, + ), ); } } class BuildAppointmentContainerForCustomer extends StatelessWidget { final bool? isForHome; + final Function() onTapped; - const BuildAppointmentContainerForCustomer({Key? key, this.isForHome = false}) : super(key: key); + const BuildAppointmentContainerForCustomer({Key? key, this.isForHome = false, required this.onTapped}) : super(key: key); Widget showServices(String title, String icon) { return Row( @@ -69,7 +56,11 @@ class BuildAppointmentContainerForCustomer extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - margin: const EdgeInsets.only(bottom: 21, left: 21, right: 21, top: 7), + margin: const EdgeInsets.only( + bottom: 10, + left: 21, + right: 21, + ), child: Column( children: [ Row( @@ -146,7 +137,7 @@ class BuildAppointmentContainerForCustomer extends StatelessWidget { ], ), ], - ).toWhiteContainer(width: double.infinity, allPading: 12), + ).onPress(onTapped).toWhiteContainer(width: double.infinity, allPading: 12), ); } } diff --git a/lib/widgets/common_widgets/dotted_rect.dart b/lib/widgets/common_widgets/dotted_rect.dart new file mode 100644 index 0000000..c91ccd8 --- /dev/null +++ b/lib/widgets/common_widgets/dotted_rect.dart @@ -0,0 +1,109 @@ +import 'package:flutter/material.dart'; +import 'dart:math' as math; + +class DashedRect extends StatelessWidget { + final Color color; + final double strokeWidth; + final double gap; + final Widget child; + + const DashedRect({ + super.key, + this.color = Colors.black, + this.strokeWidth = 1.0, + this.gap = 5.0, + required this.child, + }); + + @override + Widget build(BuildContext context) { + return Padding( + padding: EdgeInsets.all(strokeWidth / 2), + child: CustomPaint( + painter: DashRectPainter(color: color, strokeWidth: strokeWidth, gap: gap), + child: Center(child: child), + ), + ); + } +} + +class DashRectPainter extends CustomPainter { + double strokeWidth; + Color color; + double gap; + + DashRectPainter({this.strokeWidth = 5.0, this.color = Colors.red, this.gap = 5.0}); + + @override + void paint(Canvas canvas, Size size) { + Paint dashedPaint = Paint() + ..color = color + ..strokeWidth = strokeWidth + ..style = PaintingStyle.stroke; + + double x = size.width; + double y = size.height; + + Path topPath = getDashedPath( + a: const math.Point(0, 0), + b: math.Point(x, 0), + gap: gap, + ); + + Path rightPath = getDashedPath( + a: math.Point(x, 0), + b: math.Point(x, y), + gap: gap, + ); + + Path bottomPath = getDashedPath( + a: math.Point(0, y), + b: math.Point(x, y), + gap: gap, + ); + + Path leftPath = getDashedPath( + a: const math.Point(0, 0), + b: math.Point(0.001, y), + gap: gap, + ); + + canvas.drawPath(topPath, dashedPaint); + canvas.drawPath(rightPath, dashedPaint); + canvas.drawPath(bottomPath, dashedPaint); + canvas.drawPath(leftPath, dashedPaint); + } + + Path getDashedPath({ + required math.Point a, + required math.Point b, + @required gap, + }) { + Size size = Size(b.x - a.x, b.y - a.y); + Path path = Path(); + path.moveTo(a.x, a.y); + bool shouldDraw = true; + math.Point currentPoint = math.Point(a.x, a.y); + + num radians = math.atan(size.height / size.width); + + num dx = math.cos(radians) * gap < 0 ? math.cos(radians) * gap * -1 : math.cos(radians) * gap; + + num dy = math.sin(radians) * gap < 0 ? math.sin(radians) * gap * -1 : math.sin(radians) * gap; + + while (currentPoint.x <= b.x && currentPoint.y <= b.y) { + shouldDraw ? path.lineTo(currentPoint.x.toDouble(), currentPoint.y.toDouble()) : path.moveTo(currentPoint.x.toDouble(), currentPoint.y.toDouble()); + shouldDraw = !shouldDraw; + currentPoint = math.Point( + currentPoint.x + dx, + currentPoint.y + dy, + ); + } + return path; + } + + @override + bool shouldRepaint(CustomPainter oldDelegate) { + return true; + } +} diff --git a/lib/widgets/extensions/extensions_widget.dart b/lib/widgets/extensions/extensions_widget.dart index d4884c6..695637f 100644 --- a/lib/widgets/extensions/extensions_widget.dart +++ b/lib/widgets/extensions/extensions_widget.dart @@ -328,10 +328,11 @@ extension xDouble on int { } extension BuildSVG on String { - Widget buildSvg({double? height, double? width, BoxFit fit = BoxFit.contain}) { + Widget buildSvg({double? height, double? width, BoxFit fit = BoxFit.contain, Color? color}) { return SvgPicture.asset( this, fit: fit, + color: color, height: height, width: width, );