From 08e14d2efd22a2a167242fa96ebda5c46df79102 Mon Sep 17 00:00:00 2001 From: Komek Hayytnazarov Date: Fri, 2 Aug 2024 15:44:37 +0500 Subject: [PATCH] added screen --- .fvmrc | 3 + .gitignore | 3 + .vscode/settings.json | 3 + lib/configs/app_dimensions.dart | 2 +- lib/presentation/screens/profile.dart | 202 ++++++++++++++++++++++++++ lib/presentation/screens/root.dart | 8 +- lib/presentation/screens/screens.dart | 8 +- 7 files changed, 221 insertions(+), 8 deletions(-) create mode 100644 .fvmrc create mode 100644 .vscode/settings.json create mode 100644 lib/presentation/screens/profile.dart diff --git a/.fvmrc b/.fvmrc new file mode 100644 index 0000000..4efffa7 --- /dev/null +++ b/.fvmrc @@ -0,0 +1,3 @@ +{ + "flutter": "3.22.1" +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 29a3a50..75dfa95 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,6 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release + +# FVM Version Cache +.fvm/ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..91d33fd --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "dart.flutterSdkPath": ".fvm/versions/3.22.1" +} \ No newline at end of file diff --git a/lib/configs/app_dimensions.dart b/lib/configs/app_dimensions.dart index 4045a76..1d267b3 100644 --- a/lib/configs/app_dimensions.dart +++ b/lib/configs/app_dimensions.dart @@ -51,7 +51,7 @@ class AppDimensions { static String inString() { final x = UI.width! / UI.height!; - final ps = ui.window.physicalSize; + final ps = WidgetsBinding.instance.platformDispatcher.views.first.physicalSize; //ui.window.physicalSize; return ''' Width: ${UI.width} | ${ps.width} Height: ${UI.height} | ${ps.height} diff --git a/lib/presentation/screens/profile.dart b/lib/presentation/screens/profile.dart new file mode 100644 index 0000000..8209fb9 --- /dev/null +++ b/lib/presentation/screens/profile.dart @@ -0,0 +1,202 @@ +import 'package:cargo/configs/app_typography.dart'; +import 'package:cargo/configs/space.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; + +import '../../configs/configs.dart'; +import '../../core/core.dart'; + +class ProfileScreen extends StatelessWidget { + const ProfileScreen({super.key}); + + @override + Widget build(BuildContext context) { + App.init(context); + return Scaffold( + // appBar: AppBar(), + backgroundColor: AppColors.surface, + body: SingleChildScrollView( + child: Padding( + padding: Space.all(1, 1), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + /// gap + Space.yf(1), + + /// header + Text( + 'Şahsy otagym', + style: AppText.h1b, + ), + + Space.y!, + + /// card + SizedBox( + width: double.infinity, + child: Card( + color: Colors.white, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + children: [ + /// identity + const RowWidget( + text: 'ABC1234567890!@#', + leadingIcon: Icons.verified_user_outlined, + ), + + /// gap + Space.yf(1), + + /// name surname + const RowWidget( + text: 'Maksat Üstünlikow', + leadingIcon: Icons.person_2_outlined, + trailingIcon: Icons.mode_edit_outlined, + ), + + /// gap + Space.yf(1), + + /// phone + const RowWidget( + text: '+993 (XX) XX-XX-XX', + leadingIcon: Icons.phone_android_outlined, + trailingIcon: Icons.mode_edit_outlined, + ), + ], + ), + ), + ), + ), + + ///gap + Space.yf(2), + + /// card + const SizedBox( + width: double.infinity, + child: Card( + color: Colors.white, + child: Padding( + padding: EdgeInsets.all(16.0), + child: RowWidget( + text: 'Tehniki goldaw bilen habarlaşmak', + leadingIcon: Icons.contact_support_outlined, + trailingIcon: Icons.arrow_forward_ios, + ), + ), + ), + ), + + ///gap + Space.yf(2), + + /// card + SizedBox( + width: double.infinity, + child: Card( + color: Colors.white, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + children: [ + /// identity + const RowWidget( + text: 'Dil saýlamak (Türkmen dili)', + leadingIcon: Icons.language_outlined, + trailingIcon: Icons.arrow_forward_ios, + ), + + /// gap + Space.yf(1), + + /// name surname + const RowWidget( + text: 'Gizlinlik syýasaty', + leadingIcon: Icons.gpp_maybe_outlined, + trailingIcon: Icons.arrow_forward_ios, + ), + + /// gap + Space.yf(1), + + /// phone + const RowWidget( + text: 'Ulanyş şertleri', + leadingIcon: Icons.file_copy_outlined, + trailingIcon: Icons.arrow_forward_ios, + ), + ], + ), + ), + ), + ), + + ///gap + Space.yf(2), + + /// logout + Align( + alignment: Alignment.center, + child: TextButton( + onPressed: () {}, + child: Text( + 'Şahsy otagdan çykmak', + style: AppText.b1!.copyWith( + color: Colors.red, + ), + ), + ), + ), + + ///gap + Space.yf(2), + ], + ), + ), + ), + ); + } +} + +class RowWidget extends StatelessWidget { + final String text; + final IconData leadingIcon; + final IconData? trailingIcon; + const RowWidget({ + super.key, + required this.text, + required this.leadingIcon, + this.trailingIcon, + }); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Icon( + leadingIcon, + color: AppColors.darkGrey, + ), + Space.x!, + Text( + text, + style: AppText.b1!.copyWith( + color: AppColors.darkGrey, + ), + ), + if (trailingIcon != null) ...[ + const Spacer(), + Icon( + trailingIcon, + color: AppColors.darkGrey, + size: AppDimensions.normalize(7), + ), + ] + ], + ); + } +} diff --git a/lib/presentation/screens/root.dart b/lib/presentation/screens/root.dart index bc4b789..669d39d 100644 --- a/lib/presentation/screens/root.dart +++ b/lib/presentation/screens/root.dart @@ -1,12 +1,12 @@ -import 'package:cargo/core/core.dart'; -import 'package:cargo/presentation/screens/orders.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import '../../application/application.dart'; import '../../configs/configs.dart'; +import '../../core/core.dart'; import '../widgets/bottom_navbar.dart'; +import 'screens.dart'; class RootScreen extends StatelessWidget { const RootScreen({super.key}); @@ -69,9 +69,9 @@ class RootScreen extends StatelessWidget { case NavigationTab.categoriesTab: return const Text(' CategoriesScreen()'); case NavigationTab.productsTap: - return const Text('ProductsListScreen()'); + return const ProfileScreen(); default: - return const Text('HomeScreen()'); + return const OrdersScreen(); } }, ), diff --git a/lib/presentation/screens/screens.dart b/lib/presentation/screens/screens.dart index 58d6658..477fc72 100644 --- a/lib/presentation/screens/screens.dart +++ b/lib/presentation/screens/screens.dart @@ -1,5 +1,7 @@ +export 'login.dart'; +export 'order_details.dart'; +export 'orders.dart'; +export 'profile.dart'; +export 'root.dart'; export 'splash.dart'; export 'splash2.dart'; -export 'login.dart'; -export 'root.dart'; -export 'order_details.dart';