From 3d9e431914b493e0f410e3da58fc697223a3c2bc Mon Sep 17 00:00:00 2001 From: Komek Hayytnazarov Date: Mon, 29 Jul 2024 17:30:30 +0500 Subject: [PATCH] added path --- lib/core/constants/colors.dart | 1 + lib/presentation/screens/order_details.dart | 6 +- lib/presentation/widgets/bottom_navbar.dart | 2 +- lib/presentation/widgets/dashed_line.dart | 70 +++++++++++++++++++ lib/presentation/widgets/location_card.dart | 77 ++++++++++++++++++++- lib/presentation/widgets/order_card.dart | 16 ++--- lib/presentation/widgets/widgets.dart | 1 + 7 files changed, 160 insertions(+), 13 deletions(-) create mode 100644 lib/presentation/widgets/dashed_line.dart diff --git a/lib/core/constants/colors.dart b/lib/core/constants/colors.dart index cc5cc8c..ee1b71b 100644 --- a/lib/core/constants/colors.dart +++ b/lib/core/constants/colors.dart @@ -7,4 +7,5 @@ sealed class AppColors { static const Color green = Color(0xFFA2E052); static const Color grey = Color(0xFF96969C); static const Color darkGrey = Color(0xFF57575C); + static const Color lightGrey = Color(0xFFE5E5E6); } diff --git a/lib/presentation/screens/order_details.dart b/lib/presentation/screens/order_details.dart index 1ed3d56..1596043 100644 --- a/lib/presentation/screens/order_details.dart +++ b/lib/presentation/screens/order_details.dart @@ -28,7 +28,7 @@ class OrderDetailsScreen extends StatelessWidget { /// map SliverToBoxAdapter( child: SizedBox( - height: AppDimensions.normalize(140), + height: AppDimensions.normalize(120), child: const ClusteringPage(), ), ), @@ -70,8 +70,8 @@ class OrderDetailsScreen extends StatelessWidget { /// gap Space.y!, - /// info card - const InfoCard(), + /// location card + const LocationCard() ], ), ), diff --git a/lib/presentation/widgets/bottom_navbar.dart b/lib/presentation/widgets/bottom_navbar.dart index 5d7797a..35f2ea8 100644 --- a/lib/presentation/widgets/bottom_navbar.dart +++ b/lib/presentation/widgets/bottom_navbar.dart @@ -42,7 +42,7 @@ class BottomNavigation extends StatelessWidget { iconSize: AppDimensions.normalize(12), selectedLabelStyle: AppText.b2b, unselectedLabelStyle: AppText.b2!.copyWith( - color: const Color(0xFF96969C), + color: AppColors.grey, ), backgroundColor: AppColors.surface, ), diff --git a/lib/presentation/widgets/dashed_line.dart b/lib/presentation/widgets/dashed_line.dart new file mode 100644 index 0000000..8ec56ab --- /dev/null +++ b/lib/presentation/widgets/dashed_line.dart @@ -0,0 +1,70 @@ +import 'package:flutter/material.dart'; + +class DashedLine extends StatelessWidget { + final double height; + final double width; + final Color color; + final double strokeWidth; + final double dashWidth; + final double dashSpace; + + const DashedLine({ + super.key, + this.height = 1, + this.width = double.infinity, + this.color = Colors.black, + this.strokeWidth = 1, + this.dashWidth = 5, + this.dashSpace = 3, + }); + + @override + Widget build(BuildContext context) { + return SizedBox( + width: width, + height: height, + child: CustomPaint( + painter: _DashedLinePainter( + color: color, + strokeWidth: strokeWidth, + dashWidth: dashWidth, + dashSpace: dashSpace, + ), + ), + ); + } +} + +class _DashedLinePainter extends CustomPainter { + final Color color; + final double strokeWidth; + final double dashWidth; + final double dashSpace; + + _DashedLinePainter({ + required this.color, + required this.strokeWidth, + required this.dashWidth, + required this.dashSpace, + }); + + @override + void paint(Canvas canvas, Size size) { + double startX = 0; + final paint = Paint() + ..color = color + ..strokeWidth = strokeWidth; + + while (startX < size.width) { + canvas.drawLine( + Offset(startX, size.height / 2), + Offset(startX + dashWidth, size.height / 2), + paint, + ); + startX += dashWidth + dashSpace; + } + } + + @override + bool shouldRepaint(CustomPainter oldDelegate) => false; +} diff --git a/lib/presentation/widgets/location_card.dart b/lib/presentation/widgets/location_card.dart index 41f5e22..620edf3 100644 --- a/lib/presentation/widgets/location_card.dart +++ b/lib/presentation/widgets/location_card.dart @@ -1,10 +1,85 @@ import 'package:flutter/material.dart'; +import '../../configs/configs.dart'; +import '../../core/core.dart'; +import 'dashed_line.dart'; + class LocationCard extends StatelessWidget { const LocationCard({super.key}); @override Widget build(BuildContext context) { - return const Placeholder(); + return SizedBox( + width: double.infinity, + child: Card( + color: Colors.white, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (context, index) { + return Row( + children: [ + index % 2 == 0 + ? const Icon( + Icons.radio_button_checked, + color: AppColors.grey, + ) + : Container( + margin: Space.hf(0.35), //const EdgeInsets.only(left: 6), + height: AppDimensions.normalize(4.5), + width: AppDimensions.normalize(4.5), + decoration: const BoxDecoration( + color: AppColors.grey, + shape: BoxShape.circle, + ), + ), + Space.x!, + Text( + routess[index].city, + style: AppText.b1b, + ), + const Spacer(), + Text( + routess[index].date, + style: AppText.b1!.copyWith(color: AppColors.grey), + ), + ], + ); + }, + itemCount: routess.length, + separatorBuilder: (BuildContext context, int index) { + return Padding( + padding: Space.vf(0.5), + child: DashedLine( + height: 1, + width: AppDimensions.normalize(8), + color: AppColors.lightGrey, + strokeWidth: 1, + dashWidth: 5, + dashSpace: AppDimensions.normalize(2), + ), + ); + }, + ), + ), + ), + ); } } + +class Path { + final String city; + final String date; + + Path(this.city, this.date); +} + +List routess = [ + Path('Urumchi', '10.07.2024'), + Path('Astana', '14.07.2024'), + Path('Tashkent', '16.07.2024'), + Path('Samarkant', '25.07.2024'), + Path('Mary', '30.07.2024'), +]; diff --git a/lib/presentation/widgets/order_card.dart b/lib/presentation/widgets/order_card.dart index 2d3b941..ce5e29a 100644 --- a/lib/presentation/widgets/order_card.dart +++ b/lib/presentation/widgets/order_card.dart @@ -50,14 +50,14 @@ class OrderCard extends StatelessWidget { Text( 'Ýolda', style: AppText.b2b!.copyWith( - color: const Color(0xFF96969C), + color: AppColors.grey, ), ), const Spacer(), Text( 'Ugradylan senesi: 16.07.2024', style: AppText.b2b!.copyWith( - color: const Color(0xFF96969C), + color: AppColors.grey, ), ), ], @@ -94,7 +94,7 @@ class OrderCard extends StatelessWidget { Text( 'Nireden:', style: AppText.b2b!.copyWith( - color: const Color(0xFF96969C), + color: AppColors.grey, ), ), Text( @@ -107,7 +107,7 @@ class OrderCard extends StatelessWidget { Text( 'Nirede:', style: AppText.b2b!.copyWith( - color: const Color(0xFF96969C), + color: AppColors.grey, ), ), Text( @@ -132,7 +132,7 @@ class OrderCard extends StatelessWidget { Text( 'Ýer sany:', style: AppText.b2b!.copyWith( - color: const Color(0xFF96969C), + color: AppColors.grey, ), ), Text( @@ -145,7 +145,7 @@ class OrderCard extends StatelessWidget { Text( 'Göwrümi:', style: AppText.b2b!.copyWith( - color: const Color(0xFF96969C), + color: AppColors.grey, ), ), Text( @@ -165,7 +165,7 @@ class OrderCard extends StatelessWidget { Text( 'Maşyn №:', style: AppText.b2b!.copyWith( - color: const Color(0xFF96969C), + color: AppColors.grey, ), ), Text( @@ -178,7 +178,7 @@ class OrderCard extends StatelessWidget { Text( 'Dukan №:', style: AppText.b2b!.copyWith( - color: const Color(0xFF96969C), + color: AppColors.grey, ), ), Text( diff --git a/lib/presentation/widgets/widgets.dart b/lib/presentation/widgets/widgets.dart index abcac9e..3ddfd32 100644 --- a/lib/presentation/widgets/widgets.dart +++ b/lib/presentation/widgets/widgets.dart @@ -8,3 +8,4 @@ export 'order_card.dart'; export 'order_header.dart'; export 'successful_auth_dialog.dart'; export 'vertical_line.dart'; +export 'dashed_line.dart';