Compare commits

...

3 Commits

@ -111,6 +111,7 @@ class SettingProvider extends ChangeNotifier {
}
String? get language => _language;
bool get isArabic => _language?.toLowerCase() == 'ar';
AssetGroup? get assetGroup => _assetGroup;

@ -278,7 +278,8 @@ class _DashboardViewState extends State<DashboardView> {
),
if (user != null && isUserFlowMedical == true)
Positioned(
right: 20.toScreenWidth,
right: context.settingProvider.isArabic ? null : 20.toScreenWidth,
left: context.settingProvider.isArabic ? 20.toScreenWidth : null,
bottom: 20.toScreenHeight,
child: Container(
padding: const EdgeInsets.all(0),

@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:test_sa/border_beam/src/beam_style.dart';
import 'package:test_sa/border_beam/src/border_beam.dart';
import 'package:test_sa/controllers/providers/api/user_provider.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/string_extensions.dart';
@ -148,7 +149,7 @@ class _CopilotChatPageState extends State<CopilotChatPage> {
children: [
"atoms_logo".toSvgAsset(width: 54),
Text(
"How Can I help you To Day?",
"How Can I help you Today?",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: AppTextStyles.heading6.copyWith(color: AppColor.lightTextColor(context), fontWeight: FontWeight.w500),
@ -177,7 +178,7 @@ class _CopilotChatPageState extends State<CopilotChatPage> {
mainAxisSize: MainAxisSize.min,
children: [
if (showDateHeader) _dateCard(currentMessage.timestamp?.toIso8601String().chatMsgDateWithYear ?? ""),
CopilotMessageBubble(message: currentMessage, showHeader: showHeader),
CopilotMessageBubble(message: currentMessage, showHeader: showHeader, userAvatar: Provider.of<UserProvider>(context, listen: false).user?.profilePhotoName),
],
);
},

@ -12,6 +12,7 @@ import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
import 'package:test_sa/views/widgets/dialogs/dialog.dart';
import 'package:test_sa/views/widgets/item_views/info_header_widget.dart';
import 'package:test_sa/views/widgets/item_views/info_text_widget.dart';
@ -134,15 +135,17 @@ class _CopilotHistoryPageState extends State<CopilotHistoryPage> {
)
else
Expanded(
child: ListView.separated(
padding: const EdgeInsets.all(16),
itemCount: filteredHistory.length,
separatorBuilder: (context, index) => 12.height,
itemBuilder: (context, index) {
final item = filteredHistory[index];
return messageHistoryCard(item: item, provider: provider);
},
child: SafeArea(
child: ListView.separated(
padding: const EdgeInsets.all(16),
itemCount: filteredHistory.length,
separatorBuilder: (context, index) => 12.height,
itemBuilder: (context, index) {
final item = filteredHistory[index];
return messageHistoryCard(item: item, provider: provider);
},
),
),
),
],
@ -189,9 +192,18 @@ class _CopilotHistoryPageState extends State<CopilotHistoryPage> {
).expanded,
IconButton(
onPressed: () async {
Utils.showLoading(context);
await provider.deleteHistory(item.threadId);
Utils.hideLoading(context);
bool result = await showDialog(
context: context,
builder: (_) => AAlertDialog(
title: "Confirm".addTranslation,
content: "Are you sure you want to delete?".addTranslation,
),
);
if (result) {
Utils.showLoading(context);
await provider.deleteHistory(item.threadId);
Utils.hideLoading(context);
}
},
style: const ButtonStyle(tapTargetSize: MaterialTapTargetSize.shrinkWrap),
icon: "delete_icon".toSvgAsset(width: 20, height: 20),

@ -13,10 +13,11 @@ import 'package:url_launcher/url_launcher.dart';
import '../model/copilot_message_model.dart';
class CopilotMessageBubble extends StatelessWidget {
final String? userAvatar;
final CopilotMessage message;
final bool showHeader;
const CopilotMessageBubble({Key? key, required this.message, this.showHeader = true}) : super(key: key);
const CopilotMessageBubble({Key? key, required this.message, this.showHeader = true, this.userAvatar}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -24,12 +25,6 @@ class CopilotMessageBubble extends StatelessWidget {
return isUser ? _senderCard(context) : _recipientCard(context);
}
static const Widget _avatar = SizedBox(
height: 26,
width: 26,
child: DecoratedBox(decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.grey)),
);
String get _timeText => (message.timestamp?.toIso8601String() ?? DateTime.now().toIso8601String()).chatMsgTime;
Widget _senderCard(BuildContext context) {
@ -38,7 +33,19 @@ class CopilotMessageBubble extends StatelessWidget {
children: [
const InfoTextLabelWidget(label: "Me"),
8.width,
_avatar,
Container(
height: 36,
width: 36,
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(color: AppColor.background(context), shape: BoxShape.circle, border: Border.all(color: Colors.transparent)),
child: userAvatar != null
? ClipOval(child: Image.network(userAvatar!, width: 14, height: 14))
: Icon(
Icons.person,
size: 16,
color: AppColor.icon2Color(context),
),
),
],
);
@ -95,7 +102,12 @@ class CopilotMessageBubble extends StatelessWidget {
final recipientHeader = Row(
mainAxisSize: MainAxisSize.min,
children: [
_avatar,
Container(
height: 36,
width: 36,
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(color: AppColor.background(context), shape: BoxShape.circle, border: Border.all(color: Colors.transparent)),
child: "copilot_logo".toSvgAsset(width: 14, height: 14)),
8.width,
const InfoTextLabelWidget(label: "Copilot"),
// Text(

Loading…
Cancel
Save