131 lines
4.3 KiB
Dart
131 lines
4.3 KiB
Dart
// ignore_for_file: use_build_context_synchronously
|
|
|
|
import 'package:flutter/material.dart';
|
|
import '../../../product/constant/image/image_constants.dart';
|
|
import '../../../product/extention/context_extention.dart';
|
|
import '../../../product/services/language_services.dart';
|
|
import '../../../product/utils/device_utils.dart';
|
|
|
|
import '../../../product/constant/icon/icon_constants.dart';
|
|
|
|
Future<Widget> notificationCard(
|
|
BuildContext context,
|
|
String notiticationType,
|
|
String notificationTitle,
|
|
String notificationDevicename,
|
|
String notificationLocation) async {
|
|
String location = await DeviceUtils.instance
|
|
.getFullDeviceLocation(context, notificationLocation);
|
|
String path = "";
|
|
DateTime time = DateTime.now();
|
|
if (notiticationType == "lowBattery") {
|
|
path = ImageConstants.instance.getImage("low_battery");
|
|
}
|
|
return Card(
|
|
child: Padding(
|
|
padding: context.paddingLow,
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Column(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
SizedBox(
|
|
child: Text(
|
|
notificationTitle,
|
|
style: const TextStyle(
|
|
letterSpacing: 1,
|
|
fontWeight: FontWeight.bold,
|
|
color: Color.fromARGB(255, 250, 84, 34),
|
|
fontSize: 18,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(height: context.lowValue),
|
|
SizedBox(
|
|
child: Text(
|
|
"${appLocalization(context).device_title} $notificationDevicename",
|
|
style: const TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 18,
|
|
),
|
|
maxLines: 2,
|
|
overflow: TextOverflow.ellipsis,
|
|
softWrap: true,
|
|
textAlign: TextAlign.start,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: context.dynamicWidth(0.15),
|
|
width: context.dynamicWidth(0.15),
|
|
child: Image.asset(path),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: context.lowValue),
|
|
Row(
|
|
children: [
|
|
IconConstants.instance
|
|
.getMaterialIcon(Icons.location_on_outlined),
|
|
SizedBox(
|
|
width: context.lowValue,
|
|
),
|
|
Expanded(
|
|
child: Text(
|
|
location,
|
|
style: const TextStyle(fontSize: 15),
|
|
maxLines: 2,
|
|
overflow: TextOverflow.ellipsis,
|
|
softWrap: true,
|
|
textAlign: TextAlign.start,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: context.lowValue),
|
|
Row(
|
|
children: [
|
|
IconConstants.instance.getMaterialIcon(Icons.schedule),
|
|
SizedBox(
|
|
width: context.lowValue,
|
|
),
|
|
Expanded(
|
|
child: Text(
|
|
time.toString(),
|
|
style: const TextStyle(fontSize: 15),
|
|
maxLines: 2,
|
|
overflow: TextOverflow.ellipsis,
|
|
softWrap: true,
|
|
textAlign: TextAlign.start,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Align(
|
|
alignment: Alignment.centerRight,
|
|
child: OutlinedButton(
|
|
style: const ButtonStyle(
|
|
backgroundColor: MaterialStatePropertyAll(Colors.blueAccent)),
|
|
onPressed: () {},
|
|
child: Text(
|
|
appLocalization(context).detail_message,
|
|
style: const TextStyle(
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|