From 150e6dc1f9d850fa2cc1cb727ecadabcba321427 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Mon, 6 May 2024 14:30:08 +0300 Subject: [PATCH] Lanscape orientation and more chat layouts --- assets/images/img_attach.svg | 3 + assets/images/img_mic.svg | 3 + lib/core/utils/image_constant.dart | 4 + lib/main.dart | 2 + .../chat/chat_screen/chat_screen.dart | 525 +----------------- 5 files changed, 27 insertions(+), 510 deletions(-) create mode 100644 assets/images/img_attach.svg create mode 100644 assets/images/img_mic.svg diff --git a/assets/images/img_attach.svg b/assets/images/img_attach.svg new file mode 100644 index 00000000..9f75ca7c --- /dev/null +++ b/assets/images/img_attach.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/img_mic.svg b/assets/images/img_mic.svg new file mode 100644 index 00000000..a7c11027 --- /dev/null +++ b/assets/images/img_mic.svg @@ -0,0 +1,3 @@ + + + diff --git a/lib/core/utils/image_constant.dart b/lib/core/utils/image_constant.dart index 8534fec2..8c9c0981 100644 --- a/lib/core/utils/image_constant.dart +++ b/lib/core/utils/image_constant.dart @@ -104,6 +104,10 @@ class ImageConstant { static String imgSupport = '$imagePath/img_nav_support.svg'; + static String imgMic = '$imagePath/img_mic.svg'; + + static String imgAttach = '$imagePath/img_attach.svg'; + static String imgExit = '$imagePath/img_nav_exit.svg'; //------------------------------------------------------------- diff --git a/lib/main.dart b/lib/main.dart index 7b5326dc..3a5a94bd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -14,6 +14,8 @@ void main() async { await dotenv.load(fileName: ".env"); await Hive.initFlutter(path); SystemChrome.setPreferredOrientations([ + DeviceOrientation.landscapeLeft, + DeviceOrientation.landscapeRight, DeviceOrientation.portraitUp, ]); await PrefUtils().init(); diff --git a/lib/presentation/chat/chat_screen/chat_screen.dart b/lib/presentation/chat/chat_screen/chat_screen.dart index 2a960624..6fa4071a 100644 --- a/lib/presentation/chat/chat_screen/chat_screen.dart +++ b/lib/presentation/chat/chat_screen/chat_screen.dart @@ -26,477 +26,17 @@ class ChatScreen extends StatelessWidget { appBar: _buildAppbar(context), body: SizedBox( width: double.maxFinite, - child: Column( - children: [ - SizedBox(height: 13.v), - Expanded( - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Container( - height: 34.v, - width: 211.h, - margin: EdgeInsets.only(right: 17.h), - child: Stack( - alignment: Alignment.bottomRight, - children: [ - CustomImageView( - imagePath: ImageConstant.imageNotFound, - height: 34.v, - width: 211.h, - alignment: Alignment.center, - ), - Align( - alignment: Alignment.bottomRight, - child: Padding( - padding: EdgeInsets.only( - right: 9.h, - bottom: 4.v, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.min, - children: [ - Padding( - padding: EdgeInsets.only(bottom: 1.v), - child: Text( - "msg_food_is_amazing".tr, - style: theme.textTheme.bodyLarge, - ), - ), - Padding( - padding: EdgeInsets.only( - left: 7.h, - top: 7.v, - ), - child: Text( - "lbl_10_10".tr, - style: theme.textTheme.bodySmall, - ), - ), - CustomImageView( - imagePath: ImageConstant.imageNotFound, - height: 7.v, - width: 14.h, - margin: EdgeInsets.only( - left: 2.h, - top: 9.v, - bottom: 4.v, - ), - ) - ], - ), - ), - ) - ], - ), - ), - SizedBox(height: 8.v), - Padding( - padding: EdgeInsets.only( - left: 84.h, - right: 17.h, - ), - child: _buildColumncheckmark( - context, - imageOne: ImageConstant.imageNotFound, - time: "lbl_10_15".tr, - ), - ), - SizedBox(height: 8.v), - Padding( - padding: EdgeInsets.only( - left: 84.h, - right: 17.h, - ), - child: _buildColumncheckmark( - context, - imageOne: ImageConstant.imageNotFound, - time: "lbl_10_15".tr, - ), - ), - SizedBox(height: 20.v), - Align( - alignment: Alignment.centerLeft, - child: Container( - margin: EdgeInsets.only( - left: 10.h, - right: 77.h, - ), - padding: EdgeInsets.symmetric( - horizontal: 11.h, - vertical: 4.v, - ), - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(ImageConstant.imageNotFound), - fit: BoxFit.cover, - ), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox(height: 3.v), - Padding( - padding: EdgeInsets.only(left: 7.h), - child: Row( - children: [ - SizedBox( - height: 33.v, - child: VerticalDivider( - width: 2.h, - thickness: 2.v, - endIndent: 1.h, - ), - ), - Padding( - padding: EdgeInsets.only(left: 8.h), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - "lbl_martha_craig".tr, - style: - CustomTextStyles.titleSmallBold, - ), - Text( - "lbl_good_morning".tr, - style: CustomTextStyles - .bodyMediumBluegray800_1, - ) - ], - ), - ) - ], - ), - ), - SizedBox(height: 4.v), - Padding( - padding: EdgeInsets.only(left: 6.h), - child: Row( - children: [ - Text( - "msg_do_you_know_what".tr, - style: theme.textTheme.bodyLarge, - ), - Padding( - padding: EdgeInsets.only( - left: 14.h, - top: 8.v, - ), - child: Text( - "lbl_11_40".tr, - style: - CustomTextStyles.bodyMediumBlack900, - ), - ) - ], - ), - ) - ], - ), - ), - ), - SizedBox(height: 20.v), - Container( - height: 34.v, - width: 266.h, - margin: EdgeInsets.only(right: 11.h), - child: Stack( - alignment: Alignment.topCenter, - children: [ - CustomImageView( - imagePath: ImageConstant.imageNotFound, - height: 34.v, - width: 266.h, - alignment: Alignment.center, - ), - Align( - alignment: Alignment.topCenter, - child: Padding( - padding: EdgeInsets.only(top: 2.v), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.min, - children: [ - Padding( - padding: EdgeInsets.only(top: 4.v), - child: Text( - "msg_it_s_morning_in".tr, - style: theme.textTheme.bodyLarge, - ), - ), - CustomImageView( - imagePath: ImageConstant.img, - height: 19.v, - width: 17.h, - margin: EdgeInsets.only( - left: 10.h, - bottom: 7.v, - ), - ), - Padding( - padding: EdgeInsets.only( - left: 14.h, - top: 12.v, - ), - child: Text( - "lbl_11_43".tr, - style: theme.textTheme.bodySmall, - ), - ), - CustomImageView( - imagePath: ImageConstant.imageNotFound, - height: 7.v, - width: 14.h, - margin: EdgeInsets.only( - left: 2.h, - top: 13.v, - bottom: 5.v, - ), - ) - ], - ), - ), - ) - ], - ), - ), - SizedBox(height: 20.v), - Align( - alignment: Alignment.centerLeft, - child: Container( - width: 281.h, - margin: EdgeInsets.only( - left: 17.h, - right: 76.h, - ), - padding: EdgeInsets.symmetric( - horizontal: 11.h, - vertical: 2.v, - ), - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(ImageConstant.imageNotFound), - fit: BoxFit.cover, - ), - ), - child: Row( - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: Container( - width: 191.h, - margin: EdgeInsets.only(top: 3.v), - child: Text( - "msg_what_is_the_most".tr, - maxLines: 2, - overflow: TextOverflow.ellipsis, - style: theme.textTheme.bodyLarge!.copyWith( - height: 1.29, - ), - ), - ), - ), - Padding( - padding: EdgeInsets.only( - left: 38.h, - top: 34.v, - ), - child: Text( - "lbl_11_45".tr, - style: - CustomTextStyles.bodySmallMulishBluegray800, - ), - ) - ], - ), - ), - ), - SizedBox(height: 8.v), - Align( - alignment: Alignment.centerLeft, - child: Container( - height: 34.v, - width: 178.h, - margin: EdgeInsets.only(left: 10.h), - child: Stack( - alignment: Alignment.bottomCenter, - children: [ - CustomImageView( - imagePath: ImageConstant.imageNotFound, - height: 34.v, - width: 178.h, - alignment: Alignment.center, - ), - Align( - alignment: Alignment.bottomCenter, - child: Padding( - padding: EdgeInsets.only(bottom: 3.v), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(bottom: 1.v), - child: Text( - "lbl_do_you_like_it".tr, - style: theme.textTheme.bodyLarge, - ), - ), - Padding( - padding: EdgeInsets.only( - left: 1.h, - top: 8.v, - ), - child: Text( - "lbl_11_45".tr, - style: CustomTextStyles - .bodySmallMulishBluegray800, - ), - ) - ], - ), - ), - ) - ], - ), - ), - ), - SizedBox(height: 20.v), - Container( - height: 34.v, - width: 218.h, - margin: EdgeInsets.only(right: 17.h), - child: Stack( - alignment: Alignment.bottomCenter, - children: [ - CustomImageView( - imagePath: ImageConstant.imageNotFound, - height: 34.v, - width: 218.h, - alignment: Alignment.center, - ), - Align( - alignment: Alignment.bottomCenter, - child: Padding( - padding: EdgeInsets.only(bottom: 4.v), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - "msg_i_think_top_two".tr, - style: theme.textTheme.bodyLarge, - ), - Padding( - padding: EdgeInsets.only( - left: 12.h, - top: 7.v, - ), - child: Text( - "lbl_11_50".tr, - style: theme.textTheme.bodySmall, - ), - ), - CustomImageView( - imagePath: ImageConstant.imageNotFound, - height: 7.v, - width: 14.h, - margin: EdgeInsets.only( - left: 2.h, - top: 9.v, - bottom: 4.v, - ), - ) - ], - ), - ), - ) - ], - ), - ), - SizedBox(height: 8.v), - Container( - width: 235.h, - margin: EdgeInsets.only( - left: 123.h, - right: 16.h, - ), - padding: EdgeInsets.symmetric( - horizontal: 9.h, - vertical: 2.v, - ), - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage(ImageConstant.imageNotFound), - fit: BoxFit.cover, - ), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 20.v), - Padding( - padding: EdgeInsets.only(left: 14.h), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CustomImageView( - imagePath: ImageConstant.imageNotFound, - height: 40.adaptSize, - width: 40.adaptSize, - margin: EdgeInsets.only(bottom: 2.v), - ), - Padding( - padding: EdgeInsets.only( - left: 31.h, - top: 5.v, - ), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - "lbl7".tr, - style: CustomTextStyles - .bodyMediumBluegray800, - ), - Text( - "lbl_2_8_mb".tr, - style: CustomTextStyles - .bodyMediumBluegray800, - ) - ], - ), - ) - ], - ), - ), - SizedBox(height: 4.v), - _buildRowcheckmark( - context, - time: "lbl_11_51".tr, - ) - ], - ), - ), - SizedBox(height: 30.v), - _buildRowattachone(context) - ], - ), - ), - ) - ], + child: Container( + width: double.maxFinite, + decoration: AppDecoration.fillGray, + child: ListView( + children: [ + SizedBox(height: 30.v), + ], + ), ), ), - bottomNavigationBar: _buildBottomBar(context), + bottomNavigationBar: _buildTextField(context), ); } @@ -531,13 +71,10 @@ class ChatScreen extends StatelessWidget { child: Column( children: [ AppbarSubtitle( - text: "lbl2".tr, + text: "Валерий Леонтьев", ), SizedBox(height: 3.v), - AppbarSubtitle( - text: "msg_12_30".tr, - margin: EdgeInsets.only(right: 38.h), - ) + Text("Был в сети вчера", style: theme.textTheme.bodySmall!) ], ), ) @@ -548,7 +85,7 @@ class ChatScreen extends StatelessWidget { } /// Section Widget - Widget _buildRowattachone(BuildContext context) { + _buildTextField(BuildContext context) { return Container( width: double.maxFinite, padding: EdgeInsets.symmetric( @@ -561,7 +98,7 @@ class ChatScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ CustomImageView( - imagePath: ImageConstant.imageNotFound, + imagePath: ImageConstant.imgAttach, height: 29.adaptSize, width: 29.adaptSize, margin: EdgeInsets.only( @@ -580,7 +117,7 @@ class ChatScreen extends StatelessWidget { builder: (context, messageController) { return CustomTextFormField( controller: messageController, - hintText: "lbl_message".tr, + hintText: "Напишите сообщение...", textInputAction: TextInputAction.done, ); }, @@ -588,7 +125,7 @@ class ChatScreen extends StatelessWidget { ), ), CustomImageView( - imagePath: ImageConstant.imageNotFound, + imagePath: ImageConstant.imgMic, height: 24.v, width: 18.h, margin: EdgeInsets.only( @@ -602,11 +139,6 @@ class ChatScreen extends StatelessWidget { ); } - /// Section Widget - _buildBottomBar(BuildContext context) { - return CustomBottomBar(onChanged: (BottomBarEnum type) {}); - } - /// Common widget Widget _buildColumncheckmark( BuildContext context, { @@ -661,33 +193,6 @@ class ChatScreen extends StatelessWidget { } /// Common widget - Widget _buildRowcheckmark( - BuildContext context, { - required String time, - }) { - return Row( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - time, - style: theme.textTheme.bodySmall!.copyWith( - color: appTheme.blueA400, - ), - ), - CustomImageView( - imagePath: ImageConstant.imageNotFound, - height: 7.v, - width: 14.h, - margin: EdgeInsets.only( - left: 2.h, - top: 2.v, - bottom: 3.v, - ), - ) - ], - ); - } ///Handling route based on bottom click actions String getCurrentRoute(BottomBarEnum type) {