io api settings api

This commit is contained in:
jayesh
2024-07-25 19:19:25 +05:30
parent bc15d0b1b3
commit 9b44dc0cf3
67 changed files with 2871 additions and 394 deletions

View File

@@ -0,0 +1,16 @@
import 'package:intl/intl.dart';
class DateTimeFormatter {
String formatDate(String dateString) {
// Parse the input date string
DateTime dateTime = DateTime.parse(dateString);
// Define the output format
DateFormat formatter = DateFormat('MMM dd yyyy');
// Format the date
String formattedDate = formatter.format(dateTime);
return formattedDate;
}
}

View File

@@ -0,0 +1,10 @@
import 'package:device_info_plus/device_info_plus.dart';
class DeviceInfoData {
final deviceInfoPlugin = DeviceInfoPlugin();
Future<String> getDeviceId() async {
var dataV = await deviceInfoPlugin.androidInfo;
return dataV.id.toString();
}
}

View File

@@ -16,4 +16,15 @@ class CommaTextInputFormatter extends TextInputFormatter {
selection: TextSelection.collapsed(offset: newText.length),
);
}
String getInitials(String name) {
List<String> words = name.split(' ');
String initials = '';
for (var word in words) {
if (word.isNotEmpty) {
initials += word[0].toUpperCase();
}
}
return initials;
}
}

View File

@@ -17,3 +17,12 @@ void launchEmail(String email) async {
throw 'Could not launch $url';
}
}
void launchWebsiteUrl(String websiteUrl) async {
final url = websiteUrl;
if (await canLaunchUrl(Uri.parse(url))) {
await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication);
} else {
throw 'Could not launch $url';
}
}