io api settings api
This commit is contained in:
16
lib/core/utils/date_time_formatter/date_time_formatter.dart
Normal file
16
lib/core/utils/date_time_formatter/date_time_formatter.dart
Normal 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;
|
||||
}
|
||||
}
|
||||
10
lib/core/utils/device_info/device_info_data.dart
Normal file
10
lib/core/utils/device_info/device_info_data.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user