From b3c71e46a3755980f7481fb44017031e0780cf17 Mon Sep 17 00:00:00 2001 From: Komek Hayytnazarov Date: Wed, 24 Jul 2024 17:14:17 +0500 Subject: [PATCH] added detail screen --- lib/core/router/app_router.dart | 5 +- lib/presentation/screens/order_details.dart | 79 +++++++++++++++++++++ lib/presentation/screens/screens.dart | 1 + lib/presentation/screens/splash.dart | 1 - lib/presentation/screens/splash2.dart | 1 - lib/presentation/widgets/info_card.dart | 76 ++++++++++++++++++++ lib/presentation/widgets/location_card.dart | 10 +++ lib/presentation/widgets/order_card.dart | 14 ++-- lib/presentation/widgets/widgets.dart | 10 +-- pubspec.lock | 32 --------- pubspec.yaml | 1 - 11 files changed, 185 insertions(+), 45 deletions(-) create mode 100644 lib/presentation/screens/order_details.dart create mode 100644 lib/presentation/widgets/info_card.dart create mode 100644 lib/presentation/widgets/location_card.dart diff --git a/lib/core/router/app_router.dart b/lib/core/router/app_router.dart index c0fd2be..6157207 100644 --- a/lib/core/router/app_router.dart +++ b/lib/core/router/app_router.dart @@ -8,7 +8,7 @@ sealed class AppRouter { static const String splash2 = '/splash2'; static const String login = '/login'; static const String root = '/root'; - // static const String productDetails = '/product-details'; + static const String orderDetails = '/order-details'; // static const String search = '/search'; // static const String filter = '/filter'; // static const String signup = '/signup'; @@ -36,6 +36,9 @@ sealed class AppRouter { return MaterialPageRoute(builder: (_) => const LoginScreen()); case root: return MaterialPageRoute(builder: (_) => const RootScreen()); + case orderDetails: + // ProductEntity product = routeSettings.arguments as ProductEntity; + return MaterialPageRoute(builder: (_) => const OrderDetailsScreen()); // case search: // return MaterialPageRoute(builder: (_) => const SearchScreen()); // case filter: diff --git a/lib/presentation/screens/order_details.dart b/lib/presentation/screens/order_details.dart new file mode 100644 index 0000000..75177d6 --- /dev/null +++ b/lib/presentation/screens/order_details.dart @@ -0,0 +1,79 @@ +import 'package:cargo/configs/configs.dart'; +import 'package:flutter/material.dart'; + +import '../../core/core.dart'; +import '../widgets/widgets.dart'; + +class OrderDetailsScreen extends StatelessWidget { + const OrderDetailsScreen({super.key}); + + @override + Widget build(BuildContext context) { + App.init(context); + return Scaffold( + backgroundColor: AppColors.surface, + appBar: AppBar( + iconTheme: const IconThemeData( + color: Colors.white, + ), + backgroundColor: AppColors.primary, + title: Text( + 'Sargyt №ABC456789', + style: AppText.h2!.copyWith(color: Colors.white), + ), + ), + body: CustomScrollView( + slivers: [ + /// map + const SliverToBoxAdapter( + child: OrderHeader(), + ), + + /// info text + SliverToBoxAdapter( + child: Padding( + padding: Space.all(1, 1), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Sargyt barada maglumat №ABC456789', + style: AppText.b1b, + ), + + /// gap + Space.y!, + + /// info card + const InfoCard(), + ], + ), + ), + ), + + /// current location info + SliverToBoxAdapter( + child: Padding( + padding: Space.all(1, 1), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Gatnaw yoly', + style: AppText.b1b, + ), + + /// gap + Space.y!, + + /// info card + const InfoCard(), + ], + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/presentation/screens/screens.dart b/lib/presentation/screens/screens.dart index 3ed80f2..58d6658 100644 --- a/lib/presentation/screens/screens.dart +++ b/lib/presentation/screens/screens.dart @@ -2,3 +2,4 @@ export 'splash.dart'; export 'splash2.dart'; export 'login.dart'; export 'root.dart'; +export 'order_details.dart'; diff --git a/lib/presentation/screens/splash.dart b/lib/presentation/screens/splash.dart index 7040441..1041b77 100644 --- a/lib/presentation/screens/splash.dart +++ b/lib/presentation/screens/splash.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; -import '../../configs/app.dart'; import '../../configs/configs.dart'; import '../../core/core.dart'; diff --git a/lib/presentation/screens/splash2.dart b/lib/presentation/screens/splash2.dart index d02dc2c..da05b8c 100644 --- a/lib/presentation/screens/splash2.dart +++ b/lib/presentation/screens/splash2.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; -import '../../configs/app.dart'; import '../../configs/configs.dart'; import '../../core/core.dart'; import '../presentation.dart'; diff --git a/lib/presentation/widgets/info_card.dart b/lib/presentation/widgets/info_card.dart new file mode 100644 index 0000000..83f39a1 --- /dev/null +++ b/lib/presentation/widgets/info_card.dart @@ -0,0 +1,76 @@ +import 'package:flutter/material.dart'; + +import '../../configs/configs.dart'; + +class InfoCard extends StatelessWidget { + const InfoCard({super.key}); + + @override + Widget build(BuildContext context) { + return SizedBox( + width: double.infinity, + child: Card( + color: Colors.white, + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const RowTextWidget(title: 'Ýagdaýy:', info: 'Ýolda'), + Space.y!, + const RowTextWidget(title: 'Awtoulag №:', info: 'ABC456789'), + Space.y!, + const RowTextWidget(title: 'Dukan №:', info: 'ABC456789'), + Space.y!, + const RowTextWidget(title: 'Nireden ugradyldy:', info: 'Urumçy'), + Space.y!, + const RowTextWidget(title: 'Nirä barmaly:', info: 'Aşgabat'), + Space.y!, + const RowTextWidget(title: 'Ýer sany:', info: '36'), + Space.y!, + const RowTextWidget(title: 'Kub:', info: '12 m3'), + Space.y!, + const RowTextWidget(title: 'Göwrumi:', info: '60x57x38 (ini, uzynlygy, beýikligi)'), + Space.y!, + const RowTextWidget(title: 'Harydyň ady:', info: 'Köwüş'), + Space.y!, + const RowTextWidget(title: 'Sargydyň bahasy:', info: '300'), + ], + ), + ), + ), + ); + } +} + +class RowTextWidget extends StatelessWidget { + final String title; + final String info; + const RowTextWidget({ + super.key, + required this.title, + required this.info, + }); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Text( + title, + style: AppText.b1!.copyWith( + color: const Color(0xFF57575C), + ), + ), + Space.x!, + Text( + info, + style: AppText.b1!.copyWith( + color: const Color(0xFF0C0C0D), + fontWeight: FontWeight.w500, + ), + ), + ], + ); + } +} diff --git a/lib/presentation/widgets/location_card.dart b/lib/presentation/widgets/location_card.dart new file mode 100644 index 0000000..41f5e22 --- /dev/null +++ b/lib/presentation/widgets/location_card.dart @@ -0,0 +1,10 @@ +import 'package:flutter/material.dart'; + +class LocationCard extends StatelessWidget { + const LocationCard({super.key}); + + @override + Widget build(BuildContext context) { + return const Placeholder(); + } +} diff --git a/lib/presentation/widgets/order_card.dart b/lib/presentation/widgets/order_card.dart index 4e4d267..7924ed4 100644 --- a/lib/presentation/widgets/order_card.dart +++ b/lib/presentation/widgets/order_card.dart @@ -1,4 +1,3 @@ -import 'package:easy_stepper/easy_stepper.dart'; import 'package:flutter/material.dart'; import '../../configs/configs.dart'; @@ -25,10 +24,15 @@ class OrderCard extends StatelessWidget { '№ABC456789', style: AppText.b1b, ), - Text( - 'Genişleýin >', - style: AppText.b1b?.copyWith( - color: AppColors.primary, + GestureDetector( + onTap: () { + Navigator.of(context).pushNamed(AppRouter.orderDetails); + }, + child: Text( + 'Ginişleýin >', + style: AppText.b1b?.copyWith( + color: AppColors.primary, + ), ), ), ], diff --git a/lib/presentation/widgets/widgets.dart b/lib/presentation/widgets/widgets.dart index 9e3d2c1..832849b 100644 --- a/lib/presentation/widgets/widgets.dart +++ b/lib/presentation/widgets/widgets.dart @@ -1,7 +1,9 @@ -export 'button.dart'; -export 'successful_auth_dialog.dart'; -export 'credential_failure_dialog.dart'; export 'auth_error_dialog.dart'; export 'bottom_navbar.dart'; -export 'order_header.dart'; +export 'button.dart'; +export 'credential_failure_dialog.dart'; +export 'info_card.dart'; +export 'location_card.dart'; export 'order_card.dart'; +export 'order_header.dart'; +export 'successful_auth_dialog.dart'; diff --git a/pubspec.lock b/pubspec.lock index b0ef175..91dd2f1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,14 +1,6 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: - dependency: transitive - description: - name: archive - sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d - url: "https://pub.dev" - source: hosted - version: "3.6.1" args: dependency: transitive description: @@ -65,14 +57,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.18.0" - crypto: - dependency: transitive - description: - name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab - url: "https://pub.dev" - source: hosted - version: "3.0.3" cupertino_icons: dependency: "direct main" description: @@ -89,14 +73,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.10.1" - easy_stepper: - dependency: "direct main" - description: - name: easy_stepper - sha256: d09e974ec9148480072f8a7d3b0779dfdbc1a3ec1ff7daa7fbda95b0c1fe7453 - url: "https://pub.dev" - source: hosted - version: "0.8.5" equatable: dependency: "direct main" description: @@ -296,14 +272,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.0" - lottie: - dependency: transitive - description: - name: lottie - sha256: "6a24ade5d3d918c306bb1c21a6b9a04aab0489d51a2582522eea820b4093b62b" - url: "https://pub.dev" - source: hosted - version: "3.1.2" matcher: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 40362f2..c9d0641 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -23,7 +23,6 @@ dependencies: flutter_phoenix: ^1.1.1 flutter_svg: ^2.0.10+1 flutter_secure_storage: ^9.2.2 - easy_stepper: ^0.8.5 dev_dependencies: flutter_test: