Files
eatvio_app/lib/presentation/chat/chat_screen/chat_screen.dart

725 lines
28 KiB
Dart

/*import 'bloc/chat_bloc.dart';
import 'models/chat_model.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:flutter/material.dart';
import 'package:eatvio_app/widgets/custom_bottom_bar.dart';
class ChatScreen extends StatelessWidget {
const ChatScreen({Key? key}) : super(key: key);
static Widget builder(BuildContext context) {
return BlocProvider<ChatBloc>(
create: (context) => ChatBloc(ChatState(chatModelObj: ChatModel()))
..add(ChatInitialEvent()),
child: ChatScreen());
}
@override
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return Scaffold(
resizeToAvoidBottomInset: false,
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.imgPath,
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.imgCheckmarkBlueA400,
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.imgRectangle,
time: "lbl_10_15".tr,
),
),
SizedBox(height: 8.v),
Padding(
padding: EdgeInsets.only(
left: 84.h,
right: 17.h,
),
child: _buildColumncheckmark(
context,
imageOne: ImageConstant.imgRectangle186x254,
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: fs.Svg(
ImageConstant.imgGroup14,
),
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
.bodyMediumLightblueA70001,
),
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
.bodySmallBluegray40001,
),
)
],
),
)
],
),
),
),
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.imgPathGray50,
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.imgCheckmarkBlueA400,
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: fs.Svg(
ImageConstant.imgGroup76,
),
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.bodySmallBluegray40001,
),
)
],
),
),
),
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.imgGroup14,
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
.bodySmallBluegray40001,
),
)
],
),
),
)
],
),
),
),
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.imgPath,
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.imgCheckmarkBlueA400,
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: fs.Svg(
ImageConstant.imgGroup11,
),
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.imgDownload,
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.bodyLargeBlueA400,
),
Text(
"lbl_2_8_mb".tr,
style:
CustomTextStyles.bodyMediumBlueA400,
)
],
),
)
],
),
),
SizedBox(height: 4.v),
_buildRowcheckmark(
context,
time: "lbl_11_51".tr,
)
],
),
),
SizedBox(height: 30.v),
_buildRowattachone(context)
],
),
),
)
],
),
),
bottomNavigationBar: _buildBottomBar(context),
);
}
/// Section Widget
_buildAppbar(BuildContext context) {
return CustomAppBar(
leadingWidth: 26.h,
leading: AppbarLeadingImage(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(
left: 16.h,
top: 18.v,
bottom: 25.v,
),
onTap: () {
onTapArrowleftone(context);
},
),
title: Padding(
padding: EdgeInsets.only(left: 12.h),
child: Row(
children: [
AppbarTitleCircleimage(
imagePath: ImageConstant.imgOval40x40,
margin: EdgeInsets.only(bottom: 3.v),
),
Padding(
padding: EdgeInsets.only(
left: 12.h,
top: 2.v,
),
child: Column(
children: [
AppbarTitle(
text: "lbl2".tr,
),
SizedBox(height: 3.v),
AppbarSubtitle(
text: "msg_12_30".tr,
margin: EdgeInsets.only(right: 38.h),
)
],
),
)
],
),
),
styleType: Style.bgFill,
);
}
/// Section Widget
Widget _buildRowattachone(BuildContext context) {
return Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(
horizontal: 7.h,
vertical: 6.v,
),
decoration: AppDecoration.outlineGray,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomImageView(
imagePath: ImageConstant.imgAttach,
height: 29.adaptSize,
width: 29.adaptSize,
margin: EdgeInsets.only(
top: 1.v,
bottom: 6.v,
),
),
Expanded(
child: Padding(
padding: EdgeInsets.only(
left: 4.h,
bottom: 4.v,
),
child: BlocSelector<ChatBloc, ChatState, TextEditingController?>(
selector: (state) => state.messageController,
builder: (context, messageController) {
return CustomTextFormField(
controller: messageController,
hintText: "lbl_message".tr,
textInputAction: TextInputAction.done,
);
},
),
),
),
CustomImageView(
imagePath: ImageConstant.imgMenu,
height: 24.v,
width: 18.h,
margin: EdgeInsets.only(
left: 11.h,
top: 4.v,
bottom: 8.v,
),
)
],
),
);
}
/// Section Widget
_buildBottomBar(BuildContext context) {
return CustomBottomBar(onChanged: (BottomBarEnum type) {});
}
/// Common widget
Widget _buildColumncheckmark(
BuildContext context, {
required String imageOne,
required String time,
}) {
return Container(
padding: EdgeInsets.all(9.h),
decoration: BoxDecoration(
image: DecorationImage(
image: fs.Svg(
ImageConstant.imgGroup11,
),
fit: BoxFit.cover,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
CustomImageView(
imagePath: imageOne,
height: 186.v,
width: 254.h,
radius: BorderRadius.circular(
8.h,
),
margin: EdgeInsets.only(right: 1.h),
),
SizedBox(height: 10.v),
Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
time,
style: theme.textTheme.bodySmall!.copyWith(
color: appTheme.blueA400,
),
),
CustomImageView(
imagePath: ImageConstant.imgCheckmarkBlueA400,
height: 7.v,
width: 14.h,
margin: EdgeInsets.only(
left: 3.h,
bottom: 4.v,
),
)
],
)
],
),
);
}
/// 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.imgCheckmarkBlueA400,
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) {
switch (type) {
case BottomBarEnum.tf:
return AppRoutes.k1Page;
default:
return "/";
}
}
///Handling page based on route
Widget getCurrentPage(
BuildContext context,
String currentRoute,
) {
switch (currentRoute) {
case AppRoutes.k1Page:
return K1Page.builder(context);
default:
return DefaultWidget();
}
}
/// Navigates to the previous screen.
onTapArrowleftone(BuildContext context) {
NavigatorService.goBack();
}
}
*/