102 lines
3.2 KiB
Dart
102 lines
3.2 KiB
Dart
import 'package:chat/configs/app_colors.dart';
|
|
import 'package:chat/configs/app_size.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
import 'package:tencent_im_sdk_plugin/models/v2_tim_message.dart';
|
|
|
|
class ShowLocationMessage extends StatelessWidget {
|
|
final V2TimMessage message;
|
|
const ShowLocationMessage(this.message, {Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return InkWell(
|
|
onTap: () {
|
|
Permission.location.request().isGranted.then((value) {
|
|
if (value) {
|
|
// Get.toNamed(
|
|
// ConversationRoutes.conversationMapShow,
|
|
// arguments: {
|
|
// 'message': message,
|
|
// },
|
|
// );
|
|
}
|
|
});
|
|
},
|
|
child: Container(
|
|
width: Get.width * 0.618,
|
|
padding: const EdgeInsets.all(12),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(4),
|
|
color: message.isSelf! ? AppColors.primary : AppColors.white,
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Icon(
|
|
Icons.pin_drop_outlined,
|
|
size: 44,
|
|
color: message.isSelf! ? AppColors.white : AppColors.primary,
|
|
),
|
|
const SizedBox(
|
|
width: 8,
|
|
),
|
|
Expanded(
|
|
child: Text(
|
|
message.locationElem!.desc!,
|
|
maxLines: 2,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
color:
|
|
message.isSelf! ? AppColors.white : AppColors.primary,
|
|
fontSize: AppSize.fontSize,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Divider(
|
|
height: 16,
|
|
color: message.isSelf! ? AppColors.white : null,
|
|
),
|
|
Text(
|
|
'位置消息',
|
|
style: TextStyle(
|
|
color: message.isSelf! ? AppColors.white : AppColors.primary,
|
|
fontSize: AppSize.smallFontSize,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
// child: Container(
|
|
// padding: const EdgeInsets.all(12),
|
|
// decoration: BoxDecoration(
|
|
// borderRadius: BorderRadius.circular(4),
|
|
// color: message.isSelf! ? AppColors.primary : AppColors.white,
|
|
// ),
|
|
// child: Row(
|
|
// children: [
|
|
// Icon(
|
|
// Icons.pin_drop_outlined,
|
|
// size: 20,
|
|
// color: message.isSelf! ? AppColors.white : AppColors.active,
|
|
// ),
|
|
// Text(
|
|
// '【位置消息】点击查看',
|
|
// style: TextStyle(
|
|
// fontSize: AppSize.fontSize,
|
|
// color: message.isSelf! ? AppColors.white : AppColors.active,
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
);
|
|
}
|
|
}
|