Complete refactoring SFM App Source Code

This commit is contained in:
anhtunz
2024-12-15 00:59:02 +07:00
parent caa73ca43c
commit 2e27d59278
247 changed files with 18390 additions and 0 deletions

View File

@@ -0,0 +1,130 @@
// 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,
),
),
),
),
],
),
),
);
}